* ISO C23 removal of unprototyped functions
@ 2023-02-07 12:14 Bruno Haible
2023-02-07 13:58 ` alice
2023-02-08 11:02 ` A. Wilcox
0 siblings, 2 replies; 4+ messages in thread
From: Bruno Haible @ 2023-02-07 12:14 UTC (permalink / raw)
To: distributions
Seen in the GCC change log [1]: Joseph Myers wrote:
"
C2x has completely removed unprototyped functions, so that () now
means the same as (void) in both function declarations and
definitions, where previously that change had been made for
definitions only. Implement this accordingly.
This is a change where GNU/Linux distribution builders might wish to
try builds with a -std=gnu2x default to start early on getting old
code fixed that still has () declarations for functions taking
arguments, in advance of GCC moving to -std=gnu2x as default maybe in
GCC 14 or 15; I don't know how much such code is likely to be in
current use.
"
There were two essential changes in this area in ISO C 23:
* https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2432.pdf
1) removed the K&R C syntax for function definitions
int foo (x, y) int x; long y; { ... }
2) in function definitions, () is equivalent to (void).
* https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2841.htm
3) A function declarator with a parameter list of () declares a prototype
for a function that takes no parameters (like it does in C++).
See ISO C 23 § 6.7.6.3.(13).
[1] https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=0a4b219d39c74ae
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: ISO C23 removal of unprototyped functions
2023-02-07 12:14 ISO C23 removal of unprototyped functions Bruno Haible
@ 2023-02-07 13:58 ` alice
2023-02-08 11:02 ` A. Wilcox
1 sibling, 0 replies; 4+ messages in thread
From: alice @ 2023-02-07 13:58 UTC (permalink / raw)
To: Bruno Haible, distributions
On Tue Feb 7, 2023 at 1:14 PM CET, Bruno Haible wrote:
> Seen in the GCC change log [1]: Joseph Myers wrote:
>
> "
> C2x has completely removed unprototyped functions, so that () now
> means the same as (void) in both function declarations and
> definitions, where previously that change had been made for
> definitions only. Implement this accordingly.
>
> This is a change where GNU/Linux distribution builders might wish to
> try builds with a -std=gnu2x default to start early on getting old
> code fixed that still has () declarations for functions taking
> arguments, in advance of GCC moving to -std=gnu2x as default maybe in
> GCC 14 or 15; I don't know how much such code is likely to be in
> current use.
> "
of note, clang made some of these various c23 changes (and reverted them) in
15. context:
https://discourse.llvm.org/t/configure-script-breakage-with-the-new-werror-implicit-function-declaration/65213/1
starting from clang 16 these are errors again. what issues this causes is
discussed in the thread, but generally, this causes invisible configure
failures that misdetect features (false negatives, or even false positives).
gentoo has done quite a bit of work so far on upstreaming fixes regarding these to a variety of projects' build systems.
fedora is now aiming for the same:
https://fedoraproject.org/wiki/Changes/PortingToModernC
because gcc14 (as mentioned) will most likely contain this same breakage (as clang16 now will).
>
> There were two essential changes in this area in ISO C 23:
> * https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2432.pdf
> 1) removed the K&R C syntax for function definitions
> int foo (x, y) int x; long y; { ... }
> 2) in function definitions, () is equivalent to (void).
> * https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2841.htm
> 3) A function declarator with a parameter list of () declares a prototype
> for a function that takes no parameters (like it does in C++).
> See ISO C 23 § 6.7.6.3.(13).
>
> [1] https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=0a4b219d39c74ae
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: ISO C23 removal of unprototyped functions
2023-02-07 12:14 ISO C23 removal of unprototyped functions Bruno Haible
2023-02-07 13:58 ` alice
@ 2023-02-08 11:02 ` A. Wilcox
2023-02-08 12:01 ` Bruno Haible
1 sibling, 1 reply; 4+ messages in thread
From: A. Wilcox @ 2023-02-08 11:02 UTC (permalink / raw)
To: distributions
On Feb 7, 2023, at 6:14 AM, Bruno Haible <bruno@clisp.org> wrote:
>
> Seen in the GCC change log [1]: Joseph Myers wrote:
>
> "
> C2x has completely removed unprototyped functions, so that () now
> means the same as (void) in both function declarations and
> definitions, where previously that change had been made for
> definitions only. Implement this accordingly.
>
> This is a change where GNU/Linux distribution builders might wish to
> try builds with a -std=gnu2x default to start early on getting old
> code fixed that still has () declarations for functions taking
> arguments, in advance of GCC moving to -std=gnu2x as default maybe in
> GCC 14 or 15; I don't know how much such code is likely to be in
> current use.
> "
>
> There were two essential changes in this area in ISO C 23:
> * https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2432.pdf
> 1) removed the K&R C syntax for function definitions
> int foo (x, y) int x; long y; { ... }
> 2) in function definitions, () is equivalent to (void).
> * https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2841.htm
> 3) A function declarator with a parameter list of () declares a prototype
> for a function that takes no parameters (like it does in C++).
> See ISO C 23 § 6.7.6.3.(13).
>
> [1] https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=0a4b219d39c74ae
What is the minimum version of GCC to detect this?
Is there a warning flag that could pick it up before this commit was
introduced?
Is the only released compiler that can warn on this Clang 15?[1]
Sorry if this seems silly, but we’re not even at GCC 12 yet in Adélie
and I’d still really like to do some work on this in my spare time.
Best,
-A.
[1]: https://github.com/madler/zlib/issues/633#issuecomment-1419525514
--
A. Wilcox (they/them)
SW Engineering: C/C++, DevOps, POSIX
Wilcox Technologies Inc.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: ISO C23 removal of unprototyped functions
2023-02-08 11:02 ` A. Wilcox
@ 2023-02-08 12:01 ` Bruno Haible
0 siblings, 0 replies; 4+ messages in thread
From: Bruno Haible @ 2023-02-08 12:01 UTC (permalink / raw)
To: distributions, A. Wilcox
A. Wilcox asked:
> What is the minimum version of GCC to detect this?
>
> Is there a warning flag that could pick it up before this commit was
> introduced?
>
> Is the only released compiler that can warn on this Clang 15?[1]
As far as I understand from [1][2]:
The way to get exactly the pertinent diagnostics is to use clang 15
with options
-std=c2x -Wincompatible-function-pointer-types
and look at all errors and warnings.
If one uses clang 15 with options
-std=c17 -Wdeprecated-non-prototype
and looks at all warnings, one gets most, but not all, of the needed
diagnostics.
If one uses GCC 12, there are not the appropriate warning options. [2]
Bruno
[1] https://discourse.llvm.org/t/unresolved-issues-from-the-llvm-15-x-release/66071/34
[2] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108694#c2
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-02-08 12:19 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-07 12:14 ISO C23 removal of unprototyped functions Bruno Haible
2023-02-07 13:58 ` alice
2023-02-08 11:02 ` A. Wilcox
2023-02-08 12:01 ` Bruno Haible
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.