Skip to content

Restore CPP11_UNWIND for backwards compatibility #415

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down
2 changes: 1 addition & 1 deletion inst/include/cpp11/altrep.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
5 changes: 5 additions & 0 deletions inst/include/cpp11/declarations.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
3 changes: 1 addition & 2 deletions inst/include/cpp11/protect.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading