Skip to content

Commit 2002b48

Browse files
NlightNFotisEnrico Steffinlongo
authored and
Enrico Steffinlongo
committed
Change to checking against optionst and check for empty
1 parent 2e3e255 commit 2002b48

File tree

1 file changed

+24
-7
lines changed

1 file changed

+24
-7
lines changed

src/cbmc/cbmc_parse_options.cpp

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,19 @@ void cbmc_parse_optionst::get_command_line_options(optionst &options)
245245
options.set_option("trace", true);
246246
}
247247

248+
if(cmdline.isset("export-core-goto"))
249+
{
250+
options.set_option(
251+
"export-core-goto", cmdline.get_value("export-core-goto"));
252+
if(options.get_option("export-core-goto").empty())
253+
{
254+
log.error()
255+
<< "ERROR: Please provide a filename to write the goto-binary to."
256+
<< messaget::eom;
257+
exit(CPROVER_EXIT_INTERNAL_ERROR);
258+
}
259+
}
260+
248261
if(cmdline.isset("localize-faults"))
249262
options.set_option("localize-faults", true);
250263

@@ -549,21 +562,25 @@ int cbmc_parse_optionst::doit()
549562
// At this point, our goto-model should be in core-goto form (all of the
550563
// transformations have been run and the program is ready to be given to the
551564
// solver).
552-
if(cmdline.isset("export-core-goto"))
565+
if(options.is_set("export-core-goto"))
553566
{
554-
auto core_goto_filename = cmdline.get_value("export-core-goto");
555-
auto success =
567+
auto core_goto_filename = options.get_option("export-core-goto");
568+
569+
bool success =
556570
!write_goto_binary(core_goto_filename, goto_model, ui_message_handler);
557571

558572
if(!success)
559573
{
560-
log.error() << "Unable to export goto-program in file "
574+
log.error() << "ERROR: Unable to export goto-program in file "
561575
<< core_goto_filename << messaget::eom;
562576
return CPROVER_EXIT_INTERNAL_ERROR;
563577
}
564-
log.status() << "Exported goto-program in core-goto form at "
565-
<< core_goto_filename << messaget::eom;
566-
return CPROVER_EXIT_SUCCESS;
578+
else
579+
{
580+
log.status() << "Exported goto-program in core-goto form at "
581+
<< core_goto_filename << messaget::eom;
582+
return CPROVER_EXIT_SUCCESS;
583+
}
567584
}
568585

569586
if(

0 commit comments

Comments
 (0)