Skip to content

Commit d389a8a

Browse files
committed
enable unwind protection by default
1 parent e1dedab commit d389a8a

File tree

5 files changed

+13
-13
lines changed

5 files changed

+13
-13
lines changed

R/Attributes.R

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

2-
# Copyright (C) 2012 - 2021 JJ Allaire, Dirk Eddelbuettel and Romain Francois
2+
# Copyright (C) 2012 - 2022 JJ Allaire, Dirk Eddelbuettel and Romain Francois
33
#
44
# This file is part of Rcpp.
55
#
@@ -562,9 +562,11 @@ compileAttributes <- function(pkgdir = ".", verbose = getOption("verbose")) {
562562
PKG_LIBS="-fopenmp"))
563563
}
564564

565-
.plugins[["unwindProtect"]] <- function() {
566-
list(env = list(PKG_CPPFLAGS = "-DRCPP_USE_UNWIND_PROTECT"))
567-
}
565+
.plugins[["unwindProtect"]] <- function() { # nocov start
566+
warning("unwindProtect is enabled by default and this plugin is deprecated.",
567+
" It will be removed in a future version of Rcpp.")
568+
list()
569+
} # nocov end
568570

569571
# register a plugin
570572
registerPlugin <- function(name, plugin) {

inst/include/Rcpp/r/headers.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@
9595
# pragma pop_macro("makedev")
9696
#endif
9797

98-
#if (defined(RCPP_USE_UNWIND_PROTECT) && defined(R_VERSION) && R_VERSION >= R_Version(3, 5, 0))
98+
#if (!defined(RCPP_NO_UNWIND_PROTECT) && defined(R_VERSION) && R_VERSION >= R_Version(3, 5, 0))
9999
# define RCPP_USING_UNWIND_PROTECT
100100
#endif
101101

inst/tinytest/cpp/stack.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// misc.cpp: Rcpp R/C++ interface class library -- misc unit tests
44
//
5-
// Copyright (C) 2013 - 2015 Dirk Eddelbuettel and Romain Francois
5+
// Copyright (C) 2013 - 2022 Dirk Eddelbuettel and Romain Francois
66
//
77
// This file is part of Rcpp.
88
//
@@ -19,7 +19,7 @@
1919
// You should have received a copy of the GNU General Public License
2020
// along with Rcpp. If not, see <http://www.gnu.org/licenses/>.
2121

22-
// [[Rcpp::plugins(unwindProtect,cpp11)]]
22+
// [[Rcpp::plugins(cpp11)]]
2323

2424
#include <Rcpp.h>
2525
using namespace Rcpp;

inst/tinytest/testRcppInterfaceExporter/src/config.h

Lines changed: 0 additions & 1 deletion
This file was deleted.

inst/tinytest/test_interface.R

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

2-
## Copyright (C) 2018 - 2019 RStudio
2+
## Copyright (C) 2018 - 2022 RStudio
33
##
44
## This file is part of Rcpp.
55
##
@@ -64,9 +64,8 @@ on.exit(Sys.setenv(R_LIBS = old_libs_envvar), add = TRUE)
6464
sys_sep <- if (.Platform$OS.type == "windows") ";" else ":"
6565
Sys.setenv(R_LIBS = paste(c(lib_path, old_lib_paths), collapse = sys_sep))
6666

67-
cfg <- "#define RCPP_USE_UNWIND_PROTECT"
68-
build_package(exporter_name, lib_path, config = cfg)
69-
build_package(user_name, lib_path, config = cfg)
67+
build_package(exporter_name, lib_path)
68+
build_package(user_name, lib_path)
7069

7170
result <- tools::testInstalledPackage(user_name, lib.loc = lib_path, types = "test")
7271

@@ -82,7 +81,7 @@ expect_equal(result, 0L)
8281
## Now test client package without protected evaluation
8382
unlink(user_name, recursive = TRUE)
8483
unlink(paste0(user_name, "-tests"), recursive = TRUE)
85-
build_package(user_name, lib_path, config = character())
84+
build_package(user_name, lib_path, config = "#define RCPP_NO_UNWIND_PROTECT")
8685

8786
result <- tools::testInstalledPackage(user_name, lib.loc = lib_path, types = "test")
8887

0 commit comments

Comments
 (0)