Hi!

I've reworded the patch to remove any references to obsoletion, but kept
the diagnostic in -Wextra, as I don't expect this to break any old code.

I didn't do any regression testing this time, as I didn't change
anything meaningfully.  I just made sure it still builds.

See the range-diff below.


Have a lovely day!
Alex


Alejandro Colomar (1):
  c, objc: Add -Wmultiple-parameter-fwd-decl-lists

 gcc/c-family/c.opt                               |  4 ++++
 gcc/c/c-decl.cc                                  | 16 +++++++++-------
 gcc/doc/extend.texi                              |  2 +-
 gcc/doc/invoke.texi                              | 12 +++++++++++-
 .../gcc.dg/Wmultiple-parameter-fwd-decl-lists.c  |  6 ++++++
 5 files changed, 31 insertions(+), 9 deletions(-)
 create mode 100644 gcc/testsuite/gcc.dg/Wmultiple-parameter-fwd-decl-lists.c

Range-diff against v3:
1:  83fbe0d41f3 ! 1:  3370790e940 c, objc: Deprecate more than one list of 
forward declarations of parameters
    @@ Metadata
     Author: Alejandro Colomar <[email protected]>
     
      ## Commit message ##
    -    c, objc: Deprecate more than one list of forward declarations of 
parameters
    +    c, objc: Add -Wmultiple-parameter-fwd-decl-lists
     
         Warn about this:
     
                 void f(int x; int x; int x);
     
    -    This would allow eventually adding another semicolon in function
    -    prototypes to separate a different feature.
    +    Add a new diagnostic, -Wmultiple-parameter-fwd-decl-lists, which
    +    diagnoses uses of this obsolescent syntax.
     
    -    So, make multiple lists of forward declarations of parameters
    -    obsolescent, and produce a new diagnostic,
    -    -Wmultiple-parameter-fwd-decl-lists, which diagnoses uses of this
    -    obsolescent syntax.
    +    Add this diagnostic in -Wextra.
     
    -    Forward declarations of parameters are a rarely used feature, AFAIK,
    -    (and having more than one would be even rarer) so this shouldn't be
    -    problematic in -Wextra.  Eventually, we may want to move this into
    -    a default diagnostic, and later an error.
    +    Forward declarations of parameters are very rarely used.  And functions
    +    that need two forward declaractions of parameters are also quite rare.
    +    This combination results in this code almost not existing in any code
    +    base, which makes adding this to -Wextra okay.  FWIW, I've tried 
finding
    +    such code using a code search engine, and didn't find any cases (but 
the
    +    regex for that isn't easy to writei, so I wouldn't trust it).
     
         gcc/c-family/ChangeLog:
     
    @@ gcc/c/c-decl.cc: mark_forward_parm_decls (void)
     -    }
     +  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 are 
an obsolescent feature");
    ++          "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");
    @@ gcc/doc/invoke.texi: is not considered an old-style definition in C23 
mode, beca
     +@opindex Wno-multiple-parameter-fwd-decl-lists
     +@item -Wmultiple-parameter-fwd-decl-lists @r{(C and Objective-C only)}
     +Warn if more than one list of forward declarations of parameters
    -+appears in a function prototype,
    -+which is an obsolescent feature.
    ++appears in a function prototype.
     +This warning is also enabled by @option{-Wextra}.
     +
      @opindex Wdeprecated-non-prototype
-- 
2.50.1

Reply via email to