Skip to content

Commit

Permalink
update comments on C23 support
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.r-project.org/R/trunk@87592 00db46b3-68df-0310-9c12-caf00c1e9a41
  • Loading branch information
ripley committed Jan 18, 2025
1 parent a11993d commit af2573f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
4 changes: 3 additions & 1 deletion config.site
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
5 changes: 4 additions & 1 deletion doc/manual/R-exts.texi
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 9 additions & 5 deletions src/include/R_ext/Error.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <stdnoreturn.h>).
*/
Expand Down

0 comments on commit af2573f

Please sign in to comment.