Skip to content

Commit 26387a4

Browse files
author
ripley
committed
tweak working for the 2024-10 release of C23
git-svn-id: https://svn.r-project.org/R/trunk@87368 00db46b3-68df-0310-9c12-caf00c1e9a41
1 parent 7d30b33 commit 26387a4

File tree

3 files changed

+23
-22
lines changed

3 files changed

+23
-22
lines changed

config.site

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@
8686

8787
## Defines for C compilation.
8888
## Use this to specify defines to be used in the compilation of R,
89+
## (but not packages). Can be used to overrise e.g.
90+
## DEFS="-DC99_INLINE_SEMANTICS=0"
8991
## DEFS=
9092

9193
## The following additional CFLAGS to be used only in the main

doc/manual/R-admin.texi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1071,7 +1071,7 @@ suffice.
10711071
@subsection C standards
10721072

10731073
Compiling @R{} requires C99 or later: C11 and C17 are minor updates, but
1074-
the substantial update planned for `C23' (now expected @emph{ca} April
1074+
the substantial update planned for `C23' (finally published in October
10751075
2024) will also be supported.
10761076

10771077
As from @R{} 4.3.0 there is support for packages to indicate their

doc/manual/R-exts.texi

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3187,15 +3187,14 @@ compiler is to include an empty C++ file in @file{src}..
31873187
@subsection C standards
31883188

31893189
C has had standards C89/C90, C99, C11, C17 (also known as C18), and C23
3190-
is in final draft and expected to be published in 2024. C11 was a
3191-
minor change to C99 which introduced some new features and made others
3192-
optional, and C17 is a `bug-fix' update to C11. On the other hand, C23
3193-
makes extensive changes, including making @code{bool}, @code{true} and
3194-
@code{false} reserved words, finally disallowing K&R-style function
3195-
declarations and clarifying the formerly deprecated meaning of function
3196-
declarations with an empty parameter list to mean zero
3197-
parameters. (There are many other additions: see for example
3198-
@uref{https://en.cppreference.com/w/c/23}.)
3190+
(published in 2024). C11 was a minor change to C99 which introduced
3191+
some new features and made others optional, and C17 is a `bug-fix'
3192+
update to C11. On the other hand, C23 makes extensive changes,
3193+
including making @code{bool}, @code{true} and @code{false} reserved
3194+
words, finally disallowing K&R-style function declarations and
3195+
clarifying the formerly deprecated meaning of function declarations with
3196+
an empty parameter list to mean zero parameters. (There are many other
3197+
additions: see for example @uref{https://en.cppreference.com/w/c/23}.)
31993198

32003199
The @command{configure} script in recent versions of @R{} aims to choose
32013200
a C compiler which supports C11: as the default in recent versions of
@@ -3223,8 +3222,8 @@ LDFLAGS=`"$@{R_HOME@}/bin/R" CMD config LDFLAGS`
32233222
The (claimed) C standard in use can be checked by the macro
32243223
@code{__STDC_VERSION__}. This is undefined in C89/C90 and should have
32253224
values @code{199901L}, @code{201112L} and @code{201710L} for C99, C11
3226-
and C17. As C23 is not yet published there is as yet no definitive
3227-
value: compilers are currently using @code{202000L}.
3225+
and C17. The definitive value for C23 seems to be @code{202311L} but
3226+
compilers are currently using @code{202000L}.
32283227
@c https://gustedt.gitlabpages.inria.fr/c23-library/
32293228
C23 has macros similar to C++ `feature tests' for many of its changes,
32303229
for example @code{__STDC_VERSION_LIMITS_H__}.
@@ -6163,12 +6162,12 @@ run-time path to the library.
61636162

61646163
@item
61656164
Package authors commonly assume things are part of C/C++ when they are
6166-
not: the most common example is POSIX@footnote{Although this is expected
6167-
to be part of C23, full support of that is years away.} function
6168-
@code{strdup}. The most common C library on Linux, @code{glibc}, will
6169-
hide the declarations of such extensions unless a `feature-test macro'
6170-
is defined @strong{before} (almost) any system header is included. So
6171-
for @code{strdup} you need
6165+
not: the most common example is POSIX@footnote{Although this was added
6166+
for C23, full support of that is years away.} function @code{strdup}.
6167+
The most common C library on Linux, @code{glibc}, will hide the
6168+
declarations of such extensions unless a `feature-test macro' is defined
6169+
@strong{before} (almost) any system header is included. So for
6170+
@code{strdup} you need
61726171
@example
61736172
#define _POSIX_C_SOURCE 200809L
61746173
...
@@ -6323,8 +6322,8 @@ This has found quite a number of errors where functions have been
63236322
declared without arguments and is likely to become the default in future
63246323
compilers. (It already is for Apple @command{clang} and for @I{LLVM}
63256324
@command{clang} in C23 mode.) Note that using @code{f()} for a function
6326-
without any parameters was deprecated in C99 and C11, but it expected to
6327-
be non-deprecated in C23. However, @code{f(void)} is supported by all
6325+
without any parameters was deprecated in C99 and C11, but it became
6326+
non-deprecated in C23. However, @code{f(void)} is supported by all
63286327
standards and avoids any uncertainty.
63296328
@c draft n3054 §6.7.6.3 point 13 and footnote.
63306329

@@ -6402,7 +6401,7 @@ So the values will need to be cast to the type assumed by the format
64026401
@I{Variadic} macros in C or C++ only portably allow a non-zero number of
64036402
arguments, although some compilers have allowed zero, often with a
64046403
warning. The latter was standardized in C++20 using the @code{__VA_OPT__}
6405-
macro. C23 will also allow zero arguments in a similar way.
6404+
macro. C23 also allows zero arguments in a similar way.
64066405

64076406
@end itemize
64086407

@@ -11467,7 +11466,7 @@ is easy to specify the arguments for @code{.Call} (all @code{SEXP}) and
1146711466
and @code{.Fortran} are all pointers, specifying them as @code{void *}
1146811467
suffices. (For most platforms one can omit all the arguments, although
1146911468
link-time optimization will warn, as will compilers set up to warn on
11470-
strict prototypes -- and C23 will require correct arguments.)
11469+
strict prototypes -- and C23 requires correct arguments.)
1147111470

1147211471
Using @option{-fc-prototypes-external} will give a prototype using
1147311472
@code{int_least32_t *lgl} for Fortran @code{LOGICAL LGL}, but this is

0 commit comments

Comments
 (0)