Skip to content

Commit 5f33908

Browse files
committed
unwindset: Also warn about loops in functions without body
f14cd09 demoted some failures to warnings. This commit does so for another case: if no body for the function is available, issue a warning rather than failing an exception. This situation will typically arise when using an unwindset specification originally meant for CBMC with goto-instrument, where library functions might not yet be present.
1 parent 198fd86 commit 5f33908

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/goto-instrument/unwindset.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,21 @@ void unwindsett::parse_unwindset_one_loop(
7171
std::string function_id = id.substr(0, last_dot_pos);
7272
std::string loop_nr_label = id.substr(last_dot_pos + 1);
7373

74-
if(loop_nr_label.empty() || !goto_model.can_produce_function(function_id))
74+
if(loop_nr_label.empty())
7575
{
7676
throw invalid_command_line_argument_exceptiont{
7777
"invalid loop identifier " + id, "unwindset"};
7878
}
7979

80+
if(!goto_model.can_produce_function(function_id))
81+
{
82+
messaget log{message_handler};
83+
log.warning() << "loop identifier " << id
84+
<< " for non-existent function provided with unwindset"
85+
<< messaget::eom;
86+
return;
87+
}
88+
8089
const goto_functiont &goto_function =
8190
goto_model.get_goto_function(function_id);
8291
if(isdigit(loop_nr_label[0]))

0 commit comments

Comments
 (0)