Skip to content

Commit

Permalink
Protection
Browse files Browse the repository at this point in the history
r-lib/cpp11#422

This reverts commit 1e181e5e5c2cf0a21906b49dafe80364c8ca3f2b.
  • Loading branch information
krlmlr committed Dec 7, 2024
1 parent aa3225d commit 4f4a3a8
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions inst/include/cpp11/protect.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,14 +203,10 @@ void stop [[noreturn]] (const std::string& fmt_arg, Args&&... args) {
safe.noreturn(Rf_errorcall)(R_NilValue, "%s", msg.c_str());
}

template <typename... Args>
void warning(const char* fmt_arg, Args&&... args) {
std::string msg = fmt::format(fmt_arg, std::forward<Args>(args)...);
safe[Rf_warningcall](R_NilValue, "%s", msg.c_str());
}
// Always making copy of string to avoid weird unwind behavior.

template <typename... Args>
void warning(const std::string& fmt_arg, Args&&... args) {
void warning(const std::string fmt_arg, Args&&... args) {
std::string msg = fmt::format(fmt_arg, std::forward<Args>(args)...);
safe[Rf_warningcall](R_NilValue, "%s", msg.c_str());
}
Expand All @@ -225,13 +221,10 @@ void stop [[noreturn]] (const std::string& fmt, Args... args) {
safe.noreturn(Rf_errorcall)(R_NilValue, fmt.c_str(), args...);
}

template <typename... Args>
void warning(const char* fmt, Args... args) {
safe[Rf_warningcall](R_NilValue, fmt, args...);
}
// Always making copy of string to avoid weird unwind behavior.

template <typename... Args>
void warning(const std::string& fmt, Args... args) {
void warning(const std::string fmt, Args... args) {
safe[Rf_warningcall](R_NilValue, fmt.c_str(), args...);
}
#endif
Expand Down

0 comments on commit 4f4a3a8

Please sign in to comment.