Skip to content

Commit 6063df6

Browse files
committed
Print info using DATA_INVARIANT_WITH_DIAGNOSTICS
1 parent c25e205 commit 6063df6

File tree

1 file changed

+15
-24
lines changed

1 file changed

+15
-24
lines changed

src/goto-programs/goto_convert_functions.cpp

Lines changed: 15 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -168,31 +168,22 @@ void goto_convert_functionst::convert_function(
168168
// we have a body, make sure all parameter names are valid
169169
for(const auto &p : f.parameter_identifiers)
170170
{
171-
if (p.empty())
172-
{
173-
snprintf(parameter_error_message,
174-
ERROR_MSG_LEN - 1,
175-
"parameter identifier should not be empty\n"
176-
"function: %s\n"
177-
"parameter: %s",
178-
identifier.c_str(),
179-
p.c_str());
180-
}
181-
DATA_INVARIANT(!p.empty(), parameter_error_message);
182-
183-
if (!symbol_table.has_symbol(p))
184-
{
185-
snprintf(parameter_error_message,
186-
ERROR_MSG_LEN - 1,
187-
"parameter identifier must be a known symbol\n"
188-
"function: %s\n"
189-
"parameter: %s",
190-
identifier.c_str(),
191-
p.c_str());
192-
}
193-
DATA_INVARIANT(
171+
DATA_INVARIANT_WITH_DIAGNOSTICS(
172+
!p.empty(),
173+
"parameter identifier should not be empty",
174+
parameter_error_message,
175+
"function:",
176+
identifier,
177+
"parameter:",
178+
p);
179+
180+
DATA_INVARIANT_WITH_DIAGNOSTICS(
194181
symbol_table.has_symbol(p),
195-
parameter_error_message);
182+
"parameter identifier must be a known symbol",
183+
"function:",
184+
identifier,
185+
"parameter:",
186+
p);
196187
}
197188

198189
lifetimet parent_lifetime = lifetime;

0 commit comments

Comments
 (0)