diff --git a/glib/gmacros.h b/glib/gmacros.h index 0ca9a70d0..7355a0d0c 100644 --- a/glib/gmacros.h +++ b/glib/gmacros.h @@ -1053,16 +1053,16 @@ * evaluated when a header is included. This results in warnings in third party * code which includes glib.h, even if the third party code doesn’t use the new * macro itself. */ -#if g_macro__has_attribute(__noreturn__) +#if G_CXX_STD_CHECK_VERSION (11) + /* Use ISO C++11 syntax when the compiler supports it. */ +# define G_NORETURN [[noreturn]] +#elif g_macro__has_attribute(__noreturn__) /* For compatibility with G_NORETURN_FUNCPTR on clang, use __attribute__((__noreturn__)), not _Noreturn. */ # define G_NORETURN __attribute__ ((__noreturn__)) #elif defined (_MSC_VER) && (1200 <= _MSC_VER) /* Use MSVC specific syntax. */ # define G_NORETURN __declspec (noreturn) - /* Use ISO C++11 syntax when the compiler supports it. */ -#elif G_CXX_STD_CHECK_VERSION (11) -# define G_NORETURN [[noreturn]] /* Use ISO C11 syntax when the compiler supports it. */ #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112 # define G_NORETURN _Noreturn diff --git a/glib/gmessages.h b/glib/gmessages.h index 119b72e91..eab6d0678 100644 --- a/glib/gmessages.h +++ b/glib/gmessages.h @@ -291,8 +291,8 @@ void g_warn_message (const char *domain, int line, const char *func, const char *warnexpr) G_ANALYZER_NORETURN; -GLIB_DEPRECATED G_NORETURN +GLIB_DEPRECATED void g_assert_warning (const char *log_domain, const char *file, const int line, @@ -409,7 +409,7 @@ void g_log_structured_standard (const gchar *log_domain, format) #endif #else /* no varargs macros */ -static G_NORETURN void g_error (const gchar *format, ...) G_ANALYZER_NORETURN; +G_NORETURN static void g_error (const gchar *format, ...) G_ANALYZER_NORETURN; static void g_critical (const gchar *format, ...) G_ANALYZER_NORETURN; static inline void diff --git a/glib/gtestutils.h b/glib/gtestutils.h index bc404d96d..5db453a70 100644 --- a/glib/gtestutils.h +++ b/glib/gtestutils.h @@ -541,8 +541,8 @@ void g_assertion_message (const char *domain, int line, const char *func, const char *message) G_ANALYZER_NORETURN; -GLIB_AVAILABLE_IN_ALL G_NORETURN +GLIB_AVAILABLE_IN_ALL void g_assertion_message_expr (const char *domain, const char *file, int line, diff --git a/glib/gutils.h b/glib/gutils.h index 36e2b50f5..efc691449 100644 --- a/glib/gutils.h +++ b/glib/gutils.h @@ -426,8 +426,7 @@ g_bit_storage_impl (gulong number) # include # define g_abort() abort () #else -GLIB_AVAILABLE_IN_2_50 -G_NORETURN void g_abort (void) G_ANALYZER_NORETURN; +G_NORETURN GLIB_AVAILABLE_IN_2_50 void g_abort (void) G_ANALYZER_NORETURN; #endif #endif