Skip to content

Near-release cleanup #724

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Mar 29, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
* GOTO-CC: GCC-style error/warning messages
* GOTO-CC: New options --native-compiler and --native-linker to select the
compiler/linker to be used when building combined native/goto object files.
* CBMC, SYMEX, GOTO-INSTRUMENT: New option --drop-unused-functions. Removed
ambiguous --show-reachable-properties.
* CBMC: New option --no-built-in-assertions


5.6
Expand Down
2 changes: 2 additions & 0 deletions regression/cbmc/Pointer_byte_extract9/main.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#include <assert.h>

int main()
{
int N;
Expand Down
14 changes: 7 additions & 7 deletions regression/cbmc/graphml_witness1/test.desc
Original file line number Diff line number Diff line change
Expand Up @@ -46,29 +46,29 @@ main.c
<graph edgedefault="directed">
<data key="sourcecodelang">C</data>
<node id="sink"/>
<node id="33.22">
<node id="[0-9\.]*">
<data key="entry">true</data>
</node>
<edge source="33.22" target="4.29">
<data key="originfile">main.c</data>
<data key="startline">21</data>
</edge>
<node id="4.29"/>
<edge source="4.29" target="29.31">
<node id="[0-9\.]*"/>
<edge source="[0-9\.]*" target="[0-9\.]*">
<data key="originfile">main.c</data>
<data key="startline">29</data>
<data key="assumption.scope">main</data>
</edge>
<node id="29.31"/>
<edge source="29.31" target="5.33">
<node id="[0-9\.]*"/>
<edge source="[0-9\.]*" target="[0-9\.]*">
<data key="originfile">main.c</data>
<data key="startline">15</data>
<data key="assumption.scope">remove_one</data>
</edge>
<node id="5.33">
<node id="[0-9\.]*">
<data key="violation">true</data>
</node>
<edge source="5.33" target="sink">
<edge source="[0-9\.]*" target="sink">
<data key="originfile">main.c</data>
<data key="startline">31</data>
</edge>
Expand Down
5 changes: 3 additions & 2 deletions src/cbmc/cbmc_parse_options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -946,7 +946,7 @@ bool cbmc_parse_optionst::process_goto_program(
if(cmdline.isset("drop-unused-functions"))
{
// Entry point will have been set before and function pointers removed
status() << "Removing Unused Functions" << eom;
status() << "Removing unused functions" << eom;
remove_unused_functions(goto_functions, ui_message_handler);
}

Expand Down Expand Up @@ -1096,7 +1096,6 @@ void cbmc_parse_optionst::help()
" --property id only check one specific property\n"
" --stop-on-fail stop analysis once a failed property is detected\n" // NOLINT(*)
" --trace give a counterexample trace for failed properties\n" //NOLINT(*)
" --drop-unused-functions drop functions trivially unreachable from main function\n" // NOLINT(*)
"\n"
"C/C++ frontend options:\n"
" -I path set include path (C/C++)\n"
Expand Down Expand Up @@ -1142,6 +1141,7 @@ void cbmc_parse_optionst::help()
" --show-parse-tree show parse tree\n"
" --show-symbol-table show symbol table\n"
HELP_SHOW_GOTO_FUNCTIONS
" --drop-unused-functions drop functions trivially unreachable from main function\n" // NOLINT(*)
"\n"
"Program instrumentation options:\n"
HELP_GOTO_CHECK
Expand Down Expand Up @@ -1199,5 +1199,6 @@ void cbmc_parse_optionst::help()
" --xml-ui use XML-formatted output\n"
" --xml-interface bi-directional XML interface\n"
" --json-ui use JSON-formatted output\n"
" --verbosity # verbosity level\n"
"\n";
}
11 changes: 11 additions & 0 deletions src/goto-instrument/goto_instrument_parse_options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -744,6 +744,14 @@ int goto_instrument_parse_optionst::doit()
return 0;
}

if(cmdline.isset("drop-unused-functions"))
{
do_indirect_call_and_rtti_removal();

status() << "Removing unused functions" << eom;
remove_unused_functions(goto_functions, get_message_handler());
}

