tools include linux: Guard against redefinition of some macros
authorArnaldo Carvalho de Melo <>
Tue, 5 Sep 2017 13:52:02 +0000 (10:52 -0300)
committerArnaldo Carvalho de Melo <>
Tue, 12 Sep 2017 15:33:39 +0000 (12:33 -0300)
When cross building to android r15c (and older versions) on Fedora 26
we notice these:

/opt/android-ndk-r15c/platforms/android-24/arch-arm/usr/include/sys/cdefs.h:332:0: note: this is the location of the previous definition

For __aligned, __packed and __noreturn, so guard those with ifdefs to
avoid drowning useful warnings in these.

Cc: Adrian Hunter <>
Cc: Jiri Olsa <>
Cc: Namhyung Kim <>
Cc: Wang Nan <>
Signed-off-by: Arnaldo Carvalho de Melo <>

index bd39b2090ad1ba226112fcd74bf46ca15406912a..3723b9f8f964365d768ea163c0b3ea87e9be69ca 100644 (file)
 #define __must_be_array(a)     BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
 #define  noinline      __attribute__((noinline))
+#ifndef __packed
 #define __packed       __attribute__((packed))
+#ifndef __noreturn
 #define __noreturn     __attribute__((noreturn))
+#ifndef __aligned
 #define __aligned(x)   __attribute__((aligned(x)))
 #define __printf(a, b) __attribute__((format(printf, a, b)))
 #define __scanf(a, b)  __attribute__((format(scanf, a, b)))