52 for(
const auto &fun : sorted)
55 const bool has_body = fun->second.body_available();
59 std::cout <<
"^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n";
62 fun->second.body.output(std::cout);
73 for(
const auto &fun : sorted)
80 bool has_loop =
false;
81 for(
auto &instruction : fun->second.body.instructions)
82 if(instruction.is_backwards_goto())
100 std::cerr <<
"Usage error!" <<
'\n';
104 if(cmdline.
isset(
"version"))
119 if(cmdline.
args.empty())
121 std::cerr <<
"Please provide a program to verify\n";
131 gcc_version.
get(
"gcc");
138 if(cmdline.
isset(
"verbose"))
147 auto &remove_function_pointers_message_handler =
148 cmdline.
isset(
"verbose")
153 remove_function_pointers_message_handler, goto_model,
false);
158 bool perform_inlining;
160 if(cmdline.
isset(
"smt2"))
162 perform_inlining = !cmdline.
isset(
"no-inline");
166 perform_inlining = cmdline.
isset(
"inline");
169 if(!perform_inlining)
172 if(!cmdline.
isset(
"no-safety"))
175 if(cmdline.
isset(
"no-assertions"))
185 std::cout <<
"Performing inlining\n";
189 goto_model.goto_functions.compute_target_numbers();
190 goto_model.goto_functions.compute_location_numbers();
192 if(cmdline.
isset(
"show-goto-functions"))
199 if(cmdline.
isset(
"show-loops"))
205 if(cmdline.
isset(
"show-functions-with-loops"))
211 if(cmdline.
isset(
"validate-goto-model"))
213 goto_model.validate();
216 if(cmdline.
isset(
"show-properties"))
226 const auto contract = [&]() -> std::optional<irep_idt> {
227 if(cmdline.
isset(
"contract"))
238 if(cmdline.
isset(
"outfile"))
240 auto file_name = cmdline.
get_value(
"outfile");
245 std::cerr <<
"failed to open " << file_name <<
'\n';
254 std::cout <<
"formula written to " << file_name <<
'\n';
262 goto_model,
format, perform_inlining, contract, std::cout);
265 if(!cmdline.
isset(
"solve"))
271 if(cmdline.
isset(
"unwind"))
278 solver_options.
trace = cmdline.
isset(
"trace");
283 goto_model, perform_inlining, contract, solver_options);
299 std::cerr <<
"error: " << e.
what() <<
'\n';
317 "Usage: \tPurpose:\n"
319 " {bcprover} [{y-?}] [{y-h}] [{y--help}] \t show this help\n"
320 " {bcprover} {usource-file.c} \t convert a given C program\n"
323 " {y--inline} \t perform function call inlining before"
324 " generating the formula\n"
325 " {y--no-safety} \t disable safety checks\n"
326 " {y--contract} {ufunction} \t check contract of given function\n"
327 " {y--outfile} {ufile-name} \t set output file for formula\n"
328 " {y--smt2} \t output formula in SMT-LIB2 format\n"
329 " {y--text} \t output formula in text format\n"
void adjust_float_expressions(exprt &expr, const exprt &rounding_mode)
Replaces arithmetic operations and typecasts involving floating point numbers with their equivalent f...
std::unique_ptr< languaget > new_ansi_c_language()
void c_safety_checks(goto_functionst::function_mapt::value_type &f, const exprt &expr, access_typet access_type, const namespacet &ns, goto_programt &dest)
void no_assertions(goto_functionst::function_mapt::value_type &f)
Checks for Errors in C/C++ Programs.
std::string get_value(char option) const
virtual bool isset(char option) const
virtual bool parse(int argc, const char **argv, const char *optstring)
Parses a commandline according to a specification given in optstring.
bool set(const cmdlinet &cmdline)
struct configt::ansi_ct ansi_c
Base class for exceptions thrown in the cprover project.
virtual std::string what() const
A human readable description of what went wrong.
void help()
display command line help
void get(const std::string &executable)
std::vector< function_mapt::const_iterator > sorted() const
returns a vector of the iterators in alphabetical order
symbol_tablet symbol_table
Symbol table.
goto_functionst goto_functions
GOTO functions.
void set_verbosity(unsigned _verbosity)
A namespacet is essentially one or two symbol tables bound together, to allow for symbol lookups in t...
bool lookup(const irep_idt &name, const symbolt *&symbol) const override
See documentation for namespace_baset::lookup().
const irep_idt & display_name() const
Return language specific display name if present.
irep_idt name
The unique identifier.
static void show_functions_with_loops(const goto_modelt &goto_model)
static void show_goto_functions(const goto_modelt &goto_model)
Document and give macros for the exit codes of CPROVER binaries.
#define CPROVER_EXIT_INTERNAL_ERROR
An error has been encountered during processing the requested analysis.
#define CPROVER_EXIT_INCORRECT_TASK
The command line is correctly structured but cannot be carried out due to missing files,...
#define CPROVER_EXIT_PARSE_ERROR
An error during parsing of the input program.
#define CPROVER_EXIT_VERIFICATION_UNSAFE
Verification successful indicates the analysis has been performed without error AND the software is n...
#define CPROVER_EXIT_USAGE_ERROR
A usage error is returned when the command line is invalid or conflicting.
#define CPROVER_EXIT_EXCEPTION
An (unanticipated) exception was thrown during computation.
#define CPROVER_EXIT_SUCCESS
Success indicates the required analysis has been performed without error.
void configure_gcc(const gcc_versiont &gcc_version)
void goto_inline(goto_modelt &goto_model, message_handlert &message_handler, bool adjust_function)
Inline every function call into the entry_point() function.
Function Inlining This gives a number of different interfaces to the function inlining functionality ...
goto_modelt initialize_goto_model(const std::vector< std::string > &files, message_handlert &message_handler, const optionst &options)
Initialize a Goto Program.
void instrument_contracts(goto_modelt &goto_model)
Instrument Given Invariants.
void instrument_given_invariants(goto_functionst::function_mapt::value_type &f)
Instrument Given Invariants.
void show_loop_ids(ui_message_handlert::uit ui, const goto_modelt &goto_model)
void register_language(language_factoryt factory)
Register a language Note: registering a language is required for using the functions in language_util...
std::string align_center_with_border(const std::string &text)
Utility for displaying help centered messages borderered by "* *".
std::string banner_string(const std::string &front_end, const std::string &version)
void remove_function_pointers(message_handlert &_message_handler, goto_modelt &goto_model, bool only_remove_const_fps)
Remove Indirect Function Calls.
void label_properties(goto_modelt &goto_model)
Set the properties to check.
void show_properties(const namespacet &ns, const irep_idt &identifier, message_handlert &message_handler, ui_message_handlert::uit ui, const goto_programt &goto_program)
void install_signal_catcher()
#define UNREACHABLE
This should be used to mark dead code.
solver_resultt state_encoding_solver(const goto_modelt &goto_model, bool program_is_inlined, std::optional< irep_idt > contract, const solver_optionst &solver_options)
void state_encoding(const goto_modelt &goto_model, bool program_is_inlined, std::optional< irep_idt > contract, encoding_targett &dest)
void variable_encoding(const goto_modelt &goto_model, state_encoding_formatt state_encoding_format, std::ostream &out)
preprocessort preprocessor
#define widen_if_needed(s)
null_message_handlert null_message_handler
const char * CBMC_VERSION