Commit 85059a38 by Marek Polacek Committed by Marek Polacek

* c-decl.c (implicit_decl_warning): Add a comment. Fix formatting.

From-SVN: r246069
parent 2f6f187a
2017-03-11 Marek Polacek <polacek@redhat.com>
* c-decl.c (implicit_decl_warning): Add a comment. Fix formatting.
2017-03-10 David Malcolm <dmalcolm@redhat.com> 2017-03-10 David Malcolm <dmalcolm@redhat.com>
PR translation/79848 PR translation/79848
......
...@@ -3117,45 +3117,52 @@ pushdecl_top_level (tree x) ...@@ -3117,45 +3117,52 @@ pushdecl_top_level (tree x)
return x; return x;
} }
/* Issue a warning about implicit function declaration. ID is the function
identifier, OLDDECL is a declaration of the function in a different scope,
or NULL_TREE. */
static void static void
implicit_decl_warning (location_t loc, tree id, tree olddecl) implicit_decl_warning (location_t loc, tree id, tree olddecl)
{ {
if (warn_implicit_function_declaration) if (!warn_implicit_function_declaration)
{ return;
bool warned;
const char *hint = NULL;
if (!olddecl)
hint = lookup_name_fuzzy (id, FUZZY_LOOKUP_FUNCTION_NAME);
if (flag_isoc99) bool warned;
if (hint) const char *hint = NULL;
{ if (!olddecl)
gcc_rich_location richloc (loc); hint = lookup_name_fuzzy (id, FUZZY_LOOKUP_FUNCTION_NAME);
richloc.add_fixit_replace (hint);
warned = pedwarn_at_rich_loc if (flag_isoc99)
(&richloc, OPT_Wimplicit_function_declaration, {
"implicit declaration of function %qE; did you mean %qs?", if (hint)
id, hint); {
} gcc_rich_location richloc (loc);
else richloc.add_fixit_replace (hint);
warned = pedwarn (loc, OPT_Wimplicit_function_declaration, warned = pedwarn_at_rich_loc
"implicit declaration of function %qE", id); (&richloc, OPT_Wimplicit_function_declaration,
"implicit declaration of function %qE; did you mean %qs?",
id, hint);
}
else else
if (hint) warned = pedwarn (loc, OPT_Wimplicit_function_declaration,
{ "implicit declaration of function %qE", id);
gcc_rich_location richloc (loc);
richloc.add_fixit_replace (hint);
warned = warning_at_rich_loc
(&richloc, OPT_Wimplicit_function_declaration,
G_("implicit declaration of function %qE; did you mean %qs?"),
id, hint);
}
else
warned = warning_at (loc, OPT_Wimplicit_function_declaration,
G_("implicit declaration of function %qE"), id);
if (olddecl && warned)
locate_old_decl (olddecl);
} }
else if (hint)
{
gcc_rich_location richloc (loc);
richloc.add_fixit_replace (hint);
warned = warning_at_rich_loc
(&richloc, OPT_Wimplicit_function_declaration,
G_("implicit declaration of function %qE; did you mean %qs?"),
id, hint);
}
else
warned = warning_at (loc, OPT_Wimplicit_function_declaration,
G_("implicit declaration of function %qE"), id);
if (olddecl && warned)
locate_old_decl (olddecl);
} }
/* This function represents mapping of a function code FCODE /* This function represents mapping of a function code FCODE
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment