Skip to content

Commit b7eb69c

Browse files
committed
jdiff: Remove processing of unsupported options
The options 1) tested for by the code, 2) documented in --help output, and 3) actually supported in the cmdlinet configuration were inconsistent. All supported options are now documented in the --help output, and testing-for of unsupported options has been removed. Also, uses of goto_functions preprocessing was cleaned up to match what Java bytecode might actually need and use.
1 parent c05708c commit b7eb69c

File tree

2 files changed

+7
-95
lines changed

2 files changed

+7
-95
lines changed

jbmc/src/jdiff/jdiff_parse_options.cpp

Lines changed: 6 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,10 @@ Author: Peter Schrammel
2424
#include <goto-programs/instrument_preconditions.h>
2525
#include <goto-programs/loop_ids.h>
2626
#include <goto-programs/mm_io.h>
27-
#include <goto-programs/remove_complex.h>
2827
#include <goto-programs/remove_function_pointers.h>
2928
#include <goto-programs/remove_returns.h>
3029
#include <goto-programs/remove_skip.h>
31-
#include <goto-programs/remove_vector.h>
3230
#include <goto-programs/remove_virtual_functions.h>
33-
#include <goto-programs/rewrite_union.h>
3431
#include <goto-programs/set_properties.h>
3532
#include <goto-programs/show_properties.h>
3633

@@ -71,88 +68,9 @@ void jdiff_parse_optionst::get_command_line_options(optionst &options)
7168
if(cmdline.isset("cover"))
7269
parse_cover_options(cmdline, options);
7370

74-
if(cmdline.isset("mm"))
75-
options.set_option("mm", cmdline.get_value("mm"));
76-
7771
// all checks supported by goto_check
7872
PARSE_OPTIONS_GOTO_CHECK_JAVA(cmdline, options);
7973

80-
if(cmdline.isset("debug-level"))
81-
options.set_option("debug-level", cmdline.get_value("debug-level"));
82-
83-
if(cmdline.isset("unwindset"))
84-
options.set_option("unwindset", cmdline.get_value("unwindset"));
85-
86-
// constant propagation
87-
if(cmdline.isset("no-propagation"))
88-
options.set_option("propagation", false);
89-
else
90-
options.set_option("propagation", true);
91-
92-
// check array bounds
93-
if(cmdline.isset("bounds-check"))
94-
options.set_option("bounds-check", true);
95-
else
96-
options.set_option("bounds-check", false);
97-
98-
// check division by zero
99-
if(cmdline.isset("div-by-zero-check"))
100-
options.set_option("div-by-zero-check", true);
101-
else
102-
options.set_option("div-by-zero-check", false);
103-
104-
// check overflow/underflow
105-
if(cmdline.isset("signed-overflow-check"))
106-
options.set_option("signed-overflow-check", true);
107-
else
108-
options.set_option("signed-overflow-check", false);
109-
110-
// check overflow/underflow
111-
if(cmdline.isset("unsigned-overflow-check"))
112-
options.set_option("unsigned-overflow-check", true);
113-
else
114-
options.set_option("unsigned-overflow-check", false);
115-
116-
// check overflow/underflow
117-
if(cmdline.isset("float-overflow-check"))
118-
options.set_option("float-overflow-check", true);
119-
else
120-
options.set_option("float-overflow-check", false);
121-
122-
// check for NaN (not a number)
123-
if(cmdline.isset("nan-check"))
124-
options.set_option("nan-check", true);
125-
else
126-
options.set_option("nan-check", false);
127-
128-
// check pointers
129-
if(cmdline.isset("pointer-check"))
130-
options.set_option("pointer-check", true);
131-
else
132-
options.set_option("pointer-check", false);
133-
134-
// check for memory leaks
135-
if(cmdline.isset("memory-leak-check"))
136-
options.set_option("memory-leak-check", true);
137-
else
138-
options.set_option("memory-leak-check", false);
139-
140-
// check assertions
141-
if(cmdline.isset("no-assertions"))
142-
options.set_option("assertions", false);
143-
else
144-
options.set_option("assertions", true);
145-
146-
// use assumptions
147-
if(cmdline.isset("no-assumptions"))
148-
options.set_option("assumptions", false);
149-
else
150-
options.set_option("assumptions", true);
151-
152-
// magic error label
153-
if(cmdline.isset("error-label"))
154-
options.set_option("error-label", cmdline.get_values("error-label"));
155-
15674
options.set_option("show-properties", cmdline.isset("show-properties"));
15775
}
15876

@@ -270,11 +188,8 @@ bool jdiff_parse_optionst::process_goto_program(
270188
// instrument library preconditions
271189
instrument_preconditions(goto_model);
272190

273-
// remove returns, gcc vectors, complex
191+
// remove returns
274192
remove_returns(goto_model);
275-
remove_vector(goto_model);
276-
remove_complex(goto_model);
277-
rewrite_union(goto_model);
278193

279194
// add generic checks
280195
log.status() << "Generic Property Instrumentation" << messaget::eom;
@@ -286,16 +201,13 @@ bool jdiff_parse_optionst::process_goto_program(
286201
// recalculate numbers, etc.
287202
goto_model.goto_functions.update();
288203

289-
// add loop ids
290-
goto_model.goto_functions.compute_loop_numbers();
291-
292-
// remove skips such that trivial GOTOs are deleted and not considered
293-
// for coverage annotation:
294-
remove_skip(goto_model);
295-
296204
// instrument cover goals
297205
if(cmdline.isset("cover"))
298206
{
207+
// remove skips such that trivial GOTOs are deleted and not considered for
208+
// coverage annotation:
209+
remove_skip(goto_model);
210+
299211
const auto cover_config =
300212
get_cover_config(options, goto_model.symbol_table, ui_message_handler);
301213
if(instrument_cover_goals(cover_config, goto_model, ui_message_handler))
@@ -311,7 +223,6 @@ bool jdiff_parse_optionst::process_goto_program(
311223

312224
// remove any skips introduced since coverage instrumentation
313225
remove_skip(goto_model);
314-
goto_model.goto_functions.update();
315226
}
316227

317228
return false;
@@ -335,7 +246,7 @@ void jdiff_parse_optionst::help()
335246
"Diff options:\n"
336247
HELP_SHOW_GOTO_FUNCTIONS
337248
HELP_SHOW_PROPERTIES
338-
" --syntactic do syntactic diff (default)\n"
249+
" --show-loops show the loops in the programs\n"
339250
" -u | --unified output unified diff\n"
340251
" --change-impact | \n"
341252
" --forward-impact |\n"

jbmc/src/jdiff/jdiff_parse_options.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ class goto_modelt;
2929
"(json-ui)" \
3030
OPT_SHOW_GOTO_FUNCTIONS \
3131
OPT_SHOW_PROPERTIES \
32+
"(show-loops)" \
3233
OPT_GOTO_CHECK_JAVA \
3334
OPT_COVER \
3435
"(verbosity):(version)" \

0 commit comments

Comments
 (0)