@@ -381,21 +381,14 @@ remove_function_pointerst::get_function_pointer_targets(
381
381
382
382
try_remove_const_fp (goto_program, functions, function.pointer ());
383
383
384
- if (does_remove_const_first)
385
- {
386
- }
387
- else
388
- {
389
- if (functions.size () == 1 )
390
- return functions;
391
- }
384
+ if (!does_remove_const_first && functions.size () == 1 )
385
+ return functions;
392
386
393
387
if (!found_functions)
394
388
{
395
389
if (!only_resolve_const_fps)
396
- {
397
390
return functions;
398
- }
391
+
399
392
// get all type-compatible functions
400
393
// whose address is ever taken
401
394
for (const auto &type_pair : type_map)
@@ -432,32 +425,23 @@ void remove_function_pointerst::remove_function_pointer(
432
425
const auto functions =
433
426
get_function_pointer_targets (goto_program, const_target);
434
427
435
- if (does_remove_const_first)
428
+ if (! does_remove_const_first && functions. size () == 1 )
436
429
{
437
- }
438
- else
439
- {
440
- if (functions.size () == 1 )
441
- {
442
- auto call = target->get_function_call ();
443
- call.function () = *functions.cbegin ();
444
- target->set_function_call (call);
445
- return ;
446
- }
430
+ auto call = target->get_function_call ();
431
+ call.function () = *functions.cbegin ();
432
+ target->set_function_call (call);
433
+ return ;
447
434
}
448
435
449
- if (!found_functions)
436
+ if (!found_functions && only_resolve_const_fps )
450
437
{
451
- if (only_resolve_const_fps)
452
- {
453
- // If this mode is enabled, we only remove function pointers
454
- // that we can resolve either to an exact function, or an exact subset
455
- // (e.g. a variable index in a constant array).
456
- // Since we haven't found functions, we would now resort to
457
- // replacing the function pointer with any function with a valid signature
458
- // Since we don't want to do that, we abort.
459
- return ;
460
- }
438
+ // If this mode is enabled, we only remove function pointers
439
+ // that we can resolve either to an exact function, or an exact subset
440
+ // (e.g. a variable index in a constant array).
441
+ // Since we haven't found functions, we would now resort to
442
+ // replacing the function pointer with any function with a valid signature
443
+ // Since we don't want to do that, we abort.
444
+ return ;
461
445
}
462
446
463
447
remove_function_pointer (goto_program, function_id, target, functions);
0 commit comments