Skip to content

Commit 4b4d780

Browse files
authored
Drop support for R 3.6 and remove dead code (#411)
* Drop support for R 3.6 * NEWS bullet * Remove dead code from tests * Remove dead code from `environment.hpp` * Remove dead code from `protect.hpp` * Simplify `altrep.hpp` as much as possible Likely still need to keep it around for compatibility reasons * NEWS bullet about `altrep.hpp` * Bring back dummy `HAS_UNWIND_PROTECT` and remove all usage of it
1 parent dc93fb8 commit 4b4d780

File tree

15 files changed

+22
-103
lines changed

15 files changed

+22
-103
lines changed

.github/workflows/R-CMD-check.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ jobs:
2727
- {os: macos-latest, r: 'release'}
2828

2929
- {os: windows-latest, r: 'release'}
30-
# Use 3.6 to trigger usage of RTools35
31-
- {os: windows-latest, r: '3.6'}
3230
# use 4.1 to check with rtools40's older compiler
3331
- {os: windows-latest, r: '4.1'}
3432

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ License: MIT + file LICENSE
1818
URL: https://cpp11.r-lib.org, https://github.com/r-lib/cpp11
1919
BugReports: https://github.com/r-lib/cpp11/issues
2020
Depends:
21-
R (>= 3.6.0)
21+
R (>= 4.0.0)
2222
Suggests:
2323
bench,
2424
brio,

NEWS.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
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+
7+
* Because cpp11 now requires R >=4.0.0 and ALTREP is always available, the
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).
10+
11+
* cpp11 now requires R >=4.0.0, in line with the
12+
[tidyverse version policy](https://www.tidyverse.org/blog/2019/04/r-version-support/) (#411).
13+
314
# cpp11 0.5.0
415

516
## R non-API related changes

cpp11test/src/safe.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,7 @@
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;

cpp11test/src/test-as.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff 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
}

cpp11test/src/test-doubles.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ context("doubles-C++") {
233233
UNPROTECT(1);
234234
}
235235

236-
#if defined(__APPLE__) && defined(R_VERSION) && R_VERSION >= R_Version(3, 5, 0)
236+
#if defined(__APPLE__)
237237
test_that("writable::doubles(ALTREP_SEXP)") {
238238
// ALTREP compact-seq
239239
auto seq = cpp11::package("base")["seq"];

cpp11test/src/test-integers.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#include "Rversion.h"
21
#include "cpp11/R.hpp"
32
#include "cpp11/doubles.hpp"
43
#include "cpp11/function.hpp"
@@ -218,7 +217,7 @@ context("integers-C++") {
218217
expect_true(x[2] == 3);
219218
}
220219

221-
#if defined(__APPLE__) && defined(R_VERSION) && R_VERSION >= R_Version(3, 5, 0)
220+
#if defined(__APPLE__)
222221
test_that("writable::integers(ALTREP_SEXP)") {
223222
// ALTREP compact-seq
224223
auto seq = cpp11::package("base")["seq"];

cpp11test/src/test-protect-nested.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
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

cpp11test/src/test-protect.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
#include "cpp11/protect.hpp"
33
#include "testthat.h"
44

5-
#ifdef HAS_UNWIND_PROTECT
65
context("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

cpp11test/src/test-r_vector.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,6 @@
77

88
#include <algorithm> // for max_element
99

10-
#ifdef _WIN32
11-
#include "Rversion.h"
12-
#define CPP11_HAS_IS_UTILITIES R_VERSION >= R_Version(4, 0, 0)
13-
#else
14-
#define CPP11_HAS_IS_UTILITIES 1
15-
#endif
16-
17-
#if CPP11_HAS_IS_UTILITIES
1810
context("r_vector-capabilities-C++") {
1911
test_that("read only vector capabilities") {
2012
using cpp11::integers;
@@ -77,7 +69,6 @@ context("r_vector-capabilities-C++") {
7769
expect_true(std::is_move_assignable<integers::proxy>::value);
7870
}
7971
}
80-
#endif
8172

8273
context("r_vector-C++") {
8374
test_that("writable vector temporary isn't leaked (integer) (#338)") {

0 commit comments

Comments
 (0)