Merge branch 'gnuc_macro_updates' into 'master'

gmacros: use G_GNUC_CHECK_VERSION

Closes #2389

See merge request GNOME/glib!2073
This commit is contained in:
Philip Withnall 2021-04-29 12:48:50 +00:00
commit f4f9ce7bde
3 changed files with 7 additions and 6 deletions

View File

@ -22,6 +22,7 @@
#include "gbitlock.h" #include "gbitlock.h"
#include <glib/gmacros.h>
#include <glib/gmessages.h> #include <glib/gmessages.h>
#include <glib/gatomic.h> #include <glib/gatomic.h>
#include <glib/gslist.h> #include <glib/gslist.h>
@ -179,7 +180,7 @@ g_futex_wake (const volatile gint *address)
static volatile gint g_bit_lock_contended[CONTENTION_CLASSES]; static volatile gint g_bit_lock_contended[CONTENTION_CLASSES];
#if (defined (i386) || defined (__amd64__)) #if (defined (i386) || defined (__amd64__))
#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5) #if G_GNUC_CHECK_VERSION(4, 5)
#define USE_ASM_GOTO 1 #define USE_ASM_GOTO 1
#endif #endif
#endif #endif

View File

@ -728,7 +728,7 @@ test_64bit (void)
/* However, gcc doesn't know about this, so we need to disable printf /* However, gcc doesn't know about this, so we need to disable printf
* format warnings... * format warnings...
*/ */
#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6) #if G_GNUC_CHECK_VERSION(4, 6)
_Pragma ("GCC diagnostic push") _Pragma ("GCC diagnostic push")
_Pragma ("GCC diagnostic ignored \"-Wformat\"") _Pragma ("GCC diagnostic ignored \"-Wformat\"")
_Pragma ("GCC diagnostic ignored \"-Wformat-extra-args\"") _Pragma ("GCC diagnostic ignored \"-Wformat-extra-args\"")
@ -766,7 +766,7 @@ _Pragma ("GCC diagnostic ignored \"-Wformat-extra-args\"")
g_assert_cmpint (res, ==, 5); g_assert_cmpint (res, ==, 5);
g_assert_cmpstr (buf, ==, "1E240"); g_assert_cmpstr (buf, ==, "1E240");
#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6) #if G_GNUC_CHECK_VERSION(4, 6)
_Pragma ("GCC diagnostic pop") _Pragma ("GCC diagnostic pop")
#endif #endif
@ -819,7 +819,7 @@ test_64bit2_win32 (void)
/* However, gcc doesn't know about this, so we need to disable printf /* However, gcc doesn't know about this, so we need to disable printf
* format warnings... * format warnings...
*/ */
#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6) #if G_GNUC_CHECK_VERSION(4, 6)
_Pragma ("GCC diagnostic push") _Pragma ("GCC diagnostic push")
_Pragma ("GCC diagnostic ignored \"-Wformat\"") _Pragma ("GCC diagnostic ignored \"-Wformat\"")
_Pragma ("GCC diagnostic ignored \"-Wformat-extra-args\"") _Pragma ("GCC diagnostic ignored \"-Wformat-extra-args\"")
@ -849,7 +849,7 @@ _Pragma ("GCC diagnostic ignored \"-Wformat-extra-args\"")
res = g_printf ("%" "ll" "X\n", (gint64)123456); res = g_printf ("%" "ll" "X\n", (gint64)123456);
g_assert_cmpint (res, ==, 6); g_assert_cmpint (res, ==, 6);
#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6) #if G_GNUC_CHECK_VERSION(4, 6)
_Pragma ("GCC diagnostic pop") _Pragma ("GCC diagnostic pop")
#endif #endif
} }

View File

@ -2108,7 +2108,7 @@ type_name##_get_type (void) \
/* Only use this in non-C++ on GCC >= 2.7, except for Darwin/ppc64. /* Only use this in non-C++ on GCC >= 2.7, except for Darwin/ppc64.
* See https://bugzilla.gnome.org/show_bug.cgi?id=647145 * See https://bugzilla.gnome.org/show_bug.cgi?id=647145
*/ */
#if !defined (__cplusplus) && (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)) && !(defined (__APPLE__) && defined (__ppc64__)) #if !defined (__cplusplus) && (G_GNUC_CHECK_VERSION(2, 7)) && !(defined (__APPLE__) && defined (__ppc64__))
#define _G_DEFINE_BOXED_TYPE_BEGIN(TypeName, type_name, copy_func, free_func) \ #define _G_DEFINE_BOXED_TYPE_BEGIN(TypeName, type_name, copy_func, free_func) \
static GType type_name##_get_type_once (void); \ static GType type_name##_get_type_once (void); \
\ \