bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: functions with empty parameter lists


From: Bruno Haible
Subject: Re: functions with empty parameter lists
Date: Tue, 07 Feb 2023 13:06:10 +0100

Thanks Paul, for reviewing what I wrote.

Paul Eggert wrote:
> >    * We should stop compiling with -Wstrict-prototypes and instead (not 
> > always,
> >      but frequently enough) compile with the '-std=gnu23' option. Clang
> >      currently implements it better. GCC 13 may be on par with clang again 
> > on
> >      this topic [1].
> 
> We could have 'configure' check -Wstrict-prototypes specially. If the 
> compiler complains about the abovementioned style, 'configure' would 
> omit -Wstrict-prototypes; otherwise it could keep it. The idea is that 
> eventually GCC will be smart enough so that 'gcc -Wstrict-prototypes' 
> will do the right thing even when not in C23 mode.

Hmm, that would mean that GCC's implementation of -Wstrict-prototypes,
for older -std=... options, would change from GCC 12 to GCC 13. I doubt
they will want to do this. Therefore I filed another GCC bug report:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108694

(since https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108690 has already
been closed).

> >    * We need to continue to use (void) in function declarations/types, as 
> > long
> >      as we support compilers for ISO C standards before C 23. This will
> >      probably take 10 or 15 years.
> 
> Alternatively we could define a macro NOARGS that expands to nothing in 
> C23 and later, and to void otherwise. This might be more trouble than 
> it's worth, though.

That's more troublesome indeed, because such a macro confuses the C parsers
that people have built into editors and other tools.

Bruno






reply via email to

[Prev in Thread] Current Thread [Next in Thread]