diff --git a/config.site b/config.site index 886b7b4873..f94e969bac 100644 --- a/config.site +++ b/config.site @@ -69,7 +69,9 @@ ## Ditto for a compiler that supports C23 features. ## For example 'CC23=clang-15 -std=gnu2x' -## Eventually -std=gnu23 will be supported and preferred. +## -std=gnu2x is supported by at least GCC >= 12, LLVM clang >= 15 and Apple clang >= 16 +## Eventually -std=gnu23 will be supported and preferred +## (and is by GCC >= 14 and LLVM >= 18). ## Default to CC and CFLAGS with any -std options removed, then ## -std=gmu2x appended to CC. ## CC23= diff --git a/doc/manual/R-exts.texi b/doc/manual/R-exts.texi index 9f30a6f80f..6963cfd858 100644 --- a/doc/manual/R-exts.texi +++ b/doc/manual/R-exts.texi @@ -3196,12 +3196,15 @@ clarifying the formerly deprecated meaning of function declarations with an empty parameter list to mean zero parameters. (There are many other additions: see for example @uref{https://en.cppreference.com/w/c/23}.) +@c GCC 14, LLVM clang 19 and Apple clang 16 default to C17 +@c In 2025-01 GCC pre=15 defaulted to C23 (but did not document so). The @command{configure} script in recent versions of @R{} aims to choose a C compiler which supports C11: as the default in recent versions of @command{gcc}, @I{LLVM} @command{clang} and Apple @command{clang} is C17, that is what is likely to be chosen. On the other hand, until @R{} 4.3.0 the makefiles for the Windows build specified C99. They now use the -compiler default which for the recommended compiler is C17. +compiler default which for the recommended compiler is C17. Future +versions (including @command{gcc}@tie{}15) are likely to default to C23. Packages may want to either avoid or embrace the changes in C23, and can do so @emph{via} specifying @samp{USE_Cnn} for 17, 23, 90 or 99 in the diff --git a/src/include/R_ext/Error.h b/src/include/R_ext/Error.h index 9382fd9526..fede961d39 100644 --- a/src/include/R_ext/Error.h +++ b/src/include/R_ext/Error.h @@ -39,11 +39,15 @@ extern "C" { #endif -/* C23 has a [[noreturn]] attribute supported in GCC 13 and LLVM clang - * 15 with -std=c2x but not Apple clang 14. All have version 202000L. - * clang 19 has version 202301L - * gcc pre-15 supports -std=gnu23 with version 202301L but does not - * support (and barfs on) this attribute, so restrict to clang for now. +/* C23 has a [[noreturn]] attribute supported in LLVM clang 15 with + * -std=c2x but not Apple clang 14. That and GCC verisions 12-14 have + * version 202000L. + * clang 19 has version 202301L (and supports -std=gnu23). + * gcc pre-15 supports -std=gnu23 with version 202301L but barfs on + * this attribute, so restrict to clang for now. + * + * https://en.cppreference.com/w/c/compiler_support/23 + * claims GCC 13 and LLVM clang 15 support [[noreturn]] .... * * In C11 there is _Noreturn * (or noreturn in header ). */