[glib/compiler-define-check] Check if compiler symbols are defined before using them



commit 23d33b763006f2b3ad200f59a104b7269811dfee
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Mon Jun 17 16:39:57 2019 +0100

    Check if compiler symbols are defined before using them
    
    If we don't do this, projects using `-Werror=undef` will break.

 glib/gmacros.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/glib/gmacros.h b/glib/gmacros.h
index a262aaf74..1c8d64699 100644
--- a/glib/gmacros.h
+++ b/glib/gmacros.h
@@ -988,8 +988,8 @@
 #endif
 
 #if !defined(GLIB_DISABLE_DEPRECATION_WARNINGS) && \
-    (__GNUC__ > 6 || (__GNUC__ == 6 && __GNUC_MINOR__ >= 1) || \
-     __clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >= 0))
+    ((defined (__GNUC__) && (__GNUC__ > 6 || (__GNUC__ == 6 && __GNUC_MINOR__ >= 1))) || \
+     (defined (__clang_major__) && (__clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >= 0))))
 #define GLIB_DEPRECATED_ENUMERATOR G_DEPRECATED
 #define GLIB_DEPRECATED_ENUMERATOR_FOR(f) G_DEPRECATED_FOR(f)
 #define GLIB_UNAVAILABLE_ENUMERATOR(maj,min) G_UNAVAILABLE(maj,min)
@@ -1000,8 +1000,8 @@
 #endif
 
 #if !defined(GLIB_DISABLE_DEPRECATION_WARNINGS) && \
-    (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1) || \
-     __clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >= 0))
+    ((defined (__GNUC__) && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))) || \
+     (defined (__clang_major__) && (__clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >= 0))))
 #define GLIB_DEPRECATED_TYPE G_DEPRECATED
 #define GLIB_DEPRECATED_TYPE_FOR(f) G_DEPRECATED_FOR(f)
 #define GLIB_UNAVAILABLE_TYPE(maj,min) G_UNAVAILABLE(maj,min)


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