@@ -85,6 +85,28 @@ ::cbmc_parse_optionst::cbmc_parse_optionst(
8585{
8686}
8787
88+ void cbmc_parse_optionst::set_default_options (optionst &options)
89+ {
90+ // Default true
91+ options.set_option (" assertions" , true );
92+ options.set_option (" assumptions" , true );
93+ options.set_option (" built-in-assertions" , true );
94+ options.set_option (" pretty-names" , true );
95+ options.set_option (" propagation" , true );
96+ options.set_option (" sat-preprocessor" , true );
97+ options.set_option (" simplify" , true );
98+ options.set_option (" simplify-if" , true );
99+
100+ // Default false
101+ options.set_option (" partial-loops" , false );
102+ options.set_option (" slice-formula" , false );
103+ options.set_option (" stop-on-fail" , false );
104+ options.set_option (" unwinding-assertions" , false );
105+
106+ // Other
107+ options.set_option (" arrays-uf" , " auto" );
108+ }
109+
88110void cbmc_parse_optionst::eval_verbosity ()
89111{
90112 // this is our default verbosity
@@ -108,6 +130,8 @@ void cbmc_parse_optionst::get_command_line_options(optionst &options)
108130 exit (CPROVER_EXIT_USAGE_ERROR);
109131 }
110132
133+ cbmc_parse_optionst::set_default_options (options);
134+
111135 if (cmdline.isset (" paths" ))
112136 options.set_option (" paths" , true );
113137
@@ -143,15 +167,11 @@ void cbmc_parse_optionst::get_command_line_options(optionst &options)
143167
144168 if (cmdline.isset (" no-simplify" ))
145169 options.set_option (" simplify" , false );
146- else
147- options.set_option (" simplify" , true );
148170
149171 if (cmdline.isset (" stop-on-fail" ) ||
150172 cmdline.isset (" dimacs" ) ||
151173 cmdline.isset (" outfile" ))
152174 options.set_option (" stop-on-fail" , true );
153- else
154- options.set_option (" stop-on-fail" , false );
155175
156176 if (cmdline.isset (" trace" ) ||
157177 cmdline.isset (" stop-on-fail" ))
@@ -184,43 +204,36 @@ void cbmc_parse_optionst::get_command_line_options(optionst &options)
184204 // constant propagation
185205 if (cmdline.isset (" no-propagation" ))
186206 options.set_option (" propagation" , false );
187- else
188- options.set_option (" propagation" , true );
189207
190208 // all checks supported by goto_check
191209 PARSE_OPTIONS_GOTO_CHECK (cmdline, options);
192210
193211 // check assertions
194212 if (cmdline.isset (" no-assertions" ))
195213 options.set_option (" assertions" , false );
196- else
197- options.set_option (" assertions" , true );
198214
199215 // use assumptions
200216 if (cmdline.isset (" no-assumptions" ))
201217 options.set_option (" assumptions" , false );
202- else
203- options.set_option (" assumptions" , true );
204218
205219 // magic error label
206220 if (cmdline.isset (" error-label" ))
207221 options.set_option (" error-label" , cmdline.get_values (" error-label" ));
208222
209223 // generate unwinding assertions
210- if (cmdline.isset (" cover" ))
211- options.set_option (" unwinding-assertions" , false );
212- else
224+ if (cmdline.isset (" unwinding-assertions" ))
225+ options.set_option (" unwinding-assertions" , true );
226+
227+ if (cmdline.isset (" partial-loops" ))
228+ options.set_option (" partial-loops" , true );
229+
230+ if (options.is_set (" cover" ) && options.get_bool_option (" unwinding-assertions" ))
213231 {
214- options. set_option (
215- " unwinding-assertions " ,
216- cmdline. isset ( " unwinding-assertions " ) );
232+ error () << " --cover and --unwinding-assertions "
233+ << " must not be given together " << eom;
234+ exit (CPROVER_EXIT_USAGE_ERROR );
217235 }
218236
219- // generate unwinding assumptions otherwise
220- options.set_option (
221- " partial-loops" ,
222- cmdline.isset (" partial-loops" ));
223-
224237 if (options.get_bool_option (" partial-loops" ) &&
225238 options.get_bool_option (" unwinding-assertions" ))
226239 {
@@ -230,22 +243,17 @@ void cbmc_parse_optionst::get_command_line_options(optionst &options)
230243 }
231244
232245 // remove unused equations
233- options.set_option (
234- " slice-formula" ,
235- cmdline.isset (" slice-formula" ));
246+ if (cmdline.isset (" slice-formula" ))
247+ options.set_option (" slice-formula" , true );
236248
237249 // simplify if conditions and branches
238250 if (cmdline.isset (" no-simplify-if" ))
239251 options.set_option (" simplify-if" , false );
240- else
241- options.set_option (" simplify-if" , true );
242252
243253 if (cmdline.isset (" arrays-uf-always" ))
244254 options.set_option (" arrays-uf" , " always" );
245255 else if (cmdline.isset (" arrays-uf-never" ))
246256 options.set_option (" arrays-uf" , " never" );
247- else
248- options.set_option (" arrays-uf" , " auto" );
249257
250258 if (cmdline.isset (" dimacs" ))
251259 options.set_option (" dimacs" , true );
@@ -387,12 +395,9 @@ void cbmc_parse_optionst::get_command_line_options(optionst &options)
387395
388396 if (cmdline.isset (" no-sat-preprocessor" ))
389397 options.set_option (" sat-preprocessor" , false );
390- else
391- options.set_option (" sat-preprocessor" , true );
392398
393- options.set_option (
394- " pretty-names" ,
395- !cmdline.isset (" no-pretty-names" ));
399+ if (cmdline.isset (" no-pretty-names" ))
400+ options.set_option (" pretty-names" , false );
396401
397402 if (cmdline.isset (" outfile" ))
398403 options.set_option (" outfile" , cmdline.get_value (" outfile" ));
0 commit comments