Skip to content

Commit b81cd3d

Browse files
committed
Remove dead code from protect.hpp
1 parent 6bf94dd commit b81cd3d

File tree

1 file changed

+0
-16
lines changed

1 file changed

+0
-16
lines changed

inst/include/cpp11/protect.hpp

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,6 @@
1313
#include "R_ext/Error.h" // for Rf_error, Rf_warning
1414
#include "R_ext/Print.h" // for REprintf
1515
#include "R_ext/Utils.h" // for R_CheckUserInterrupt
16-
#include "Rversion.h" // for R_VERSION, R_Version
17-
18-
#if defined(R_VERSION) && R_VERSION >= R_Version(3, 5, 0)
19-
#define HAS_UNWIND_PROTECT
20-
#endif
2116

2217
#ifdef CPP11_USE_FMT
2318
#define FMT_HEADER_ONLY
@@ -31,8 +26,6 @@ class unwind_exception : public std::exception {
3126
unwind_exception(SEXP token_) : token(token_) {}
3227
};
3328

34-
#ifdef HAS_UNWIND_PROTECT
35-
3629
/// Unwind Protection from C longjmp's, like those used in R error handling
3730
///
3831
/// @param code The code to which needs to be protected, as a nullary callable
@@ -95,15 +88,6 @@ unwind_protect(Fun&& code) {
9588
return out;
9689
}
9790

98-
#else
99-
// Don't do anything if we don't have unwind protect. This will leak C++ resources,
100-
// including those held by cpp11 objects, but the other alternatives are also not great.
101-
template <typename Fun>
102-
decltype(std::declval<Fun&&>()()) unwind_protect(Fun&& code) {
103-
return std::forward<Fun>(code)();
104-
}
105-
#endif
106-
10791
namespace detail {
10892

10993
template <size_t...>

0 commit comments

Comments
 (0)