]> xenbits.xensource.com Git - xtf.git/commitdiff
Fix cdefs.h conflict with __section
authorRoger Pau Monne <roger.pau@citrix.com>
Thu, 22 Feb 2018 12:03:48 +0000 (12:03 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Thu, 22 Feb 2018 12:09:38 +0000 (12:09 +0000)
On FreeBSD the build fails with:

/root/src/xtf/include/xtf/compiler.h:13:9: error: '__section' macro redefined
      [-Werror,-Wmacro-redefined]
        ^
/usr/include/sys/cdefs.h:229:9: note: previous definition is here
        ^
1 error generated.

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

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
include/xtf/compiler.h

index aa5fd6b53c862cd64e5c7fca155ccbd649e3de1f..b148687b029e5ff5e4dec419fca5b39c17fa1b2a 100644 (file)
@@ -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__))
 
 #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")