1From dc8aa43b7b6d0cead7d8a0c1a151d289a5233a10 Mon Sep 17 00:00:00 2001
2From: Eric Le Bihan <eric.le.bihan.dev@free.fr>
3Date: Wed, 2 Apr 2014 12:36:52 +0200
4Subject: [PATCH] libudev: Only use #pragma for ignoring diagnostics if GCC
5 version supports it.
6
7[Peter: update for 2.1.1, fix shared_assert issue]
8Signed-off-by: Eric Le Bihan <eric.le.bihan.dev@free.fr>
9---
10 src/shared/macro.h |    8 +++++
11 1 file changed, 8 insertions(+)
12
13diff --git a/src/shared/macro.h b/src/shared/macro.h
14--- a/src/shared/macro.h
15+++ b/src/shared/macro.h
16@@ -38,6 +38,7 @@
17 #define _cleanup_(x) __attribute__((cleanup(x)))
18
19 /* Temporarily disable some warnings */
20+#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
21 #define DISABLE_WARNING_DECLARATION_AFTER_STATEMENT                     \
22         _Pragma("GCC diagnostic push");                                 \
23         _Pragma("GCC diagnostic ignored \"-Wdeclaration-after-statement\"")
24@@ -48,6 +49,13 @@
25
26 #define REENABLE_WARNING                                                \
27         _Pragma("GCC diagnostic pop")
28+#else
29+#define DISABLE_WARNING_DECLARATION_AFTER_STATEMENT
30+#define DISABLE_WARNING_FORMAT_NONLITERAL
31+#define REENABLE_WARNING
32+/* glibc unconditionally defines this, but it needs GCC 4.6+ */
33+#undef static_assert
34+#endif
35
36 #define XCONCATENATE(x, y) x ## y
37 #define CONCATENATE(x, y) XCONCATENATE(x, y)
38--
391.7.9.5
40