From: Christian Lamparter Date: Thu, 20 Dec 2018 17:07:40 +0000 (+0100) Subject: elfutils: fix gcc 8.0+ multistatement macros warning/error X-Git-Tag: v19.07.0-rc1~1794 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=a8bae35914f12383ab60b43e8114bdba7fc355b9;p=oweals%2Fopenwrt.git elfutils: fix gcc 8.0+ multistatement macros warning/error GCC 8.0+ introduces a new warning about unsafe macros expanding to multiple statements used as a body of a statement such as if, else, while, switch, or for. In combination with -Werror this can cause the compilation to fail: |In file included from xmalloc.c:37: |xmalloc.c: In function 'xmalloc': |system.h:39:2: error: macro expands to multiple statements [-Werror=multistatement-macros] | fflush(stdout); \ | ^~~~~~ |xmalloc.c:52:5: note: in expansion of macro 'error' | error (EXIT_FAILURE, 0, _("memory exhausted")); | ^~~~~ |xmalloc.c:51:3: note: some parts of macro expansion are not guarded by this 'if' clause | if (p == NULL) | ^~ Signed-off-by: Christian Lamparter --- diff --git a/package/libs/elfutils/patches/100-musl-compat.patch b/package/libs/elfutils/patches/100-musl-compat.patch index f8e9a29235..9631ce05d6 100644 --- a/package/libs/elfutils/patches/100-musl-compat.patch +++ b/package/libs/elfutils/patches/100-musl-compat.patch @@ -2,7 +2,7 @@ https://sourceware.org/bugzilla/show_bug.cgi?id=21002 --- a/lib/system.h +++ b/lib/system.h -@@ -30,7 +30,16 @@ +@@ -30,7 +30,18 @@ #define LIB_SYSTEM_H 1 #include @@ -12,15 +12,17 @@ https://sourceware.org/bugzilla/show_bug.cgi?id=21002 +#else +#include "err.h" +#include -+#define error(status, errno, ...) \ -+ fflush(stdout); \ -+ warn(__VA_ARGS__); \ -+ if (status) exit(status) ++#define error(status, errno, ...) \ ++ do { \ ++ fflush(stdout); \ ++ warn(__VA_ARGS__); \ ++ if (status) exit(status); \ ++ } while(0) +#endif #include #include #include -@@ -38,6 +47,10 @@ +@@ -38,6 +49,10 @@ #include #include