@@ -85,6 +85,28 @@ ::cbmc_parse_optionst::cbmc_parse_optionst(
85
85
{
86
86
}
87
87
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
+
88
110
void cbmc_parse_optionst::eval_verbosity ()
89
111
{
90
112
// this is our default verbosity
@@ -108,6 +130,8 @@ void cbmc_parse_optionst::get_command_line_options(optionst &options)
108
130
exit (CPROVER_EXIT_USAGE_ERROR);
109
131
}
110
132
133
+ cbmc_parse_optionst::set_default_options (options);
134
+
111
135
if (cmdline.isset (" paths" ))
112
136
options.set_option (" paths" , true );
113
137
@@ -143,15 +167,11 @@ void cbmc_parse_optionst::get_command_line_options(optionst &options)
143
167
144
168
if (cmdline.isset (" no-simplify" ))
145
169
options.set_option (" simplify" , false );
146
- else
147
- options.set_option (" simplify" , true );
148
170
149
171
if (cmdline.isset (" stop-on-fail" ) ||
150
172
cmdline.isset (" dimacs" ) ||
151
173
cmdline.isset (" outfile" ))
152
174
options.set_option (" stop-on-fail" , true );
153
- else
154
- options.set_option (" stop-on-fail" , false );
155
175
156
176
if (cmdline.isset (" trace" ) ||
157
177
cmdline.isset (" stop-on-fail" ))
@@ -184,43 +204,36 @@ void cbmc_parse_optionst::get_command_line_options(optionst &options)
184
204
// constant propagation
185
205
if (cmdline.isset (" no-propagation" ))
186
206
options.set_option (" propagation" , false );
187
- else
188
- options.set_option (" propagation" , true );
189
207
190
208
// all checks supported by goto_check
191
209
PARSE_OPTIONS_GOTO_CHECK (cmdline, options);
192
210
193
211
// check assertions
194
212
if (cmdline.isset (" no-assertions" ))
195
213
options.set_option (" assertions" , false );
196
- else
197
- options.set_option (" assertions" , true );
198
214
199
215
// use assumptions
200
216
if (cmdline.isset (" no-assumptions" ))
201
217
options.set_option (" assumptions" , false );
202
- else
203
- options.set_option (" assumptions" , true );
204
218
205
219
// magic error label
206
220
if (cmdline.isset (" error-label" ))
207
221
options.set_option (" error-label" , cmdline.get_values (" error-label" ));
208
222
209
223
// 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" ))
213
231
{
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 );
217
235
}
218
236
219
- // generate unwinding assumptions otherwise
220
- options.set_option (
221
- " partial-loops" ,
222
- cmdline.isset (" partial-loops" ));
223
-
224
237
if (options.get_bool_option (" partial-loops" ) &&
225
238
options.get_bool_option (" unwinding-assertions" ))
226
239
{
@@ -230,22 +243,17 @@ void cbmc_parse_optionst::get_command_line_options(optionst &options)
230
243
}
231
244
232
245
// 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 );
236
248
237
249
// simplify if conditions and branches
238
250
if (cmdline.isset (" no-simplify-if" ))
239
251
options.set_option (" simplify-if" , false );
240
- else
241
- options.set_option (" simplify-if" , true );
242
252
243
253
if (cmdline.isset (" arrays-uf-always" ))
244
254
options.set_option (" arrays-uf" , " always" );
245
255
else if (cmdline.isset (" arrays-uf-never" ))
246
256
options.set_option (" arrays-uf" , " never" );
247
- else
248
- options.set_option (" arrays-uf" , " auto" );
249
257
250
258
if (cmdline.isset (" dimacs" ))
251
259
options.set_option (" dimacs" , true );
@@ -387,12 +395,9 @@ void cbmc_parse_optionst::get_command_line_options(optionst &options)
387
395
388
396
if (cmdline.isset (" no-sat-preprocessor" ))
389
397
options.set_option (" sat-preprocessor" , false );
390
- else
391
- options.set_option (" sat-preprocessor" , true );
392
398
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 );
396
401
397
402
if (cmdline.isset (" outfile" ))
398
403
options.set_option (" outfile" , cmdline.get_value (" outfile" ));
0 commit comments