> From: Joseph Myers <josmy...@redhat.com> > Sent: Saturday, November 16, 2024 7:47 AM > > Change the default language version for C compilation from -std=gnu17 > to -std=gnu23. A few tests are updated to remove local definitions of > bool, true and false (where making such an unconditional test change > seemed to make more sense than changing the test conditionally earlier > or building it with -std=gnu17); most test issues were already > addressed in previous patches. In the case of > ctf-function-pointers-2.c, it was agreed in bug 117289 that it would > be OK to put -std=gnu17 in the test and leave more optimal BTF / CTF > output for this test as a potential future improvement. > > Since the original test fixes, more such fixes have become necessary > and so are included in this patch. More noinline attributes are added > to simulate-thread tests where () meaning a prototype affected test > results, while gcc.dg/torture/pr117496-1.c (a test declaring a > function with () then calling it with arguments) gets -std=gnu17 > added. > > Bootstrapped with no regressions for x86_64-pc-linux-gnu. > > NOTE: it's likely there are target-specific tests for non-x86 targets > that need updating as a result of this change. See commit > 9fb5348e3021021e82d75e4ca4e6f8d51a34c24f ("testsuite: Prepare for > -std=gnu23 default") for examples of changes to prepare the testsuite > to work with a -std=gnu23 default. In most cases, adding > -Wno-old-style-definition (for warnings for old-style function > definitions) or -std=gnu17 (for other issues such as unprototyped > function declarations with ()) is appropriate, but watch out for cases > that indicate bugs with -std=gnu23 (in particular, any ICEs - there > was only the one nested function test where I had to fix an ICE on > x86_64). >
A quick question: Should we add this in gcc-wwwdocs porting doc or somewhere else? The upgrade does cause some old code fail to compile although it should fail. Thx, Haochen