Skip to content

Commit 7a0061d

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 f046844 commit 7a0061d

File tree

2 files changed

+7
-99
lines changed

2 files changed

+7
-99
lines changed

jbmc/src/jdiff/jdiff_parse_options.cpp

Lines changed: 6 additions & 98 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,89 +68,8 @@ 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);
79-
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-
156-
options.set_option("show-properties", cmdline.isset("show-properties"));
15773
}
15874

15975
/// invoke main modules
@@ -270,11 +186,8 @@ bool jdiff_parse_optionst::process_goto_program(
270186
// instrument library preconditions
271187
instrument_preconditions(goto_model);
272188

273-
// remove returns, gcc vectors, complex
189+
// remove returns
274190
remove_returns(goto_model);
275-
remove_vector(goto_model);
276-
remove_complex(goto_model);
277-
rewrite_union(goto_model);
278191

279192
// add generic checks
280193
log.status() << "Generic Property Instrumentation" << messaget::eom;
@@ -286,16 +199,13 @@ bool jdiff_parse_optionst::process_goto_program(
286199
// recalculate numbers, etc.
287200
goto_model.goto_functions.update();
288201

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-
296202
// instrument cover goals
297203
if(cmdline.isset("cover"))
298204
{
205+
// remove skips such that trivial GOTOs are deleted and not considered for
206+
// coverage annotation:
207+
remove_skip(goto_model);
208+
299209
const auto cover_config =
300210
get_cover_config(options, goto_model.symbol_table, ui_message_handler);
301211
if(instrument_cover_goals(cover_config, goto_model, ui_message_handler))
@@ -311,7 +221,6 @@ bool jdiff_parse_optionst::process_goto_program(
311221

312222
// remove any skips introduced since coverage instrumentation
313223
remove_skip(goto_model);
314-
goto_model.goto_functions.update();
315224
}
316225

317226
return false;
@@ -334,8 +243,7 @@ void jdiff_parse_optionst::help()
334243
"\n"
335244
"Diff options:\n"
336245
HELP_SHOW_GOTO_FUNCTIONS
337-
HELP_SHOW_PROPERTIES
338-
" --syntactic do syntactic diff (default)\n"
246+
" --show-loops show the loops in the programs\n"
339247
" -u | --unified output unified diff\n"
340248
" --change-impact | \n"
341249
" --forward-impact |\n"

jbmc/src/jdiff/jdiff_parse_options.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class goto_modelt;
2828
#define JDIFF_OPTIONS \
2929
"(json-ui)" \
3030
OPT_SHOW_GOTO_FUNCTIONS \
31-
OPT_SHOW_PROPERTIES \
31+
"(show-loops)" \
3232
OPT_GOTO_CHECK_JAVA \
3333
OPT_COVER \
3434
"(verbosity):(version)" \

0 commit comments

Comments
 (0)