From f4baccc0fdcf5d3bade057e9af6cd61018b82f80 Mon Sep 17 00:00:00 2001 From: Davis Vaughan Date: Wed, 4 Dec 2024 08:55:50 -0500 Subject: [PATCH 1/3] Restore `CPP11_UNWIND` for textshaping https://github.com/r-lib/textshaping/issues/47 --- inst/include/cpp11/declarations.hpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/inst/include/cpp11/declarations.hpp b/inst/include/cpp11/declarations.hpp index 323f9de5..ed57721f 100644 --- a/inst/include/cpp11/declarations.hpp +++ b/inst/include/cpp11/declarations.hpp @@ -30,6 +30,11 @@ T& unmove(T&& t) { } } // namespace cpp11 +// We would like to remove this, since all supported versions of R now support proper +// unwind protect, but some groups rely on it existing, like textshaping: +// https://github.com/r-lib/cpp11/issues/414 +#define CPP11_UNWIND R_ContinueUnwind(err); + #define CPP11_ERROR_BUFSIZE 8192 #define BEGIN_CPP11 \ From 7e9aff48682c8f03c434515997cc6969d9b3fd8c Mon Sep 17 00:00:00 2001 From: Davis Vaughan Date: Wed, 4 Dec 2024 08:56:01 -0500 Subject: [PATCH 2/3] Update some links --- inst/include/cpp11/altrep.hpp | 2 +- inst/include/cpp11/protect.hpp | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/inst/include/cpp11/altrep.hpp b/inst/include/cpp11/altrep.hpp index a2bf2c65..3405c136 100644 --- a/inst/include/cpp11/altrep.hpp +++ b/inst/include/cpp11/altrep.hpp @@ -2,5 +2,5 @@ // It would be nice to remove this since all supported versions of R have ALTREP, but // some groups rely on both this `#define` and `altrep.hpp` itself existing, like arrow: -// https://github.com/apache/arrow/blob/50f2d6e04e8323119d4dd31506827ee398d6b8e4/r/src/altrep.cpp#L27-L29 +// https://github.com/r-lib/cpp11/issues/413 #define HAS_ALTREP diff --git a/inst/include/cpp11/protect.hpp b/inst/include/cpp11/protect.hpp index d9595edc..9cb4876a 100644 --- a/inst/include/cpp11/protect.hpp +++ b/inst/include/cpp11/protect.hpp @@ -16,8 +16,7 @@ // We would like to remove this, since all supported versions of R now support proper // unwind protect, but some groups rely on it existing, like arrow and systemfonts -// https://github.com/r-lib/systemfonts/blob/02b567086379edaca1a9b3620ad6776e6bb876a7/src/utils.h#L11 -// https://github.com/apache/arrow/blob/50f2d6e04e8323119d4dd31506827ee398d6b8e4/r/src/safe-call-into-r-impl.cpp#L49 +// https://github.com/r-lib/cpp11/issues/412 #define HAS_UNWIND_PROTECT #ifdef CPP11_USE_FMT From 497c62e081da5ee4f087a896d765ab2ea7cda1b2 Mon Sep 17 00:00:00 2001 From: Davis Vaughan Date: Wed, 4 Dec 2024 08:56:14 -0500 Subject: [PATCH 3/3] Collapse the NEWS bullet --- NEWS.md | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/NEWS.md b/NEWS.md index d692aa0d..f489cc97 100644 --- a/NEWS.md +++ b/NEWS.md @@ -6,13 +6,18 @@ have not already been defined elsewhere. This is motivated by the fact that `R_NO_REMAP` is becoming the default for C++ code in R 4.5.0 (#410). -* Because cpp11 now requires R >=4.0.0 and `R_UnwindProtect()` is always - available, `HAS_UNWIND_PROTECT` is no longer useful. Please avoid using it, - as we'd like to remove it in the future (#411). - -* Because cpp11 now requires R >=4.0.0 and ALTREP is always available, the - `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 - future (#411). +* Because cpp11 now requires R >=4.0.0, a number of previously optional tools + are now always available, allowing us to remove some dead code. In + particular: + + * `R_UnwindProtect()` is always available, so the defines `HAS_UNWIND_PROTECT` + and `CPP11_UNWIND` are no longer useful. + + * ALTREP is always available, so the file `cpp11/altrep.hpp` and the define + `HAS_ALTREP` are no longer useful. + + We would like to remove the dead code regarding these tools in the future, so + we ask that you please remove usage of them from your own packages (#411). * cpp11 now requires R >=4.0.0, in line with the [tidyverse version policy](https://www.tidyverse.org/blog/2019/04/r-version-support/) (#411).