diff options
author | Giuliano Belinassi <giuliano.belinassi@usp.br> | 2020-08-22 17:43:43 -0300 |
---|---|---|
committer | Giuliano Belinassi <giuliano.belinassi@usp.br> | 2020-08-22 17:43:43 -0300 |
commit | a926878ddbd5a98b272c22171ce58663fc04c3e0 (patch) | |
tree | 86af256e5d9a9c06263c00adc90e5fe348008c43 /gcc/c/c-decl.c | |
parent | 542730f087133690b47e036dfd43eb0db8a650ce (diff) | |
parent | 07cbaed8ba7d1b6e4ab3a9f44175502a4e1ecdb1 (diff) | |
download | gcc-devel/autopar_devel.zip gcc-devel/autopar_devel.tar.gz gcc-devel/autopar_devel.tar.bz2 |
Merge branch 'autopar_rebase2' into autopar_develdevel/autopar_devel
Quickly commit changes in the rebase branch.
Diffstat (limited to 'gcc/c/c-decl.c')
-rw-r--r-- | gcc/c/c-decl.c | 37 |
1 files changed, 34 insertions, 3 deletions
diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c index b3e05be..5d6b504 100644 --- a/gcc/c/c-decl.c +++ b/gcc/c/c-decl.c @@ -3368,8 +3368,30 @@ implicit_decl_warning (location_t loc, tree id, tree olddecl) warned = warning_at (loc, OPT_Wimplicit_function_declaration, G_("implicit declaration of function %qE"), id); - if (olddecl && warned) - locate_old_decl (olddecl); + if (warned) + { + /* Whether the olddecl is an undeclared builtin function. + locate_old_decl will not generate a diagnostic for those, + so in that case we want to look elsewhere. */ + bool undeclared_builtin = (olddecl + && TREE_CODE (olddecl) == FUNCTION_DECL + && fndecl_built_in_p (olddecl) + && !C_DECL_DECLARED_BUILTIN (olddecl)); + if (undeclared_builtin) + { + const char *header = header_for_builtin_fn (olddecl); + if (header) + { + rich_location richloc (line_table, loc); + maybe_add_include_fixit (&richloc, header, true); + inform (&richloc, + "include %qs or provide a declaration of %qE", + header, id); + } + } + else if (olddecl) + locate_old_decl (olddecl); + } if (!warned) hint.suppress (); @@ -3631,7 +3653,9 @@ implicitly_declare (location_t loc, tree functionid) (TREE_TYPE (decl))); if (!comptypes (newtype, TREE_TYPE (decl))) { - bool warned = warning_at (loc, 0, "incompatible implicit " + bool warned = warning_at (loc, + OPT_Wbuiltin_declaration_mismatch, + "incompatible implicit " "declaration of built-in " "function %qD", decl); /* See if we can hint which header to include. */ @@ -5576,6 +5600,13 @@ finish_decl (tree decl, location_t init_loc, tree init, NULL_TREE, DECL_ATTRIBUTES (decl)); } + /* This is the last point we can lower alignment so give the target the + chance to do so. */ + if (VAR_P (decl) + && !is_global_var (decl) + && !DECL_HARD_REGISTER (decl)) + targetm.lower_local_decl_alignment (decl); + invoke_plugin_callbacks (PLUGIN_FINISH_DECL, decl); } |