public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/108700] New: false _Noreturn error with -Werror=old-style-declaration
@ 2023-02-07 15:15 vincent-gcc at vinc17 dot net
2023-02-07 15:53 ` [Bug c/108700] " pinskia at gcc dot gnu.org
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: vincent-gcc at vinc17 dot net @ 2023-02-07 15:15 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108700
Bug ID: 108700
Summary: false _Noreturn error with
-Werror=old-style-declaration
Product: gcc
Version: 12.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: vincent-gcc at vinc17 dot net
Target Milestone: ---
With gcc-12 (Debian 12.2.0-14) 12.2.0 (but this error was already present in
GCC 4.8):
cventin% echo 'int _Noreturn does_not_return (void) { for (;;) continue; }' |
gcc-12 -xc -c -Werror=old-style-declaration -
<stdin>:1:1: error: ‘_Noreturn’ is not at beginning of declaration
[-Werror=old-style-declaration]
cc1: some warnings being treated as errors
This error is incorrect. The grammar in ISO C17 is
function-definition:
declaration-specifiers declarator declaration-listopt compound-statement
declaration-specifiers:
storage-class-specifier declaration-specifiersopt
type-specifier declaration-specifiersopt
type-qualifier declaration-specifiersopt
function-specifier declaration-specifiersopt
alignment-specifier declaration-specifiersopt
where "int" is part of type-specifier and "_Noreturn" is part of
function-specifier, so that they can be in any order.
Note that the
int _Noreturn does_not_return (void) { for (;;) continue; }
comes from one of the autoconf tests, which fails as a consequence.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c/108700] false _Noreturn error with -Werror=old-style-declaration
2023-02-07 15:15 [Bug c/108700] New: false _Noreturn error with -Werror=old-style-declaration vincent-gcc at vinc17 dot net
@ 2023-02-07 15:53 ` pinskia at gcc dot gnu.org
2023-02-07 16:03 ` vincent-gcc at vinc17 dot net
2023-02-07 17:37 ` schwab@linux-m68k.org
2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-02-07 15:53 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108700
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
This has been warning since _Noreturn support was added back in r177881 .
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c/108700] false _Noreturn error with -Werror=old-style-declaration
2023-02-07 15:15 [Bug c/108700] New: false _Noreturn error with -Werror=old-style-declaration vincent-gcc at vinc17 dot net
2023-02-07 15:53 ` [Bug c/108700] " pinskia at gcc dot gnu.org
@ 2023-02-07 16:03 ` vincent-gcc at vinc17 dot net
2023-02-07 17:37 ` schwab@linux-m68k.org
2 siblings, 0 replies; 4+ messages in thread
From: vincent-gcc at vinc17 dot net @ 2023-02-07 16:03 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108700
--- Comment #2 from Vincent Lefèvre <vincent-gcc at vinc17 dot net> ---
And there's the same issue with "inline" instead of "_Noreturn" (these are the
only two function specifiers).
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c/108700] false _Noreturn error with -Werror=old-style-declaration
2023-02-07 15:15 [Bug c/108700] New: false _Noreturn error with -Werror=old-style-declaration vincent-gcc at vinc17 dot net
2023-02-07 15:53 ` [Bug c/108700] " pinskia at gcc dot gnu.org
2023-02-07 16:03 ` vincent-gcc at vinc17 dot net
@ 2023-02-07 17:37 ` schwab@linux-m68k.org
2 siblings, 0 replies; 4+ messages in thread
From: schwab@linux-m68k.org @ 2023-02-07 17:37 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108700
--- Comment #3 from Andreas Schwab <schwab@linux-m68k.org> ---
The grammar doesn't tell everything, though currently only storage-class
specifiers are expected to occur at the beginning.
From c-parser.cc:c_parser_declspecs:
/* TODO: Distinguish between function specifiers (inline, noreturn)
and storage class specifiers, either here or in
declspecs_add_scspec. */
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-02-07 17:37 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-07 15:15 [Bug c/108700] New: false _Noreturn error with -Werror=old-style-declaration vincent-gcc at vinc17 dot net
2023-02-07 15:53 ` [Bug c/108700] " pinskia at gcc dot gnu.org
2023-02-07 16:03 ` vincent-gcc at vinc17 dot net
2023-02-07 17:37 ` schwab@linux-m68k.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).