diff options
author | Joseph Myers <josmyers@redhat.com> | 2024-10-19 00:20:15 +0000 |
---|---|---|
committer | Joseph Myers <josmyers@redhat.com> | 2024-10-19 00:21:42 +0000 |
commit | d277ded292d7e9eeaa0b8bce6782c4cd6b32d2c0 (patch) | |
tree | 32d3beac860279637a02a77e6fecf4744a054879 /gcc/fortran/error.cc | |
parent | de14559ef53b3a0e8c544bdc65f5983a184767b1 (diff) | |
download | gcc-d277ded292d7e9eeaa0b8bce6782c4cd6b32d2c0.zip gcc-d277ded292d7e9eeaa0b8bce6782c4cd6b32d2c0.tar.gz gcc-d277ded292d7e9eeaa0b8bce6782c4cd6b32d2c0.tar.bz2 |
c: Fix -std=gnu23 -Wtraditional for () in function definitions
We don't yet have clear agreement on removing -Wtraditional (although
it seems there is little to no use for most of the warnings therein),
so fix the bug in its interaction with -std=gnu23 to continue progress
on making -std=gnu23 the default while -Wtraditional remains under
discussion.
The warning for ISO C function definitions with -Wtraditional properly
covers (void), but also wrongly warned for () in C23 mode as that has
the same semantics as (void) in that case. Keep track in c_arg_info
of when () was converted to (void) for C23 so that -Wtraditional can
avoid warning in that case (with an appropriate comment on the
definition of the new field to make clear it can be removed along with
-Wtraditional).
Bootstrapped with no regressions for x86_64-pc-linux-gnu.
gcc/c/
* c-tree.h (c_arg_info): Add c23_empty_parens.
* c-decl.cc (grokparms): Set c23_empty_parens.
(build_arg_info): Clear c23_empty_parens.
(store_parm_decls_newstyle): Do not give -Wtraditional warning for
ISO C function definition if c23_empty_parens.
gcc/testsuite/
* gcc.dg/wtr-gnu17-1.c, gcc.dg/wtr-gnu23-1.c: New tests.
Diffstat (limited to 'gcc/fortran/error.cc')
0 files changed, 0 insertions, 0 deletions