Skip to content

Commit 5506b3d

Browse files
committed
Print info using DATA_INVARIANT_WITH_DIAGNOSTICS
1 parent c25e205 commit 5506b3d

File tree

1 file changed

+15
-26
lines changed

1 file changed

+15
-26
lines changed

src/goto-programs/goto_convert_functions.cpp

Lines changed: 15 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -163,36 +163,25 @@ void goto_convert_functionst::convert_function(
163163
symbol.is_compiled()) /* goto_inline may have removed the body */
164164
return;
165165

166-
const size_t ERROR_MSG_LEN = 512;
167-
char parameter_error_message[ERROR_MSG_LEN];
168166
// we have a body, make sure all parameter names are valid
169167
for(const auto &p : f.parameter_identifiers)
170168
{
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(
169+
DATA_INVARIANT_WITH_DIAGNOSTICS(
170+
!p.empty(),
171+
"parameter identifier should not be empty",
172+
parameter_error_message,
173+
"function:",
174+
identifier,
175+
"parameter:",
176+
p);
177+
178+
DATA_INVARIANT_WITH_DIAGNOSTICS(
194179
symbol_table.has_symbol(p),
195-
parameter_error_message);
180+
"parameter identifier must be a known symbol",
181+
"function:",
182+
identifier,
183+
"parameter:",
184+
p);
196185
}
197186

198187
lifetimet parent_lifetime = lifetime;

0 commit comments

Comments
 (0)