From: Roger Pau Monne Date: Thu, 22 Feb 2018 12:03:48 +0000 (+0000) Subject: Fix cdefs.h conflict with __section X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=3a83f436494b9cc46582c94d69348401466eebb0;p=xtf.git 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] ^ /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é Acked-by: Andrew Cooper --- 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")