[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH] xtf: fix cdefs.h conflict with __section

On FreeBSD the build fails with:

/root/src/xtf/include/xtf/compiler.h:13:9: error: '__section' macro redefined
#define __section(s)          __attribute__((__section__(s)))
/usr/include/sys/cdefs.h:229:9: note: previous definition is here
#define __section(x)    __attribute__((__section__(x)))
1 error generated.

Only define __section if it's undefined in order to prevent conflicts.

Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
 include/xtf/compiler.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/include/xtf/compiler.h b/include/xtf/compiler.h
index aa5fd6b..b148687 100644
--- a/include/xtf/compiler.h
+++ b/include/xtf/compiler.h
@@ -10,7 +10,6 @@
 #define __noreturn            __attribute__((__noreturn__))
 #define __packed              __attribute__((__packed__))
 #define __printf(f, v)        __attribute__((__format__(__printf__, f, v)))
-#define __section(s)          __attribute__((__section__(s)))
 #define __used                __attribute__((__used__))
 #define __weak                __attribute__((__weak__))
@@ -22,6 +21,10 @@
 #define __always_inline       __attribute__((__always_inline__))
+#ifndef __section /* Avoid conflicting with cdefs.h */
+#define __section(s)          __attribute__((__section__(s)))
 #define unreachable()         __builtin_unreachable()
 #define barrier()             __asm__ __volatile__ ("" ::: "memory")

Xen-devel mailing list



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.