@@ -1198,60 +1198,31 @@ void goto_convertt::do_function_call_symbol(
1198
1198
{
1199
1199
do_printf (lhs, function, arguments, dest);
1200
1200
}
1201
- else if (identifier==" __assert_fail" )
1201
+ else if (identifier==" __assert_fail" ||
1202
+ identifier==" _assert" ||
1203
+ identifier==" __assert_c99" ||
1204
+ identifier==" _wassert" )
1202
1205
{
1203
1206
// __assert_fail is Linux
1204
1207
// These take four arguments:
1205
1208
// "expression", "file.c", line, __func__
1209
+ // klibc has __assert_fail with 3 arguments
1210
+ // "expression", "file.c", line
1206
1211
1207
- if (arguments.size ()!=4 )
1208
- {
1209
- err_location (function);
1210
- throw " `" +id2string (identifier)+" ' expected to have four arguments" ;
1211
- }
1212
-
1213
- const irep_idt description=
1214
- " assertion " +id2string (get_string_constant (arguments[0 ]));
1215
-
1216
- goto_programt::targett t=dest.add_instruction (ASSERT);
1217
- t->guard =false_exprt ();
1218
- t->source_location =function.source_location ();
1219
- t->source_location .set (" user-provided" , true );
1220
- t->source_location .set_property_class (ID_assertion);
1221
- t->source_location .set_comment (description);
1222
- // we ignore any LHS
1223
- }
1224
- else if (identifier==" _assert" )
1225
- {
1226
1212
// MingW has
1227
1213
// void _assert (const char*, const char*, int);
1228
1214
// with three arguments:
1229
1215
// "expression", "file.c", line
1230
1216
1231
- if (arguments.size ()!=3 )
1232
- {
1233
- err_location (function);
1234
- throw " `" +id2string (identifier)+" ' expected to have three arguments" ;
1235
- }
1236
-
1237
- const irep_idt description=
1238
- " assertion " +id2string (get_string_constant (arguments[0 ]));
1239
-
1240
- goto_programt::targett t=dest.add_instruction (ASSERT);
1241
- t->guard =false_exprt ();
1242
- t->source_location =function.source_location ();
1243
- t->source_location .set (" user-provided" , true );
1244
- t->source_location .set_property_class (ID_assertion);
1245
- t->source_location .set_comment (description);
1246
- // we ignore any LHS
1247
- }
1248
- else if (identifier==" __assert_c99" )
1249
- {
1250
1217
// This has been seen in Solaris 11.
1251
1218
// Signature:
1252
1219
// void __assert_c99(const char *desc, const char *file, int line, const char *func);
1253
1220
1254
- if (arguments.size ()!=4 )
1221
+ // _wassert is Windows. The arguments are
1222
+ // L"expression", L"file.c", line
1223
+
1224
+ if (arguments.size ()!=4 &&
1225
+ arguments.size ()!=3 )
1255
1226
{
1256
1227
err_location (function);
1257
1228
throw " `" +id2string (identifier)+" ' expected to have four arguments" ;
@@ -1317,28 +1288,6 @@ void goto_convertt::do_function_call_symbol(
1317
1288
1318
1289
const irep_idt description=
1319
1290
" assertion " +id2string (get_string_constant (arguments[3 ]));
1320
- goto_programt::targett t=dest.add_instruction (ASSERT);
1321
-
1322
- t->guard =false_exprt ();
1323
- t->source_location =function.source_location ();
1324
- t->source_location .set (" user-provided" , true );
1325
- t->source_location .set_property_class (ID_assertion);
1326
- t->source_location .set_comment (description);
1327
- // we ignore any LHS
1328
- }
1329
- else if (identifier==" _wassert" )
1330
- {
1331
- // This is Windows. The arguments are
1332
- // L"expression", L"file.c", line
1333
-
1334
- if (arguments.size ()!=3 )
1335
- {
1336
- err_location (function);
1337
- throw " `" +id2string (identifier)+" ' expected to have three arguments" ;
1338
- }
1339
-
1340
- const irep_idt description=
1341
- " assertion " +id2string (get_string_constant (arguments[0 ]));
1342
1291
1343
1292
goto_programt::targett t=dest.add_instruction (ASSERT);
1344
1293
t->guard =false_exprt ();
0 commit comments