diff --git a/lib/config.h b/lib/config.h index 3ecff1c10..6cb34b5e4 100644 --- a/lib/config.h +++ b/lib/config.h @@ -51,14 +51,21 @@ #endif // C++11 noreturn -#if (defined(__GNUC__) && (__GNUC__ >= 5)) \ +#if defined __has_cpp_attribute +# if __has_cpp_attribute (noreturn) +# define NORETURN [[noreturn]] +# endif +#endif +#if !defined(NORETURN) +# if (defined(__GNUC__) && (__GNUC__ >= 5)) \ || defined(__clang__) \ || defined(__CPPCHECK__) -# define NORETURN [[noreturn]] -#elif defined(__GNUC__) -# define NORETURN __attribute__((noreturn)) -#else -# define NORETURN +# define NORETURN [[noreturn]] +# elif defined(__GNUC__) +# define NORETURN __attribute__((noreturn)) +# else +# define NORETURN +# endif #endif // fallthrough