[glib: 2/3] gmacros.h: raise minimum GCC version for attribute __noreturn__




commit 56be1f8d820918765d1844f0c14578d23077ed04
Author: Aleksandr Mezin <mezin alexander gmail com>
Date:   Fri Apr 16 14:51:41 2021 +0600

    gmacros.h: raise minimum GCC version for attribute __noreturn__
    
    `#define G_GNUC_NORETURN __attribute__((__noreturn__))` was previously under
    `#if G_GNUC_CHECK_VERSION(2, 4)`.
    
    But `# define G_NORETURN __attribute__ ((__noreturn__))` was under
    `#if G_GNUC_CHECK_VERSION(2, 8) || (0x5110 <= __SUNPRO_C)`.
    
    Take the latter for `g_macro__has_attribute(__noreturn__)` fallback. This will
    disable `G_GNUC_NORETURN` for GCC 2.4-2.7 though.

 glib/gmacros.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/glib/gmacros.h b/glib/gmacros.h
index 1c2dd6897..e2f49e381 100644
--- a/glib/gmacros.h
+++ b/glib/gmacros.h
@@ -134,7 +134,7 @@
 #define g_macro__has_attribute___alloc_size__ G_GNUC_CHECK_VERSION (4, 3)
 #define g_macro__has_attribute___format__ G_GNUC_CHECK_VERSION (2, 4)
 #define g_macro__has_attribute___format_arg__ G_GNUC_CHECK_VERSION (2, 4)
-#define g_macro__has_attribute___noreturn__ G_GNUC_CHECK_VERSION (2, 4)
+#define g_macro__has_attribute___noreturn__ (G_GNUC_CHECK_VERSION (2, 8) || (0x5110 <= __SUNPRO_C))
 #define g_macro__has_attribute___const__ G_GNUC_CHECK_VERSION (2, 4)
 #define g_macro__has_attribute___unused__ G_GNUC_CHECK_VERSION (2, 4)
 #define g_macro__has_attribute___no_instrument_function__ G_GNUC_CHECK_VERSION (2, 4)
@@ -1040,7 +1040,7 @@
  * 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_GNUC_CHECK_VERSION(2, 8) || (0x5110 <= __SUNPRO_C)
+#if g_macro__has_attribute(__noreturn__)
   /* For compatibility with G_NORETURN_FUNCPTR on clang, use
      __attribute__((__noreturn__)), not _Noreturn.  */
 # define G_NORETURN __attribute__ ((__noreturn__))
@@ -1079,7 +1079,7 @@
  *
  * Since: 2.68
  */
-#if G_GNUC_CHECK_VERSION(2, 8) || (0x5110 <= __SUNPRO_C)
+#if g_macro__has_attribute(__noreturn__)
 # define G_NORETURN_FUNCPTR __attribute__ ((__noreturn__))      \
   GLIB_AVAILABLE_MACRO_IN_2_68
 #else


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]