3333#endif
3434
3535#include <R_ext/Print.h>
36- #include <Rconfig.h> /* for HAVE_F77_UNDERSCORE */
3736
3837#ifdef __cplusplus
3938extern "C" {
4039#endif
4140
42- /* C23 has a [[noreturn]] attribute supported in LLVM clang 15 with
43- * -std=c2x but not Apple clang 14. That and GCC verisions 12-14 have
44- * version 202000L.
45- * clang 19/20 have version 202301L (and support -std=gnu23).
46- * gcc pre-15 supports -std=gnu23 with version 202301L
47- *
48- * https://en.cppreference.com/w/c/compiler_support/23
49- * claims GCC 13 and LLVM clang 15 support [[noreturn]] ....
50- *
51- * In C11 there is _Noreturn * (or noreturn in header <stdnoreturn.h>).
52- */
53-
5441/*
5542 * As this is sometimes an attribute, it should precede 'static' in a
5643 * function declaration.
@@ -59,15 +46,15 @@ extern "C" {
5946 */
6047#if defined NORET
6148#elif (defined(__STDC_VERSION__ ) && __STDC_VERSION__ >= 202301L )
49+ // gcc 15 and clang 19/20
6250# define NORET [[noreturn]]
6351#elif defined(__STDC_VERSION__ ) && __STDC_VERSION__ >= 201102L
6452# define NORET _Noreturn
6553#elif defined(__GNUC__ ) && __GNUC__ >= 3
66- // LLVM and Apple clang identify themselves as 4.
67- // But Mandriva (or OpenMandriva) is said to patch clang to 11.
68- // Boost also uses this for __SUNPRO_CC >= 0x590
54+ // All platforms these days should be using C >= 11 but perhaps used for C++
6955# define NORET __attribute__((noreturn))
7056#else
57+ // C++ and legacy
7158# define NORET
7259#endif
7360
@@ -80,30 +67,11 @@ void Rf_warning(const char *, ...) R_PRINTF_FORMAT(1,2);
8067
8168void R_ShowMessage (const char * s );
8269
83- #if 0
8470/* xerbla is a a C function intended to be called from Fortran.
71+ * which forerly had a C declaration here.
72+ *
8573 * It wraps Rf_error, so use that directtly from C/C++
8674*/
87- #ifdef HAVE_F77_UNDERSCORE
88- /* F77_NAME is in RS.h, but better not include it here (e.g. due to
89- * previous name conflicts involving symbols defined with !STRICT_R_HEADERS) .
90- * However, using a trailing underline is not universal, and print.c
91- * uses F77_SUB.
92- */
93- # ifdef FC_LEN_T
94- NORET void xerbla_ (const char * srname , int * info , const FC_LEN_T srname_len );
95- # else
96- NORET void xerbla_ (const char * srname , int * info );
97- # endif
98- #else
99- # ifdef FC_LEN_T
100- NORET void xerbla (const char * srname , int * info , const FC_LEN_T srname_len );
101- # else
102- NORET void xerbla (const char * srname , int * info );
103- # endif
104- #endif
105-
106- #endif
10775
10876#ifdef __cplusplus
10977}
0 commit comments