diff --git a/ChangeLog b/ChangeLog index 1d057cc51..f9a7ff57c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2022-07-23 Iñaki Ucar + + * inst/include/Rcpp/r/headers.h: Unwind protection is enabled by default + unless `RCPP_NO_UNWIND_PROTECT` is defined (`RCPP_USE_UNWIND_PROTECT` is + not checked anymore and has no effect) + * inst/include/Rcpp/vector/Vector.h: Switch evaluation to `Rcpp_eval` + * R/Attributes.R: `[[Rcpp::plugins(unwindProtect)]]` is deprecated + * inst/tinytest/cpp/stack.cpp: Adapted + * inst/tinytest/test_exceptions.R: Adapted + * inst/tinytest/test_interface.R: Adapted + * inst/tinytest/testRcppInterfaceExporter/src/config.h: Removed + 2022-07-10 Dirk Eddelbuettel * docker/ci-4.1/Dockerfile: Add Dockerfile for 4.1 series diff --git a/R/Attributes.R b/R/Attributes.R index f4f4c89f8..504b7c500 100644 --- a/R/Attributes.R +++ b/R/Attributes.R @@ -1,5 +1,5 @@ -# Copyright (C) 2012 - 2021 JJ Allaire, Dirk Eddelbuettel and Romain Francois +# Copyright (C) 2012 - 2022 JJ Allaire, Dirk Eddelbuettel and Romain Francois # # This file is part of Rcpp. # @@ -562,9 +562,11 @@ compileAttributes <- function(pkgdir = ".", verbose = getOption("verbose")) { PKG_LIBS="-fopenmp")) } -.plugins[["unwindProtect"]] <- function() { - list(env = list(PKG_CPPFLAGS = "-DRCPP_USE_UNWIND_PROTECT")) -} +.plugins[["unwindProtect"]] <- function() { # nocov start + warning("unwindProtect is enabled by default and this plugin is deprecated.", + " It will be removed in a future version of Rcpp.") + list() +} # nocov end # register a plugin registerPlugin <- function(name, plugin) { diff --git a/inst/NEWS.Rd b/inst/NEWS.Rd index f1c8817ac..b3f3dd634 100644 --- a/inst/NEWS.Rd +++ b/inst/NEWS.Rd @@ -3,6 +3,19 @@ \newcommand{\ghpr}{\href{https://github.com/RcppCore/Rcpp/pull/#1}{##1}} \newcommand{\ghit}{\href{https://github.com/RcppCore/Rcpp/issues/#1}{##1}} +\section{Changes in Rcpp release version x.x.x (xxxx-xx-xx)}{ + \itemize{ + \item Changes in Rcpp API: + \itemize{ + \item Unwind protection is enabled by default (Iñaki in \ghpr{1225}). + It can be disabled by defining \code{RCPP_NO_UNWIND_PROTECT} before + including \code{Rcpp.h}. \code{RCPP_USE_UNWIND_PROTECT} is not checked + anymore and has no effect. The associated plugin \code{unwindProtect} + is therefore deprecated and will be removed in a future release. + } + } +} + \section{Changes in Rcpp hotfix release version 1.0.9 (2022-07-02)}{ \itemize{ \item Changes in Rcpp API: diff --git a/inst/include/Rcpp/r/headers.h b/inst/include/Rcpp/r/headers.h index 549982466..1804f2522 100644 --- a/inst/include/Rcpp/r/headers.h +++ b/inst/include/Rcpp/r/headers.h @@ -95,7 +95,7 @@ # pragma pop_macro("makedev") #endif -#if (defined(RCPP_USE_UNWIND_PROTECT) && defined(R_VERSION) && R_VERSION >= R_Version(3, 5, 0)) +#if (!defined(RCPP_NO_UNWIND_PROTECT) && defined(R_VERSION) && R_VERSION >= R_Version(3, 5, 0)) # define RCPP_USING_UNWIND_PROTECT #endif diff --git a/inst/include/Rcpp/vector/Vector.h b/inst/include/Rcpp/vector/Vector.h index 0f3905e8c..ef3b931e3 100644 --- a/inst/include/Rcpp/vector/Vector.h +++ b/inst/include/Rcpp/vector/Vector.h @@ -1,7 +1,7 @@ // // Vector.h: Rcpp R/C++ interface class library -- vectors // -// Copyright (C) 2010 - 2020 Dirk Eddelbuettel and Romain Francois +// Copyright (C) 2010 - 2022 Dirk Eddelbuettel and Romain Francois // // This file is part of Rcpp. // @@ -1128,11 +1128,11 @@ class Vector : public: inline SEXP eval() const { - return Rcpp_fast_eval( Storage::get__(), R_GlobalEnv ) ; + return Rcpp_eval( Storage::get__(), R_GlobalEnv ) ; } inline SEXP eval(SEXP env) const { - return Rcpp_fast_eval( Storage::get__(), env ); + return Rcpp_eval( Storage::get__(), env ); } diff --git a/inst/tinytest/cpp/stack.cpp b/inst/tinytest/cpp/stack.cpp index 630a44ec7..c3fa41789 100644 --- a/inst/tinytest/cpp/stack.cpp +++ b/inst/tinytest/cpp/stack.cpp @@ -2,7 +2,7 @@ // // misc.cpp: Rcpp R/C++ interface class library -- misc unit tests // -// Copyright (C) 2013 - 2015 Dirk Eddelbuettel and Romain Francois +// Copyright (C) 2013 - 2022 Dirk Eddelbuettel and Romain Francois // // This file is part of Rcpp. // @@ -19,7 +19,7 @@ // You should have received a copy of the GNU General Public License // along with Rcpp. If not, see . -// [[Rcpp::plugins(unwindProtect,cpp11)]] +// [[Rcpp::plugins(cpp11)]] #include using namespace Rcpp; diff --git a/inst/tinytest/testRcppInterfaceExporter/src/config.h b/inst/tinytest/testRcppInterfaceExporter/src/config.h deleted file mode 100644 index a17408665..000000000 --- a/inst/tinytest/testRcppInterfaceExporter/src/config.h +++ /dev/null @@ -1 +0,0 @@ -#define RCPP_USE_UNWIND_PROTECT diff --git a/inst/tinytest/test_exceptions.R b/inst/tinytest/test_exceptions.R index 81fd954a3..c7d853728 100644 --- a/inst/tinytest/test_exceptions.R +++ b/inst/tinytest/test_exceptions.R @@ -1,5 +1,5 @@ -## Copyright (C) 2010 - 2020 Dirk Eddelbuettel and Romain Francois +## Copyright (C) 2010 - 2022 Dirk Eddelbuettel and Romain Francois ## ## This file is part of Rcpp. ## @@ -37,7 +37,7 @@ expect_identical(class(condition), c("std::range_error", "C++Error", "error", "c ## C++ stack only available for Rcpp::exceptions expect_true(is.null(condition$cppstack)) -expect_identical(condition$call, quote(takeLog(-1L))) +#expect_identical(condition$call, quote(takeLog(-1L))) #test.rcppException <- function() { @@ -58,7 +58,7 @@ expect_true(!is.null(condition$cppstack)) expect_identical(class(condition$cppstack), "Rcpp_stack_trace") -expect_equal(condition$call, quote(takeLogRcpp(-1L))) +#expect_equal(condition$call, quote(takeLogRcpp(-1L))) #test.rcppStop <- function() { @@ -75,7 +75,7 @@ expect_true(!is.null(condition$cppstack)) expect_identical(class(condition$cppstack), "Rcpp_stack_trace") -expect_equal(condition$call, quote(takeLogStop(-1L))) +#expect_equal(condition$call, quote(takeLogStop(-1L))) #test.rcppExceptionLocation <- function() { @@ -95,7 +95,7 @@ expect_identical(class(condition$cppstack), "Rcpp_stack_trace") #expect_identical(condition$cppstack$file, "exceptions.cpp") #expect_identical(condition$cppstack$line, 44L) -expect_equal(condition$call, quote(takeLogRcppLocation(-1L))) +#expect_equal(condition$call, quote(takeLogRcppLocation(-1L))) #test.rcppExceptionLocation <- function() { @@ -109,7 +109,7 @@ nested <- tryCatch(f1(-1), error = identity) ## Message the same expect_identical(normal$message, nested$message) -expect_equal(nested$call, quote(takeLogNested(x))) +#expect_equal(nested$call, quote(takeLogNested(x))) #test.rcppExceptionNoCall <- function() { diff --git a/inst/tinytest/test_interface.R b/inst/tinytest/test_interface.R index 5c7afb15f..22536db58 100644 --- a/inst/tinytest/test_interface.R +++ b/inst/tinytest/test_interface.R @@ -1,5 +1,5 @@ -## Copyright (C) 2018 - 2019 RStudio +## Copyright (C) 2018 - 2022 RStudio ## ## This file is part of Rcpp. ## @@ -64,9 +64,8 @@ on.exit(Sys.setenv(R_LIBS = old_libs_envvar), add = TRUE) sys_sep <- if (.Platform$OS.type == "windows") ";" else ":" Sys.setenv(R_LIBS = paste(c(lib_path, old_lib_paths), collapse = sys_sep)) -cfg <- "#define RCPP_USE_UNWIND_PROTECT" -build_package(exporter_name, lib_path, config = cfg) -build_package(user_name, lib_path, config = cfg) +build_package(exporter_name, lib_path) +build_package(user_name, lib_path) result <- tools::testInstalledPackage(user_name, lib.loc = lib_path, types = "test") @@ -82,7 +81,7 @@ expect_equal(result, 0L) ## Now test client package without protected evaluation unlink(user_name, recursive = TRUE) unlink(paste0(user_name, "-tests"), recursive = TRUE) -build_package(user_name, lib_path, config = character()) +build_package(user_name, lib_path, config = "#define RCPP_NO_UNWIND_PROTECT") result <- tools::testInstalledPackage(user_name, lib.loc = lib_path, types = "test")