Skip to content

Commit 338b155

Browse files
author
martin
committed
Remove redundant try/catch blocks from cbmc
Again, these should only result in a net improvement in how exceptions are handled; return codes shouldn't change.
1 parent 52ceb9b commit 338b155

File tree

1 file changed

+1
-47
lines changed

1 file changed

+1
-47
lines changed

src/cbmc/cbmc_parse_options.cpp

Lines changed: 1 addition & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -433,22 +433,7 @@ int cbmc_parse_optionst::doit()
433433
//
434434

435435
optionst options;
436-
try
437-
{
438-
get_command_line_options(options);
439-
}
440-
441-
catch(const char *error_msg)
442-
{
443-
error() << error_msg << eom;
444-
return CPROVER_EXIT_EXCEPTION;
445-
}
446-
447-
catch(const std::string &error_msg)
448-
{
449-
error() << error_msg << eom;
450-
return CPROVER_EXIT_EXCEPTION;
451-
}
436+
get_command_line_options(options);
452437

453438
eval_verbosity(
454439
cmdline.get_value("verbosity"), messaget::M_STATISTICS, ui_message_handler);
@@ -618,7 +603,6 @@ int cbmc_parse_optionst::get_goto_program(
618603
return CPROVER_EXIT_INCORRECT_TASK;
619604
}
620605

621-
try
622606
{
623607
goto_model =
624608
initialize_goto_model(cmdline.args, ui_message_handler, options);
@@ -655,36 +639,6 @@ int cbmc_parse_optionst::get_goto_program(
655639
log.status() << config.object_bits_info() << log.eom;
656640
}
657641

658-
catch(incorrect_goto_program_exceptiont &e)
659-
{
660-
log.error() << e.what() << log.eom;
661-
return CPROVER_EXIT_EXCEPTION;
662-
}
663-
664-
catch(const char *e)
665-
{
666-
log.error() << e << log.eom;
667-
return CPROVER_EXIT_EXCEPTION;
668-
}
669-
670-
catch(const std::string &e)
671-
{
672-
log.error() << e << log.eom;
673-
return CPROVER_EXIT_EXCEPTION;
674-
}
675-
676-
catch(int e)
677-
{
678-
log.error() << "Numeric exception : " << e << log.eom;
679-
return CPROVER_EXIT_EXCEPTION;
680-
}
681-
682-
catch(const std::bad_alloc &)
683-
{
684-
log.error() << "Out of memory" << log.eom;
685-
return CPROVER_EXIT_INTERNAL_OUT_OF_MEMORY;
686-
}
687-
688642
return -1; // no error, continue
689643
}
690644

0 commit comments

Comments
 (0)