-
- Downloads
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.
Showing
- gcc/c/c-decl.cc 7 additions, 2 deletionsgcc/c/c-decl.cc
- gcc/c/c-tree.h 4 additions, 0 deletionsgcc/c/c-tree.h
- gcc/testsuite/gcc.dg/wtr-gnu17-1.c 9 additions, 0 deletionsgcc/testsuite/gcc.dg/wtr-gnu17-1.c
- gcc/testsuite/gcc.dg/wtr-gnu23-1.c 9 additions, 0 deletionsgcc/testsuite/gcc.dg/wtr-gnu23-1.c
Loading
Please register or sign in to comment