xtf: fix cdefs.h conflict with __section
PATCH 1/1 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.
--- include/xtf/compiler.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
include/xtf/compiler.h +4 -1
@@ -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")
Signature · 7 lines
2.16.1 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 9 lines · Roger Pau Monne
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))) ^
Quoted 5 lines
1 error generated.
Only define
__sectionif it's undefined in order to prevent conflicts.Signed-off-by Roger Pau Monné <[email protected]>
Acked and pushed. Thanks.
~Andrew
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 6 lines
Quoted 1 line
Quoted 1 line · On 22.02.18 at 13:03, <[email protected]> wrote:
On FreeBSD the build fails with:
/root/src/xtf/include/xtf/compiler.h:13:9: error: '__section' macro redefined
[-Werror,-Wmacro-redefined]
Quoted 8 lines
#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
__sectionif it's undefined in order to prevent conflicts.
But the actual bug is that /usr/include/sys/cdefs.h is (magically?) being included. Just like the hypervisor build, the xtf one shouldn't pull in _any_ external headers.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 13 lines · Jan Beulich
Quoted 13 lines
Quoted 1 line
Quoted 1 line · On 22.02.18 at 13:03, <[email protected]> wrote:
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.
Quoted 4 lines
Quoted 1 line
Only define
__sectionif it's undefined in order to prevent conflicts.But the actual bug is that
/usr/include/sys/cdefs.his (magically?) being included. Just like the hypervisor build, the xtf one shouldn't pull in _any_ external headers.
XTF uses the following freestanding headers only.
#include <stdint.h>
#include <stdbool.h>
#include <stdarg.h>
#include <stddef.h>
#include <inttypes.h>
#include <limits.h>
~Andrew
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 20 lines
Quoted 1 line
Quoted 1 line · On 22.02.18 at 13:28, <[email protected]> wrote:
Quoted 13 lines · Jan Beulich
Quoted 13 lines
Quoted 1 line
Quoted 1 line · On 22.02.18 at 13:03, <[email protected]> wrote:
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.
Quoted 4 lines
Quoted 1 line
Only define
__sectionif it's undefined in order to prevent conflicts.But the actual bug is that
/usr/include/sys/cdefs.his (magically?) being included. Just like the hypervisor build, the xtf one shouldn't pull in _any_ external headers.
Quoted 8 lines
XTF uses the following freestanding headers only.
#include <
stdint.h>
#include <stdbool.h>
#include <stdarg.h>
#include <stddef.h>
#include <inttypes.h>
#include <limits.h>
None of which call for __section() to be defined. Otoh __section() is a reserved name, so it could be used for _anything_. I therefore think it should be #undef-ed, instead of the #define being made conditional. (The comment Roger adds is pretty useless as well, considering there's no cdefs.h anywhere in the xtf tree.)
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 29 lines · Jan Beulich
Quoted 20 lines
Quoted 1 line
Quoted 1 line · On 22.02.18 at 13:28, <[email protected]> wrote:
Quoted 13 lines · Jan Beulich
Quoted 13 lines
Quoted 1 line
Quoted 1 line · On 22.02.18 at 13:03, <[email protected]> wrote:
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.
Quoted 4 lines
Quoted 1 line
Only define
__sectionif it's undefined in order to prevent conflicts.But the actual bug is that
/usr/include/sys/cdefs.his (magically?) being included. Just like the hypervisor build, the xtf one shouldn't pull in _any_ external headers.Quoted 8 lines
XTF uses the following freestanding headers only.
#include <
stdint.h>
#include <stdbool.h>
#include <stdarg.h>
#include <stddef.h>
#include <inttypes.h>
#include <limits.h>
Quoted 5 lines
None of which call for
__section()to be defined. Otoh__section()is a reserved name, so it could be used for _anything_. I therefore think it should be #undef-ed, instead of the #define being made conditional. (The comment Roger adds is pretty useless as well, considering there's nocdefs.hanywhere in the xtf tree.)
Hm, that's basically in-line with the other comments regarding __noinline and __always_inline in the same file, that's why I didn't bother much and just did the same for __section.
Thanks, Roger.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel