Skip to content

Commit 63c4740

Browse files
Check dependencies between commandline options for incremental
1 parent 24deb62 commit 63c4740

File tree

2 files changed

+54
-0
lines changed

2 files changed

+54
-0
lines changed

src/cbmc/cbmc_parse_options.cpp

+51
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,50 @@ void cbmc_parse_optionst::get_command_line_options(optionst &options)
461461

462462
/*******************************************************************\
463463
464+
Function: cbmc_parse_optionst::options_exclusive
465+
466+
Inputs:
467+
468+
Outputs:
469+
470+
Purpose: check conflicts between options: not allowed together
471+
472+
\*******************************************************************/
473+
474+
bool cbmc_parse_optionst::options_exclusive(const char *opt1, const char *opt2)
475+
{
476+
if(cmdline.isset(opt1) && cmdline.isset(opt2))
477+
{
478+
error() << "--" << opt1 << " cannot be used with --" << opt2 << eom;
479+
return true;
480+
}
481+
return false;
482+
}
483+
484+
/*******************************************************************\
485+
486+
Function: cbmc_parse_optionst::options_inclusive
487+
488+
Inputs:
489+
490+
Outputs:
491+
492+
Purpose: check conflicts between options: opt1 only if opt2
493+
494+
\*******************************************************************/
495+
496+
bool cbmc_parse_optionst::options_inclusive(const char *opt1, const char *opt2)
497+
{
498+
if(cmdline.isset(opt1) && !cmdline.isset(opt2))
499+
{
500+
error() << "--" << opt1 << " can only be used with --" << opt2 << eom;
501+
return true;
502+
}
503+
return false;
504+
}
505+
506+
/*******************************************************************\
507+
464508
Function: cbmc_parse_optionst::doit
465509
466510
Inputs:
@@ -507,6 +551,13 @@ int cbmc_parse_optionst::doit()
507551
return 1; // should contemplate EX_USAGE from sysexits.h
508552
}
509553

554+
if(options_exclusive("incremental", "unwind") ||
555+
options_exclusive("incremental", "incremental-check") ||
556+
options_inclusive("earliest-loop-exit", "incremental"))
557+
{
558+
return 1;
559+
}
560+
510561
register_languages();
511562

512563
if(cmdline.isset("test-preprocessor"))

src/cbmc/cbmc_parse_options.h

+3
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,9 @@ class cbmc_parse_optionst:
9797

9898
void eval_verbosity();
9999

100+
bool options_exclusive(const char *opt1, const char *opt2);
101+
bool options_inclusive(const char *opt1, const char *opt2);
102+
100103
// get any additional stuff before finalizing
101104
virtual int get_modules(bmct &bmc)
102105
{

0 commit comments

Comments
 (0)