Go to file
Joseph Myers 55e3bd376b c: Default to -std=gnu23
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
9fb5348e30 ("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).

gcc/
	* doc/invoke.texi (-std=gnu17, -std=gnu23): Document -std=gnu23 as
	default for C code.

gcc/c-family/
	* c-opts.cc (c_common_init_options): Default to C23.

gcc/testsuite/
	* c-c++-common/analyzer/asm-x86-dyndbg-2.c,
	c-c++-common/analyzer/asm-x86-lp64-2.c,
	c-c++-common/analyzer/attr-malloc-CVE-2019-19078-usb-leak.c,
	c-c++-common/analyzer/coreutils-cksum-pr108664.c,
	c-c++-common/analyzer/feasibility-3.c,
	c-c++-common/analyzer/pr105783.c, c-c++-common/analyzer/sock-1.c,
	c-c++-common/attributes-4.c, gcc.dg/Warray-bounds-78.c,
	gcc.dg/analyzer/asm-x86-dyndbg-1.c: Do not define bool, true or
	false.
	* gcc.dg/debug/ctf/ctf-function-pointers-2.c: Use -std-gnu17.
	* gcc.dg/gnu23-version-2.c: New test.
	* gcc.dg/simulate-thread/atomic-load-int.c,
	gcc.dg/simulate-thread/atomic-load-longlong.c,
	gcc.dg/simulate-thread/atomic-load-short.c: Add more noinline
	attributes.
	* gcc.dg/torture/pr117496-1.c: Use -std=gnu17.
2024-11-15 23:45:57 +00:00
.forgejo
.github
c++tools
config
contrib
fixincludes
gcc c: Default to -std=gnu23 2024-11-15 23:45:57 +00:00
gnattools
gotools
include
INSTALL
libada
libatomic
libbacktrace
libcc1
libcody
libcpp
libdecnumber
libffi
libgcc
libgfortran
libgm2
libgo
libgomp
libgrust
libiberty
libitm
libobjc
libphobos
libquadmath
libsanitizer
libssp
libstdc++-v3
libvtv
lto-plugin
maintainer-scripts
zlib
.b4-config
.dir-locals.el
.gitattributes
.gitignore
ABOUT-NLS
ar-lib
ChangeLog
ChangeLog.jit
ChangeLog.tree-ssa
compile
config-ml.in
config.guess
config.rpath
config.sub
configure
configure.ac
COPYING
COPYING3
COPYING3.LIB
COPYING.LIB
COPYING.RUNTIME
depcomp
install-sh
libtool-ldflags
libtool.m4
lt~obsolete.m4
ltgcc.m4
ltmain.sh
ltoptions.m4
ltsugar.m4
ltversion.m4
MAINTAINERS
Makefile.def
Makefile.in
Makefile.tpl
missing
mkdep
mkinstalldirs
move-if-change
multilib.am
README
SECURITY.txt
symlink-tree
test-driver
ylwrap

This directory contains the GNU Compiler Collection (GCC).

The GNU Compiler Collection is free software.  See the files whose
names start with COPYING for copying permission.  The manuals, and
some of the runtime libraries, are under different terms; see the
individual source files for details.

The directory INSTALL contains copies of the installation information
as HTML and plain text.  The source of this information is
gcc/doc/install.texi.  The installation information includes details
of what is included in the GCC sources and what files GCC installs.

See the file gcc/doc/gcc.texi (together with other files that it
includes) for usage and porting information.  An online readable
version of the manual is in the files gcc/doc/gcc.info*.

See http://gcc.gnu.org/bugs/ for how to report bugs usefully.

Copyright years on GCC source files may be listed using range
notation, e.g., 1987-2012, indicating that every year in the range,
inclusive, is a copyrightable year that could otherwise be listed
individually.