set multiple error labels
git-svn-id: svn+ssh://svn.cprover.org/srv/svn/cbmc/trunk@5001 6afb6bc1-c8e4-404c-8f48-9ae832c5b171
This commit is contained in:
parent
d95d36ed76
commit
47f6881aad
|
@ -0,0 +1,10 @@
|
|||
int main()
|
||||
{
|
||||
int i;
|
||||
goto ERROR2;
|
||||
|
||||
return 0;
|
||||
|
||||
ERROR1:;
|
||||
ERROR2:;
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
CORE
|
||||
main.c
|
||||
--error-label ERROR1 --error-label ERROR2
|
||||
^EXIT=10$
|
||||
^SIGNAL=0$
|
||||
^VERIFICATION FAILED$
|
||||
--
|
||||
^warning: ignoring
|
|
@ -47,7 +47,7 @@ public:
|
|||
enable_assert_to_assume=_options.get_bool_option("assert-to-assume");
|
||||
enable_assertions=_options.get_bool_option("assertions");
|
||||
enable_assumptions=_options.get_bool_option("assumptions");
|
||||
error_label=_options.get_option("error-label");
|
||||
error_labels=_options.get_list_option("error-label");
|
||||
}
|
||||
|
||||
typedef goto_functionst::goto_functiont goto_functiont;
|
||||
|
@ -115,7 +115,9 @@ protected:
|
|||
bool enable_assert_to_assume;
|
||||
bool enable_assertions;
|
||||
bool enable_assumptions;
|
||||
irep_idt error_label;
|
||||
|
||||
typedef optionst::value_listt error_labelst;
|
||||
error_labelst error_labels;
|
||||
};
|
||||
|
||||
/*******************************************************************\
|
||||
|
@ -1454,8 +1456,12 @@ void goto_checkt::goto_check(goto_functiont &goto_function)
|
|||
check(i.guard);
|
||||
|
||||
// magic ERROR label?
|
||||
if(error_label!=irep_idt() &&
|
||||
std::find(i.labels.begin(), i.labels.end(), error_label)!=i.labels.end())
|
||||
for(optionst::value_listt::const_iterator
|
||||
l_it=error_labels.begin();
|
||||
l_it!=error_labels.end();
|
||||
l_it++)
|
||||
{
|
||||
if(std::find(i.labels.begin(), i.labels.end(), *l_it)!=i.labels.end())
|
||||
{
|
||||
goto_program_instruction_typet type=
|
||||
enable_assert_to_assume?ASSUME:ASSERT;
|
||||
|
@ -1465,9 +1471,10 @@ void goto_checkt::goto_check(goto_functiont &goto_function)
|
|||
t->guard=false_exprt();
|
||||
t->source_location=i.source_location;
|
||||
t->source_location.set_property_class("error label");
|
||||
t->source_location.set_comment("error label");
|
||||
t->source_location.set_comment("error label "+*l_it);
|
||||
t->source_location.set("user-provided", true);
|
||||
}
|
||||
}
|
||||
|
||||
if(i.is_other())
|
||||
{
|
||||
|
|
|
@ -240,7 +240,7 @@ void cbmc_parseoptionst::get_command_line_options(optionst &options)
|
|||
|
||||
// magic error label
|
||||
if(cmdline.isset("error-label"))
|
||||
options.set_option("error-label", cmdline.get_value("error-label"));
|
||||
options.set_option("error-label", cmdline.get_values("error-label"));
|
||||
|
||||
// generate unwinding assertions
|
||||
if(cmdline.isset("cover-assertions"))
|
||||
|
|
Loading…
Reference in New Issue