Skip to content

Commit 42670a7

Browse files
tautschnigDaniel Kroening
authored and
Daniel Kroening
committed
Use type information to detect implicit function declaration
Do not rely on source_locationt::get_function to provide this information.
1 parent e61f443 commit 42670a7

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/goto-programs/builtin_functions.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -728,8 +728,9 @@ void goto_convertt::do_function_call_symbol(
728728
a->source_location=function.source_location();
729729
a->source_location.set("user-provided", true);
730730
}
731-
else if(identifier=="assert" &&
732-
!ns.lookup(identifier).location.get_function().empty())
731+
else if(
732+
identifier == "assert" && symbol->type.get_bool(ID_C_incomplete) &&
733+
to_code_type(symbol->type).return_type() == signed_int_type())
733734
{
734735
if(arguments.size()!=1)
735736
{

src/linking/linking.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -461,8 +461,7 @@ void linkingt::duplicate_code_symbol(
461461
// return type are an error as we would end up with assignments with
462462
// mismatching types; as we currently do not patch these by inserting type
463463
// casts we need to fail hard
464-
if(!old_symbol.location.get_function().empty() &&
465-
old_symbol.value.is_nil())
464+
if(old_symbol.type.get_bool(ID_C_incomplete) && old_symbol.value.is_nil())
466465
{
467466
if(base_type_eq(old_t.return_type(), new_t.return_type(), ns))
468467
link_warning(
@@ -479,8 +478,8 @@ void linkingt::duplicate_code_symbol(
479478
old_symbol.location=new_symbol.location;
480479
old_symbol.is_weak=new_symbol.is_weak;
481480
}
482-
else if(!new_symbol.location.get_function().empty() &&
483-
new_symbol.value.is_nil())
481+
else if(
482+
new_symbol.type.get_bool(ID_C_incomplete) && new_symbol.value.is_nil())
484483
{
485484
if(base_type_eq(old_t.return_type(), new_t.return_type(), ns))
486485
link_warning(

0 commit comments

Comments
 (0)