Skip to content

Commit fbe31aa

Browse files
author
ripley
committed
first steps to phasing out C++11/14 support
git-svn-id: https://svn.r-project.org/R/trunk@89066 00db46b3-68df-0310-9c12-caf00c1e9a41
1 parent 286fad1 commit fbe31aa

File tree

3 files changed

+28
-42
lines changed

3 files changed

+28
-42
lines changed

doc/NEWS.Rd

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,11 @@
175175
176176
\subsection{PACKAGE INSTALLATION}{
177177
\itemize{
178-
\item .
178+
\item Specifying C++11 or C++14 has long given a note: in 98\% of
179+
CRAN packages the specification is unnecessary as the default
180+
C++17 suffices.
181+
The intention is that support for those standards will be withdrawn
182+
before release.
179183
}
180184
}
181185

doc/manual/R-exts.texi

Lines changed: 20 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -2894,8 +2894,7 @@ version 8) @option{-std=f2018} in @code{PKG_FFLAGS} or
28942894
(but Fortran 95 prior to @command{gfortran}@tie{}8) with non-standard
28952895
extensions. The other compilers in current use (@I{LLVM}'s
28962896
@command{flang} (called @command{flang-new} before version 20) and Intel's
2897-
@command{ifx}) default to Fortran 2018@footnote{but was said to have
2898-
complete support only from version 2023.0.0.}.
2897+
@command{ifx}) default to Fortran 2018.
28992898

29002899
It is good practice to describe a Fortran version requirement in
29012900
@file{DESCRIPTION}'s @samp{SystemRequirements} field. Note that this is
@@ -2952,8 +2951,7 @@ define a module of the same name in multiple source files.
29522951
@subsection Using C++ code
29532952

