summaryrefslogtreecommitdiff
path: root/package/eudev
diff options
context:
space:
mode:
authorEric Le Bihan <eric.le.bihan.dev@free.fr>2014-04-02 16:42:26 +0200
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>2014-04-03 21:33:07 +0200
commitb70dec3fedff9923f443cee2cd70b6f2318e63a2 (patch)
tree5a501c4411b4d5de0043e1528f8afe788d745f19 /package/eudev
parentbd573ccfbd301b58529b3ce1f8c99940eeb45a1f (diff)
eudev: only use pragma diagnostics if GCC supports it.
eudev uses GCC pragma diagnostics [1] for some of its logging functions, to circumvent -Wformat-nonliteral. This feature is only available in GCC >= 4.6. The external toolchains for some architectures (PowerPC, SuperH) are based on GCC 4.5. So eudev will not compile when using them. systemd also uses the pragma diagnostics, but its dependency on Linux headers >= 3.8 for the toolchain indirectly forces recent versions of GCC. This workaround enables the pragma diagnostics only when using GCC >= 4.6. This means that if the user uses GCC 4.5 and explicitly sets the options -Werror -Wformat-nonliteral, the build will fail... [1] http://gcc.gnu.org/onlinedocs/gcc/Diagnostic-Pragmas.html#Diagnostic-Pragmas Signed-off-by: Eric Le Bihan <eric.le.bihan.dev@free.fr> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Diffstat (limited to 'package/eudev')
-rw-r--r--package/eudev/eudev-0003-libudev-Only-use-pragma-for-ignoring-diagnostics-if-.patch37
1 files changed, 37 insertions, 0 deletions
diff --git a/package/eudev/eudev-0003-libudev-Only-use-pragma-for-ignoring-diagnostics-if-.patch b/package/eudev/eudev-0003-libudev-Only-use-pragma-for-ignoring-diagnostics-if-.patch
new file mode 100644
index 000000000..8b70fbf8a
--- /dev/null
+++ b/package/eudev/eudev-0003-libudev-Only-use-pragma-for-ignoring-diagnostics-if-.patch
@@ -0,0 +1,37 @@
+From dc8aa43b7b6d0cead7d8a0c1a151d289a5233a10 Mon Sep 17 00:00:00 2001
+From: Eric Le Bihan <eric.le.bihan.dev@free.fr>
+Date: Wed, 2 Apr 2014 12:36:52 +0200
+Subject: [PATCH] libudev: Only use #pragma for ignoring diagnostics if GCC
+ version supports it.
+
+
+Signed-off-by: Eric Le Bihan <eric.le.bihan.dev@free.fr>
+---
+ src/libudev/macro.h | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/src/libudev/macro.h b/src/libudev/macro.h
+index ac2a23f..fb55983 100644
+--- a/src/libudev/macro.h
++++ b/src/libudev/macro.h
+@@ -40,12 +40,17 @@
+ #define _cleanup_(x) __attribute__((cleanup(x)))
+
+
++#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
+ #define DISABLE_WARNING_FORMAT_NONLITERAL \
+ _Pragma("GCC diagnostic push"); \
+ _Pragma("GCC diagnostic ignored \"-Wformat-nonliteral\"")
+
+ #define REENABLE_WARNING \
+ _Pragma("GCC diagnostic pop")
++#else
++#define DISABLE_WARNING_FORMAT_NONLITERAL
++#define REENABLE_WARNING
++#endif
+
+ /* Rounds up */
+
+--
+1.7.9.5
+