File tree Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change 389389 \i tem There are a new functions \c ode{asRboolean} and
390390 \c ode{asBool}, variants of \c ode{asLogical} more suited to
391391 converting logical arguments to \c ode{Rboolean} or to \c ode{bool}.
392+
393+ \i tem Header \f ile{R_exts/Error.h} now ensures that
394+ \c ode{Rf_error} and similar are maeked with the \c ode{noreturn}
395+ attribute from C++ under all compilers.
392396 }
393397 }
394398
Original file line number Diff line number Diff line change 2626#ifndef R_ERROR_H_
2727#define R_ERROR_H_
2828
29- #include <R_ext/Print.h>
29+ #include <R_ext/Print.h> // for R_PRINTF_FORMAT
3030
3131#ifdef __cplusplus
3232extern "C" {
@@ -40,7 +40,7 @@ extern "C" {
4040 */
4141#if defined NORET
4242#elif (defined(__STDC_VERSION__ ) && __STDC_VERSION__ >= 202301L )
43- // gcc 15 and clang 19/20
43+ // gcc 15 and clang 19-
4444# define NORET [[noreturn]]
4545#elif defined(__STDC_VERSION__ ) && __STDC_VERSION__ >= 201102L
4646# define NORET _Noreturn
@@ -52,10 +52,19 @@ extern "C" {
5252# define NORET
5353#endif
5454
55+ #ifdef __cplusplus
56+ // Only supported in C++ >= 11, but that is all current R supports
57+ // Defining NORET caused conflict in many C++-using packages
58+ [[noreturn ]] void Rf_error (const char * , ...) R_PRINTF_FORMAT (1 , 2 );
59+
60+ [[noreturn ]] void UNIMPLEMENTED (const char * );
61+ [[noreturn ]] void WrongArgCount (const char * );
62+ #else
5563NORET void Rf_error (const char * , ...) R_PRINTF_FORMAT (1 , 2 );
5664
5765NORET void UNIMPLEMENTED (const char * );
5866NORET void WrongArgCount (const char * );
67+ #endif
5968
6069void Rf_warning (const char * , ...) R_PRINTF_FORMAT (1 ,2 );
6170
You can’t perform that action at this time.
0 commit comments