29542953
@R{} can be built without a C++ compiler although one is available (but
2955-
not necessarily installed) on all known @R{} platforms. As from @R{}
2956-
4.0.0 a C++ compiler will be selected only if it conforms to the 2011
2954+
not necessarily installed) on all known @R{} platforms.
29572955
standard (`C++11'). A minor update@footnote{Some changes are linked
29582956
from
29592957
@uref{https://isocpp.org/std/standing-documents/sd-6-sg10-feature-test-recommendations}:
@@ -3007,40 +3005,24 @@ standards list deprecated and removed (and undeprecated) features.
30073005

30083006
For maximal portability a package should specify the standard it
30093007
requires for code in its @file{src} directory by including something
3010-
like @samp{C++14} in the @samp{SystemRequirements} field of the
3008+
like @samp{C++23} in the @samp{SystemRequirements} field of the
30113009
@file{DESCRIPTION} file, e.g.
30123010

30133011
@example
3014-
SystemRequirements: C++14
3012+
SystemRequirements: C++23
30153013
@end example
30163014
@noindent
30173015
If it has a @file{Makevars} file (or @file{Makevars.win} or
30183016
@file{Makevars.ucrt} on Windows) this should include the line
30193017
@example
3020-
CXX_STD = CXX14
3018+
CXX_STD = CXX23
30213019
@end example
3022-
@noindent
3023-
On the other hand, specifying C++11@footnote{Often historically
3024-
used to mean `not C++98'} when the code is valid under C++14 or C++17
3025-
reduces future portability.
30263020

3027-
Code needing C++14 or later features can check for their presence @emph{via}
3021+
Code needing C++20 or later features can check for their presence @emph{via}
30283022
`SD-6 feature tests'@footnote{See
30293023
@uref{https://isocpp.org/std/standing-documents/sd-6-sg10-feature-test-recommendations}
30303024
or
3031-
@uref{https://en.cppreference.com/w/cpp/experimental/feature_test.html}.
3032-
It seems a reasonable assumption that any compiler promising some C++14
3033-
conformance will provide these---e.g.@: @command{g++} 4.9.x did but
3034-
4.8.5 did not.}. Such a check could be
3035-
3036-
@example
3037-
#include <memory> // header where this is defined
3038-
#if defined(__cpp_lib_make_unique) && (__cpp_lib_make_unique >= 201304)
3039-
using std::make_unique;
3040-
#else
3041-
// your emulation
3042-
#endif
3043-
@end example
3025+
@uref{https://en.cppreference.com/w/cpp/experimental/feature_test.html}.}
30443026

30453027
@c Ubuntu LTS releases now have 10 years of support even if announced
30463028
@c with 8 years.
@@ -3055,7 +3037,7 @@ using std::make_unique;
30553037
@c RHEL 8 (8.x, 9.x available. full support 2024-05 + 8 more years)
30563038
@c RHEL 9 (11.x available, full support 2027-05 + 8 more years)
30573039

3058-
C++17, C++20, C++23 and C++26 (from @R{} 4.5.0) can be specified in an
3040+
C++20, C++23 and C++26 (from @R{} 4.5.0) can be specified in an
30593041
analogous way.
30603042

30613043
Note that C++17 or later `support' does not mean complete support: use
@@ -3116,25 +3098,25 @@ and @command{g++} 11--15 to C++17.
31163098
For a package with a @file{src/Makefile} (or a Windows analogue),
31173099
a non-default C++ compiler can be selected by including something like
31183100
@example
3119-
CXX14 = `"$@{R_HOME@}/bin/R" CMD config CXX14`
3120-
CXX14STD = `"$@{R_HOME@}/bin/R" CMD config CXX14STD`
3121-
CXX = $@{CXX14@} $@{CXX14STD@}
3122-
CXXFLAGS = `"$@{R_HOME@}/bin/R" CMD config CXX14FLAGS`
3123-
CXXPICFLAGS = `"$@{R_HOME@}/bin/R" CMD config CXX14PICFLAGS`
3124-
SHLIB_LD = "$@{R_HOME@}/bin/R" CMD config SHLIB_CXX14LD`
3125-
SHLIB_LDFLAGS = "$@{R_HOME@}/bin/R" CMD config SHLIB_CXX14LDFLAGS`
3101+
CXX20 = `"$@{R_HOME@}/bin/R" CMD config CXX20`
3102+
CXX20STD = `"$@{R_HOME@}/bin/R" CMD config CXX20STD`
3103+
CXX = $@{CXX20@} $@{CXX20STD@}
3104+
CXXFLAGS = `"$@{R_HOME@}/bin/R" CMD config CXX20FLAGS`
3105+
CXXPICFLAGS = `"$@{R_HOME@}/bin/R" CMD config CXX20PICFLAGS`
3106+
SHLIB_LD = "$@{R_HOME@}/bin/R" CMD config SHLIB_CXX20LD`
3107+
SHLIB_LDFLAGS = "$@{R_HOME@}/bin/R" CMD config SHLIB_CXX20LDFLAGS`
31263108
@end example
31273109
@noindent
31283110
and ensuring these values are used in relevant compilations, after
31293111
checking they are non-empty. A common use of @file{src/Makefile} is to
31303112
compile an executable, when likely something like (for example for
3131-
C++14)
3113+
C++20)
31323114
@example
3133-
if test -z "$CXX14"; then
3134-
AC_MSG_ERROR([No C++14 compiler is available])
3115+
if test -z "$CXX20"; then
3116+
AC_MSG_ERROR([No C++20 compiler is available])
31353117
fi
3136-
CXX = $@{CXX14@} $@{CXX14STD@}
3137-
CXXFLAGS = $@{CXX14FLAGS@}
3118+
CXX = $@{CXX20@} $@{CXX20STD@}
3119+
CXXFLAGS = $@{CXX20FLAGS@}
31383120
@end example
31393121
@noindent
31403122
suffices.

src/library/tools/R/check.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5598,7 +5598,7 @@ add_dummies <- function(dir, Log)
55985598
},
55995599
error = identity)
56005600
results1 <- c(results1a, list(results1b))
5601-
5601+
56025602
ignore <-
56035603
Sys.getenv("_R_CHECK_RD_VALIDATE_RD2HTML_IGNORE_EMPTY_SPANS_",
56045604
"true")
@@ -6506,9 +6506,9 @@ add_dummies <- function(dir, Log)
65066506
std <- as.numeric(sub("using C[+][+]", "", line))
65076507
if (std < 17) {
65086508
noteLog(Log,
6509-
sprintf(" Specified C++%d: please drop specification unless essential", std))
6509+
sprintf(" Specified C++%d: support will be removed soon", std))
65106510
## since R 4.4.0 C++17 support is required, but
6511-
## C++23/26} support is patchy
6511+
## C++23/26 support is patchy
65126512
} else if (std >= 23) {
65136513
resultLog(Log, "OK")
65146514
printLog(Log,

0 commit comments

Comments
 (0)