// write new binary?
if(cmdline.args.size()==2)
{
Expand Down Expand Up @@ -1182,6 +1190,9 @@ void goto_instrument_parse_optionst::instrument_goto_program()

if(cmdline.isset("string-abstraction"))
{
do_indirect_call_and_rtti_removal();
do_remove_returns();

status() << "String Abstraction" << eom;
string_abstraction(
symbol_table,
Expand Down
1 change: 1 addition & 0 deletions src/goto-instrument/goto_instrument_parse_options.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ Author: Daniel Kroening, [email protected]
"(stack-depth):(nondet-static)" \
"(function-enter):(function-exit):(branch):" \
OPT_SHOW_GOTO_FUNCTIONS \
"(drop-unused-functions)" \
"(show-value-sets)" \
"(show-global-may-alias)" \
"(show-local-bitvector-analysis)(show-custom-bitvector-analysis)" \
Expand Down
2 changes: 1 addition & 1 deletion src/solvers/flattening/boolbv_floatbv_op.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ bvt boolbvt::convert_floatbv_op(const exprt &expr)
else if(expr.id()==ID_floatbv_rem)
return float_utils.rem(bv0, bv1);
else
assert(false);
throw "unexpected operator "+expr.id_string();
}
else if(type.id()==ID_vector || type.id()==ID_complex)
{
Expand Down
2 changes: 1 addition & 1 deletion src/solvers/floatbv/float_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ bvt float_utilst::to_integer(
return result;
}
else
assert(0);
throw "unsupported rounding mode";
}

/*******************************************************************\
Expand Down
5 changes: 3 additions & 2 deletions src/symex/symex_parse_options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ bool symex_parse_optionst::process_goto_program(const optionst &options)
if(cmdline.isset("drop-unused-functions"))
{
// Entry point will have been set before and function pointers removed
status() << "Removing Unused Functions" << eom;
status() << "Removing unused functions" << eom;
remove_unused_functions(goto_model.goto_functions, ui_message_handler);
}

Expand Down Expand Up @@ -690,7 +690,6 @@ void symex_parse_optionst::help()
" --stop-on-fail stop analysis once a failed property is detected\n"
// NOLINTNEXTLINE(whitespace/line_length)
" --trace give a counterexample trace for failed properties\n"
" --drop-unused-functions drop functions trivially unreachable from main function\n" // NOLINT(*)
"\n"
"Frontend options:\n"
" -I path set include path (C/C++)\n"
Expand All @@ -705,6 +704,7 @@ void symex_parse_optionst::help()
" --show-parse-tree show parse tree\n"
" --show-symbol-table show symbol table\n"
HELP_SHOW_GOTO_FUNCTIONS
" --drop-unused-functions drop functions trivially unreachable from main function\n" // NOLINT(*)
" --ppc-macos set MACOS/PPC architecture\n"
" --mm model set memory model (default: sc)\n"
" --arch set architecture (default: "
Expand Down Expand Up @@ -738,5 +738,6 @@ void symex_parse_optionst::help()
"Other options:\n"
" --version show version and exit\n"
" --xml-ui use XML-formatted output\n"
" --verbosity # verbosity level\n"
"\n";
}
4 changes: 0 additions & 4 deletions src/util/irep.h
Original file line number Diff line number Diff line change
Expand Up @@ -283,11 +283,7 @@ class irept

void clear()
{
#ifdef USE_DSTRING
data.clear();
#else
data="";
#endif
sub.clear();
named_sub.clear();
comments.clear();
Expand Down
4 changes: 2 additions & 2 deletions src/util/json_irep.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,8 @@ void json_irept::convert_from_json(const jsont &in, irept &out) const
}

for(const auto &named_sub : in["namedSub"].object)
convert_from_json(named_sub.second, out.get_named_sub()[named_sub.first]);
convert_from_json(named_sub.second, out.add(named_sub.first));

for(const auto &comment : in["comment"].object)
convert_from_json(comment.second, out.get_comments()[comment.first]);
convert_from_json(comment.second, out.add(comment.first));
}
6 changes: 6 additions & 0 deletions src/util/rename_symbol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,9 @@ Function: rename_symbolt::have_to_rename

bool rename_symbolt::have_to_rename(const exprt &dest) const
{
if(expr_map.empty() && type_map.empty())
return false;

// first look at type

if(have_to_rename(dest.type()))
Expand Down Expand Up @@ -274,6 +277,9 @@ Function: rename_symbolt::have_to_rename

bool rename_symbolt::have_to_rename(const typet &dest) const
{
if(expr_map.empty() && type_map.empty())
return false;

if(dest.has_subtype())
if(have_to_rename(dest.subtype()))
return true;
Expand Down