File tree Expand file tree Collapse file tree 7 files changed +13
-21
lines changed
Expand file tree Collapse file tree 7 files changed +13
-21
lines changed Original file line number Diff line number Diff line change 11# cpp11 (development version)
22
3+ * Because cpp11 now requires R >=4.0.0 and ` R_UnwindProtect() ` is always
4+ available, ` HAS_UNWIND_PROTECT ` is no longer useful. Please avoid using it,
5+ as we'd like to remove it in the future (#411 ).
6+
37* Because cpp11 now requires R >=4.0.0 and ALTREP is always available, the
4- ` cpp11/altrep.hpp ` file is no longer useful. Please avoid using ` #include "cpp11/altrep.hpp" ` as we'd like to remove this file in the future (#411 ).
8+ ` cpp11/altrep.hpp ` file is no longer useful. Please avoid using ` #include "cpp11/altrep.hpp" ` and ` HAS_ALTREP ` as we'd like to remove them in the
9+ future (#411 ).
510
611* cpp11 now requires R >=4.0.0, in line with the
712 [ tidyverse version policy] ( https://www.tidyverse.org/blog/2019/04/r-version-support/ ) (#411 ).
Original file line number Diff line number Diff line change 2626 if (buf[0 ] != ' \0 ' ) {
2727 Rf_error (" %s" , buf);
2828 } else if (err != R_NilValue) {
29- #ifdef HAS_UNWIND_PROTECT
3029 R_ContinueUnwind (err);
31- #endif
3230 }
3331
3432 return R_NilValue;
Original file line number Diff line number Diff line change @@ -49,11 +49,9 @@ context("as_cpp-C++") {
4949 auto x5 = cpp11::as_cpp<unsigned long >(r);
5050 expect_true (x5 == 42UL );
5151
52- #ifdef HAS_UNWIND_PROTECT
5352 /* throws a runtime exception if the value is not a integerish one */
5453 REAL (r)[0 ] = 42.5 ;
5554 expect_error (cpp11::as_cpp<int >(r));
56- #endif
5755
5856 UNPROTECT (1 );
5957 }
Original file line number Diff line number Diff line change 22#include " cpp11/protect.hpp"
33#include " testthat.h"
44
5- #ifdef HAS_UNWIND_PROTECT
6-
75/*
86 * See https://github.com/r-lib/cpp11/pull/327 for full details.
97 *
@@ -77,5 +75,3 @@ context("unwind_protect-nested-C++") {
7775 destructed = false ;
7876 }
7977}
80-
81- #endif
Original file line number Diff line number Diff line change 22#include " cpp11/protect.hpp"
33#include " testthat.h"
44
5- #ifdef HAS_UNWIND_PROTECT
65context (" unwind_protect-C++" ) {
76 test_that (" unwind_protect works if there is no error" ) {
87 SEXP out = PROTECT (cpp11::unwind_protect ([&] {
@@ -49,5 +48,3 @@ context("unwind_protect-C++") {
4948 expect_error_as (cpp11::safe[Rf_allocVector](REALSXP, -1 ), cpp11::unwind_exception);
5049 }
5150}
52-
53- #endif
Original file line number Diff line number Diff line change @@ -30,14 +30,6 @@ T& unmove(T&& t) {
3030}
3131} // namespace cpp11
3232
33- #ifdef HAS_UNWIND_PROTECT
34- #define CPP11_UNWIND R_ContinueUnwind (err);
35- #else
36- #define CPP11_UNWIND \
37- do { \
38- } while (false );
39- #endif
40-
4133#define CPP11_ERROR_BUFSIZE 8192
4234
4335#define BEGIN_CPP11 \
@@ -58,6 +50,6 @@ T& unmove(T&& t) {
5850 if (buf[0 ] != ' \0 ' ) { \
5951 Rf_errorcall (R_NilValue, " %s" , buf); \
6052 } else if (err != R_NilValue) { \
61- CPP11_UNWIND \
53+ R_ContinueUnwind (err); \
6254 } \
6355 return R_NilValue;
Original file line number Diff line number Diff line change 1414#include " R_ext/Print.h" // for REprintf
1515#include " R_ext/Utils.h" // for R_CheckUserInterrupt
1616
17+ // We would like to remove this, since all supported versions of R now support proper
18+ // unwind protect, but some groups rely on it existing, like arrow and systemfonts
19+ // https://github.com/r-lib/systemfonts/blob/02b567086379edaca1a9b3620ad6776e6bb876a7/src/utils.h#L11
20+ // https://github.com/apache/arrow/blob/50f2d6e04e8323119d4dd31506827ee398d6b8e4/r/src/safe-call-into-r-impl.cpp#L49
21+ #define HAS_UNWIND_PROTECT
22+
1723#ifdef CPP11_USE_FMT
1824#define FMT_HEADER_ONLY
1925#include " fmt/core.h"
You can’t perform that action at this time.
0 commit comments