Skip to content

Commit e783d13

Browse files
authored
Merge pull request #6524 from tautschnig/unwindset-warnings-again
unwindset: Also warn about loops in functions without body
2 parents 198fd86 + 5f33908 commit e783d13

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)