[glib/ci-update: 3/11] Add a version check for duplicated-branches warning



commit 6cb6b418bf0935cdd40bbc283653440abae356b6
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Mon Apr 29 16:49:36 2019 +0100

    Add a version check for duplicated-branches warning
    
    The GHashTable code ignores the duplicated-branches GCC warning, but we
    need to do a compiler and version check, as either non-GCC compatible
    compilers, or older versions of GCC will warn about the unknown pragma
    or diagnostic.
    
    If we don't do this while turning warnings into error, we're going to
    fail the build unnecessarily.

 glib/ghash.c | 2 ++
 1 file changed, 2 insertions(+)
---
diff --git a/glib/ghash.c b/glib/ghash.c
index 42e2857d5..48696e3b0 100644
--- a/glib/ghash.c
+++ b/glib/ghash.c
@@ -56,7 +56,9 @@
  *
  * ...and still compile successfully when -Werror=duplicated-branches is passed. */
 
+#if defined(__GNUC__) && __GNUC__ > 6
 #pragma GCC diagnostic ignored "-Wduplicated-branches"
+#endif
 
 /**
  * SECTION:hash_tables


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