Skip to content

Commit 486f285

Browse files
committed
updates for C++14,C++17 plugins, new C++98 plugin
1 parent a398603 commit 486f285

File tree

3 files changed

+28
-6
lines changed

3 files changed

+28
-6
lines changed

ChangeLog

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
2017-04-25 Dirk Eddelbuettel <[email protected]>
22

33
* R/Attributes.R (.plugins[["cpp11"]]): If R 3.4.0 or newer is used, set
4-
USE_CXX11 (instead of the older USE_CXX1X)
4+
USE_CXX11 (instead of the older USE_CXX1X);
5+
(.plugins[["cpp14"]]): similarly updated for C++14
6+
(.plugins[["cpp17"]]): similarly updated for C++17
7+
(.plugins[["cpp98"]]): added
58

69
2017-04-22 Nathan Russell <[email protected]>
710

R/Attributes.R

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
# Copyright (C) 2012 - 2016 JJ Allaire, Dirk Eddelbuettel and Romain Francois
2+
# Copyright (C) 2012 - 2017 JJ Allaire, Dirk Eddelbuettel and Romain Francois
33
#
44
# This file is part of Rcpp.
55
#
@@ -456,7 +456,14 @@ compileAttributes <- function(pkgdir = ".", verbose = getOption("verbose")) {
456456
# setup plugins environment
457457
.plugins <- new.env()
458458

459-
# built-in C++11 plugin
459+
# built-in C++98 plugin
460+
.plugins[["cpp98"]] <- function() {
461+
if (getRversion() >= "3.4") # with recent R versions, R can decide
462+
list(env = list(USE_CXX98 = "yes"))
463+
else
464+
list(env = list(PKG_CXXFLAGS ="-std=c++98"))
465+
}
466+
# built-in C++11 plugin
460467
.plugins[["cpp11"]] <- function() {
461468
if (getRversion() >= "3.4") # with recent R versions, R can decide
462469
list(env = list(USE_CXX11 = "yes"))
@@ -477,7 +484,10 @@ compileAttributes <- function(pkgdir = ".", verbose = getOption("verbose")) {
477484
## this is the default in g++-6.1 and later
478485
## per https://gcc.gnu.org/projects/cxx-status.html#cxx14
479486
.plugins[["cpp14"]] <- function() {
480-
list(env = list(PKG_CXXFLAGS ="-std=c++14"))
487+
if (getRversion() >= "3.4") # with recent R versions, R can decide
488+
list(env = list(USE_CXX14 = "yes"))
489+
else
490+
list(env = list(PKG_CXXFLAGS ="-std=c++14"))
481491
}
482492

483493
# built-in C++1y plugin for C++14 and C++17 standard under development
@@ -487,7 +497,10 @@ compileAttributes <- function(pkgdir = ".", verbose = getOption("verbose")) {
487497

488498
# built-in C++17 plugin for C++17 standard (g++-6 or later)
489499
.plugins[["cpp17"]] <- function() {
490-
list(env = list(PKG_CXXFLAGS ="-std=c++17"))
500+
if (getRversion() >= "3.4") # with recent R versions, R can decide
501+
list(env = list(USE_CXX17 = "yes"))
502+
else
503+
list(env = list(PKG_CXXFLAGS ="-std=c++17"))
491504
}
492505

493506
## built-in C++1z plugin for C++17 standard under development

inst/NEWS.Rd

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@
3030
\item Added sugar function \code{trimws} (Nathan Russell in \ghpr{680}
3131
addressing \ghit{679}).
3232
}
33+
\item Changes in Rcpp Attributes:
34+
\itemize{
35+
\item The plugins for C++11, C++14, C++17 now set the values R 3.4.0 or
36+
later expects; a plugin for C++98 was added (Dirk in \ghpr{684} addressing
37+
\ghit{683}).
38+
}
3339
}
3440
}
3541

@@ -51,7 +57,7 @@
5157
\item The \code{algorithm.h} file now accomodates the Intel compiler
5258
(Dirk in \ghpr{643} and Dan in \ghpr{645} addressing issue \ghit{640}).
5359
}
54-
\item Changes in Rcpp Attributes
60+
\item Changes in Rcpp Attributes:
5561
\itemize{
5662
\item The C++17 standard is supported with a new plugin (used eg for
5763
\code{g++-6.2}).

0 commit comments

Comments
 (0)