diff options
Diffstat (limited to 'gcc/c')
-rw-r--r-- | gcc/c/ChangeLog | 19 | ||||
-rw-r--r-- | gcc/c/c-decl.cc | 20 |
2 files changed, 29 insertions, 10 deletions
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index 4e78008..ef985ba 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,22 @@ +2025-09-26 Alejandro Colomar <alx@kernel.org> + + * c-decl.cc (c_scope): Rename {warned > had}_forward_parm_decls. + (mark_forward_parm_decls): Add + -Wmultiple-parameter-fwd-decl-lists. + +2025-09-26 Joseph Myers <josmyers@redhat.com> + + PR c/88642 + * c-typeck.cc (constructor_braced_scalar): New variable. + (struct constructor_stack): Add braced_scalar field. + (really_start_incremental_init): Handle constructor_braced_scalar + and braced_scalar field. + (push_init_level): Handle constructor_braced_scalar and + braced_scalar field. Give permerror rather than warning for + nested braces around scalar initializer. + (pop_init_level): Handle constructor_braced_scalar and + braced_scalar field. + 2025-09-24 Joseph Myers <josmyers@redhat.com> * c-typeck.cc (really_atomic_lvalue): For a COMPOUND_LITERAL_EXPR, diff --git a/gcc/c/c-decl.cc b/gcc/c/c-decl.cc index b122e82..7e4c7c2 100644 --- a/gcc/c/c-decl.cc +++ b/gcc/c/c-decl.cc @@ -504,10 +504,8 @@ struct GTY((chain_next ("%h.outer"))) c_scope { if these appears in a function definition. */ BOOL_BITFIELD had_vla_unspec : 1; - /* True if we already complained about forward parameter decls - in this scope. This prevents double warnings on - foo (int a; int b; ...) */ - BOOL_BITFIELD warned_forward_parm_decls : 1; + /* True if we parsed a list of forward parameter decls in this scope. */ + BOOL_BITFIELD had_forward_parm_decls : 1; /* True if this is the outermost block scope of a function body. This scope contains the parameters, the local variables declared @@ -6269,12 +6267,14 @@ mark_forward_parm_decls (void) { struct c_binding *b; - if (pedantic && !current_scope->warned_forward_parm_decls) - { - pedwarn (input_location, OPT_Wpedantic, - "ISO C forbids forward parameter declarations"); - current_scope->warned_forward_parm_decls = true; - } + if (current_scope->had_forward_parm_decls) + warning_at (input_location, OPT_Wmultiple_parameter_fwd_decl_lists, + "more than one list of forward declarations of parameters"); + if (pedantic && !current_scope->had_forward_parm_decls) + pedwarn (input_location, OPT_Wpedantic, + "ISO C forbids forward parameter declarations"); + + current_scope->had_forward_parm_decls = true; for (b = current_scope->bindings; b; b = b->prev) if (TREE_CODE (b->decl) == PARM_DECL) |