[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
      [-Werror,-Wmacro-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__))
 #endif
 
+#ifndef __section /* Avoid conflicting with cdefs.h */
+#define __section(s)          __attribute__((__section__(s)))
+#endif
+
 #define unreachable()         __builtin_unreachable()
 #define barrier()             __asm__ __volatile__ ("" ::: "memory")
 
-- 
2.16.1


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

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