cprover
Loading...
Searching...
No Matches
goto_check_c.h
Go to the documentation of this file.
1/*******************************************************************\
2
3Module: Checks for Errors in C/C++ Programs
4
5Author: Daniel Kroening, kroening@kroening.com
6
7\*******************************************************************/
8
11
12#ifndef CPROVER_ANALYSES_GOTO_CHECK_C_H
13#define CPROVER_ANALYSES_GOTO_CHECK_C_H
14
16
17class goto_modelt;
18class namespacet;
19class optionst;
21
22void goto_check_c(
23 const namespacet &ns,
24 const optionst &options,
25 goto_functionst &goto_functions,
26 message_handlert &message_handler);
27
28void goto_check_c(
29 const irep_idt &function_identifier,
31 const namespacet &ns,
32 const optionst &options,
33 message_handlert &message_handler);
34
35void goto_check_c(
36 const optionst &options,
37 goto_modelt &goto_model,
38 message_handlert &message_handler);
39
40#define OPT_GOTO_CHECK \
41 "(bounds-check)(pointer-check)(memory-leak-check)" \
42 "(div-by-zero-check)(enum-range-check)(signed-overflow-check)(unsigned-" \
43 "overflow-check)" \
44 "(pointer-overflow-check)(conversion-check)(undefined-shift-check)" \
45 "(float-overflow-check)(nan-check)(no-built-in-assertions)" \
46 "(pointer-primitive-check)" \
47 "(retain-trivial-checks)" \
48 "(error-label):" \
49 "(no-assertions)(no-assumptions)" \
50 "(assert-to-assume)"
51
52// clang-format off
53#define HELP_GOTO_CHECK \
54 " --bounds-check enable array bounds checks\n" \
55 " --pointer-check enable pointer checks\n" /* NOLINT(whitespace/line_length) */ \
56 " --memory-leak-check enable memory leak checks\n" \
57 " --div-by-zero-check enable division by zero checks\n" \
58 " --signed-overflow-check enable signed arithmetic over- and underflow checks\n" /* NOLINT(whitespace/line_length) */ \
59 " --unsigned-overflow-check enable arithmetic over- and underflow checks\n" /* NOLINT(whitespace/line_length) */ \
60 " --pointer-overflow-check enable pointer arithmetic over- and underflow checks\n" /* NOLINT(whitespace/line_length) */ \
61 " --conversion-check check whether values can be represented after type cast\n" /* NOLINT(whitespace/line_length) */ \
62 " --undefined-shift-check check shift greater than bit-width\n" \
63 " --float-overflow-check check floating-point for +/-Inf\n" \
64 " --nan-check check floating-point for NaN\n" \
65 " --enum-range-check checks that all enum type expressions have values in the enum range\n" /* NOLINT(whitespace/line_length) */ \
66 " --pointer-primitive-check checks that all pointers in pointer primitives are valid or null\n" /* NOLINT(whitespace/line_length) */ \
67 " --retain-trivial-checks include checks that are trivially true\n" \
68 " --error-label label check that label is unreachable\n" \
69 " --no-built-in-assertions ignore assertions in built-in library\n" \
70 " --no-assertions ignore user assertions\n" \
71 " --no-assumptions ignore user assumptions\n" \
72 " --assert-to-assume convert user assertions to assumptions\n" \
73
74#define PARSE_OPTIONS_GOTO_CHECK(cmdline, options) \
75 options.set_option("bounds-check", cmdline.isset("bounds-check")); \
76 options.set_option("pointer-check", cmdline.isset("pointer-check")); \
77 options.set_option("memory-leak-check", cmdline.isset("memory-leak-check")); \
78 options.set_option("div-by-zero-check", cmdline.isset("div-by-zero-check")); \
79 options.set_option("enum-range-check", cmdline.isset("enum-range-check")); \
80 options.set_option("signed-overflow-check", cmdline.isset("signed-overflow-check")); /* NOLINT(whitespace/line_length) */ \
81 options.set_option("unsigned-overflow-check", cmdline.isset("unsigned-overflow-check")); /* NOLINT(whitespace/line_length) */ \
82 options.set_option("pointer-overflow-check", cmdline.isset("pointer-overflow-check")); /* NOLINT(whitespace/line_length) */ \
83 options.set_option("conversion-check", cmdline.isset("conversion-check")); \
84 options.set_option("undefined-shift-check", cmdline.isset("undefined-shift-check")); /* NOLINT(whitespace/line_length) */ \
85 options.set_option("float-overflow-check", cmdline.isset("float-overflow-check")); /* NOLINT(whitespace/line_length) */ \
86 options.set_option("nan-check", cmdline.isset("nan-check")); \
87 options.set_option("built-in-assertions", !cmdline.isset("no-built-in-assertions")); /* NOLINT(whitespace/line_length) */ \
88 options.set_option("pointer-primitive-check", cmdline.isset("pointer-primitive-check")); /* NOLINT(whitespace/line_length) */ \
89 options.set_option("retain-trivial-checks", \
90 cmdline.isset("retain-trivial-checks")); \
91 options.set_option("assertions", !cmdline.isset("no-assertions")); /* NOLINT(whitespace/line_length) */ \
92 options.set_option("assumptions", !cmdline.isset("no-assumptions")); /* NOLINT(whitespace/line_length) */ \
93 options.set_option("assert-to-assume", cmdline.isset("assert-to-assume")); /* NOLINT(whitespace/line_length) */ \
94 options.set_option("retain-trivial", cmdline.isset("retain-trivial")); /* NOLINT(whitespace/line_length) */ \
95 if(cmdline.isset("error-label")) \
96 options.set_option("error-label", cmdline.get_values("error-label")); \
97 (void)0
98// clang-format on
99
100#endif // CPROVER_ANALYSES_GOTO_CHECK_C_H
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
Definition: dstring.h:37
A collection of goto functions.
::goto_functiont goto_functiont
A namespacet is essentially one or two symbol tables bound together, to allow for symbol lookups in t...
Definition: namespace.h:91
void goto_check_c(const namespacet &ns, const optionst &options, goto_functionst &goto_functions, message_handlert &message_handler)
Goto Programs with Functions.