Only use #pragma GCC diagnostic on GCC >= 4.6
authorDavid Zeuthen <zeuthen@gmail.com>
Sat, 13 Oct 2012 09:58:48 +0000 (05:58 -0400)
committerDavid Zeuthen <zeuthen@gmail.com>
Sat, 13 Oct 2012 09:58:48 +0000 (05:58 -0400)
https://bugs.freedesktop.org/show_bug.cgi?id=52614

Signed-off-by: David Zeuthen <zeuthen@gmail.com>
udisks/udisksclient.c

index 22c20b8..4a5a4b0 100644 (file)
 #include "udiskserror.h"
 #include "udisks-generated.h"
 
+/* For __GNUC_PREREQ usage below */
+#ifdef __GNUC__
+# include <features.h>
+#endif
+
 /**
  * SECTION:udisksclient
  * @title: UDisksClient
@@ -1922,14 +1927,22 @@ udisks_client_get_id_for_display (UDisksClient *client,
                    (g_strcmp0 (id_type[n].version, "*") == 0 && strlen (version) > 0))
             {
               /* we know better than the compiler here */
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wformat-nonliteral"
+#ifdef __GNUC_PREREQ
+# if __GNUC_PREREQ(4,6)
+#  pragma GCC diagnostic push
+#  pragma GCC diagnostic ignored "-Wformat-nonliteral"
+# endif
+#endif
               if (long_string)
                 ret = g_strdup_printf (g_dpgettext2 (GETTEXT_PACKAGE, "fs-type", id_type[n].long_name), version);
               else
                 ret = g_strdup_printf (g_dpgettext2 (GETTEXT_PACKAGE, "fs-type", id_type[n].short_name), version);
               goto out;
-#pragma GCC diagnostic pop
+#ifdef __GNUC_PREREQ
+# if __GNUC_PREREQ(4,6)
+#  pragma GCC diagnostic pop
+# endif
+#endif
             }
         }
     }