Skip to content

Commit ed8e1da

Browse files
authored
Restore CPP11_UNWIND for backwards compatibility (#415)
* Restore `CPP11_UNWIND` for textshaping r-lib/textshaping#47 * Update some links * Collapse the NEWS bullet
1 parent 84cf6bc commit ed8e1da

File tree

4 files changed

+19
-10
lines changed

4 files changed

+19
-10
lines changed

NEWS.md

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,18 @@
66
have not already been defined elsewhere. This is motivated by the fact that
77
`R_NO_REMAP` is becoming the default for C++ code in R 4.5.0 (#410).
88

9-
* Because cpp11 now requires R >=4.0.0 and `R_UnwindProtect()` is always
10-
available, `HAS_UNWIND_PROTECT` is no longer useful. Please avoid using it,
11-
as we'd like to remove it in the future (#411).
12-
13-
* Because cpp11 now requires R >=4.0.0 and ALTREP is always available, the
14-
`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
15-
future (#411).
9+
* Because cpp11 now requires R >=4.0.0, a number of previously optional tools
10+
are now always available, allowing us to remove some dead code. In
11+
particular:
12+
13+
* `R_UnwindProtect()` is always available, so the defines `HAS_UNWIND_PROTECT`
14+
and `CPP11_UNWIND` are no longer useful.
15+
16+
* ALTREP is always available, so the file `cpp11/altrep.hpp` and the define
17+
`HAS_ALTREP` are no longer useful.
18+
19+
We would like to remove the dead code regarding these tools in the future, so
20+
we ask that you please remove usage of them from your own packages (#411).
1621

1722
* cpp11 now requires R >=4.0.0, in line with the
1823
[tidyverse version policy](https://www.tidyverse.org/blog/2019/04/r-version-support/) (#411).

inst/include/cpp11/altrep.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22

33
// It would be nice to remove this since all supported versions of R have ALTREP, but
44
// some groups rely on both this `#define` and `altrep.hpp` itself existing, like arrow:
5-
// https://github.com/apache/arrow/blob/50f2d6e04e8323119d4dd31506827ee398d6b8e4/r/src/altrep.cpp#L27-L29
5+
// https://github.com/r-lib/cpp11/issues/413
66
#define HAS_ALTREP

inst/include/cpp11/declarations.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ T& unmove(T&& t) {
3030
}
3131
} // namespace cpp11
3232

33+
// We would like to remove this, since all supported versions of R now support proper
34+
// unwind protect, but some groups rely on it existing, like textshaping:
35+
// https://github.com/r-lib/cpp11/issues/414
36+
#define CPP11_UNWIND R_ContinueUnwind(err);
37+
3338
#define CPP11_ERROR_BUFSIZE 8192
3439

3540
#define BEGIN_CPP11 \

inst/include/cpp11/protect.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@
1616

1717
// We would like to remove this, since all supported versions of R now support proper
1818
// 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
19+
// https://github.com/r-lib/cpp11/issues/412
2120
#define HAS_UNWIND_PROTECT
2221

2322
#ifdef CPP11_USE_FMT

0 commit comments

Comments
 (0)