Hi Joseph, Would you mind having a look at this patch?
On Tue, Sep 16, 2025 at 08:56:49AM +0200, Alejandro Colomar wrote:
> > diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
> > index 2922d9e9839..77116169331 100644
> > --- a/gcc/doc/extend.texi
> > +++ b/gcc/doc/extend.texi
> > @@ -670,16 +670,21 @@ tester (int len; char data[len][len], int len)
> > @end smallexample
> >
> > @cindex parameter forward declaration
> > -The @samp{int len} before the semicolon is a @dfn{parameter forward
> > -declaration}, and it serves the purpose of making the name @code{len}
> > -known when the declaration of @code{data} is parsed.
> > +The @samp{int len} before the semicolon
> > +is a @dfn{parameter forward declaration},
> > +and it serves the purpose of making the name @code{len} known
> > +when the declaration of @code{data} is parsed.
> >
> > -You can write any number of such parameter forward declarations in the
> > -parameter list. They can be separated by commas or semicolons, but the
> > -last one must end with a semicolon, which is followed by the ``real''
> > -parameter declarations. Each forward declaration must match a ``real''
> > -declaration in parameter name and data type. ISO C99 does not support
> > -parameter forward declarations.
> > +Lists of parameter forward declarations are terminated by semicolons,
> > +and parameters are separated within such lists by commas,
>
> Maybe here I should say 's/parameters/parameter forward declarations/'.
And would you mind amending this, if possible? Or do you prefer me to
send a patch with that changed?
Have a lovely day!
Alex
>
> > +just like in the regular parameter declaration list.
> > +
> > +You can write any number of such parameter forward declaration lists,
> > +but using more than one is unnecessary.
> > +The last semicolon is followed by the ``real'' parameter declarations.
> > +Each forward declaration must match
> > +a ``real'' declaration in parameter name and data type.
> > +ISO C99 does not support parameter forward declarations.
> >
> > @node Zero Length
> > @subsection Arrays of Length Zero
> > diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
> > index d0c13d4a24e..25e64dc5024 100644
> > --- a/gcc/doc/invoke.texi
> > +++ b/gcc/doc/invoke.texi
> > @@ -540,7 +540,9 @@ Objective-C and Objective-C++ Dialects}.
> > @gccoptlist{-Wbad-function-cast -Wdeprecated-non-prototype -Wfree-labels
> > -Wmissing-declarations -Wmissing-parameter-name -Wmissing-parameter-type
> > -Wdeclaration-missing-parameter-type -Wmissing-prototypes
> > --Wmissing-variable-declarations -Wnested-externs -Wold-style-declaration
> > +-Wmissing-variable-declarations
> > +-Wmultiple-parameter-fwd-decl-lists
> > +-Wnested-externs -Wold-style-declaration
> > -Wold-style-definition -Wstrict-prototypes -Wtraditional
> > -Wtraditional-conversion -Wdeclaration-after-statement -Wpointer-sign}
> >
> > @@ -6682,6 +6684,7 @@ name is still supported, but the newer name is more
> > descriptive.)
> > -Wmissing-parameter-name @r{(C/ObjC only)}
> > -Wmissing-parameter-type @r{(C/ObjC only)}
> > -Wold-style-declaration @r{(C/ObjC only)}
> > +-Wmultiple-parameter-fwd-decl-lists @r{(C/ObjC only)}
> > -Woverride-init @r{(C/ObjC only)}
> > -Wredundant-move @r{(C++ and Objective-C++ only)}
> > -Wshift-negative-value @r{(in C++11 to C++17 and in C99 and newer)}
> > @@ -10535,6 +10538,13 @@ is not considered an old-style definition in C23
> > mode, because it is
> > equivalent to @samp{(void)} in that case, but is considered an
> > old-style definition for older standards.
> >
> > +@opindex Wmultiple-parameter-fwd-decl-lists
> > +@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.
> > +This warning is also enabled by @option{-Wextra}.
> > +
> > @opindex Wdeprecated-non-prototype
> > @opindex Wno-deprecated-non-prototype
> > @item -Wdeprecated-non-prototype @r{(C and Objective-C only)}
> > diff --git a/gcc/testsuite/gcc.dg/Wmultiple-parameter-fwd-decl-lists.c
> > b/gcc/testsuite/gcc.dg/Wmultiple-parameter-fwd-decl-lists.c
> > new file mode 100644
> > index 00000000000..c3edbf6a494
> > --- /dev/null
> > +++ b/gcc/testsuite/gcc.dg/Wmultiple-parameter-fwd-decl-lists.c
> > @@ -0,0 +1,6 @@
> > +/* { dg-do compile } */
> > +/* { dg-options "-Wmultiple-parameter-fwd-decl-lists" } */
> > +
> > +void f(int n, int m; int n, int m);
> > +void g(int n; int m; int n, int m); /* { dg-warning "more than one list of
> > forward declarations" } */
> > +void h(int n; int n; int n); /* { dg-warning "more than one list of
> > forward declarations" } */
> > --
> > 2.50.1
> >
>
> --
> <https://www.alejandro-colomar.es>
> Use port 80 (that is, <...:80/>).
--
<https://www.alejandro-colomar.es>
Use port 80 (that is, <...:80/>).
signature.asc
Description: PGP signature
