summaryrefslogtreecommitdiff
path: root/gcc/c/c-decl.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/c/c-decl.c')
-rw-r--r--gcc/c/c-decl.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c
index 317d5cdd099..a54e1218434 100644
--- a/gcc/c/c-decl.c
+++ b/gcc/c/c-decl.c
@@ -3386,8 +3386,14 @@ implicitly_declare (location_t loc, tree functionid)
const char *header
= header_for_builtin_fn (DECL_FUNCTION_CODE (decl));
if (header != NULL && warned)
- inform (loc, "include %qs or provide a declaration of %qD",
- header, decl);
+ {
+ rich_location richloc (line_table, loc);
+ maybe_add_include_fixit (&richloc, header);
+ inform_at_rich_loc
+ (&richloc,
+ "include %qs or provide a declaration of %qD",
+ header, decl);
+ }
newtype = TREE_TYPE (decl);
}
}
@@ -6046,6 +6052,7 @@ grokdeclarator (const struct c_declarator *declarator,
this_size_varies = size_varies = true;
warn_variable_length_array (name, size);
if (sanitize_flags_p (SANITIZE_VLA)
+ && current_function_decl != NULL_TREE
&& decl_context == NORMAL)
{
/* Evaluate the array size only once. */
@@ -7553,10 +7560,9 @@ grokfield (location_t loc,
that took root before someone noticed the bug... */
tree type = declspecs->type;
- bool type_ok = RECORD_OR_UNION_TYPE_P (type);
bool ok = false;
- if (type_ok
+ if (RECORD_OR_UNION_TYPE_P (type)
&& (flag_ms_extensions
|| flag_plan9_extensions
|| !declspecs->typedef_p))