Skip to content

Commit

Permalink
tools include linux: Guard against redefinition of some macros
Browse files Browse the repository at this point in the history
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 <[email protected]>
Cc: Jiri Olsa <[email protected]>
Cc: Namhyung Kim <[email protected]>
Cc: Wang Nan <[email protected]>
Link: http://lkml.kernel.org/n/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
  • Loading branch information
acmel committed Sep 12, 2017
1 parent 770e961 commit 259d407
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions tools/include/linux/compiler-gcc.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,14 @@
#define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))

#define noinline __attribute__((noinline))

#ifndef __packed
#define __packed __attribute__((packed))

#endif
#ifndef __noreturn
#define __noreturn __attribute__((noreturn))

#endif
#ifndef __aligned
#define __aligned(x) __attribute__((aligned(x)))
#endif
#define __printf(a, b) __attribute__((format(printf, a, b)))
#define __scanf(a, b) __attribute__((format(scanf, a, b)))

0 comments on commit 259d407

Please sign in to comment.