From: Eric Le Bihan <eric.le.bihan.dev@free.fr>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH 2/2] eudev: only use pragma diagnostics if GCC supports it.
Date: Wed, 2 Apr 2014 16:42:26 +0200 [thread overview]
Message-ID: <1396449746-12934-3-git-send-email-eric.le.bihan.dev@free.fr> (raw)
In-Reply-To: <1396449746-12934-1-git-send-email-eric.le.bihan.dev@free.fr>
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>
---
...y-use-pragma-for-ignoring-diagnostics-if-.patch | 37 ++++++++++++++++++++
1 file changed, 37 insertions(+)
create mode 100644 package/eudev/eudev-0003-libudev-Only-use-pragma-for-ignoring-diagnostics-if-.patch
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 0000000..8b70fbf
--- /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
+
--
1.7.9.5
next prev parent reply other threads:[~2014-04-02 14:42 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-02 14:42 [Buildroot] [PATCH 0/2] eudev fixes (PowerPC) Eric Le Bihan
2014-04-02 14:42 ` [Buildroot] [PATCH 1/2] eudev: fix redefinition of usec_t and nsec_t Eric Le Bihan
2014-04-02 14:42 ` Eric Le Bihan [this message]
2014-04-03 19:33 ` [Buildroot] [PATCH 0/2] eudev fixes (PowerPC) Thomas Petazzoni
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1396449746-12934-3-git-send-email-eric.le.bihan.dev@free.fr \
--to=eric.le.bihan.dev@free.fr \
--cc=buildroot@busybox.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.