Message ID | 20170928084535.lkdywz5gjtgtlaxz@citrix.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On 28/09/2017 09:45, Wei Liu wrote: > On Thu, Sep 28, 2017 at 02:43:57PM +1300, Glenn Enright wrote: >> Hi there >> >> When building the xen testing framework on CentOS6, I see the below issue. I >> see similar issues with CentOS7 and other distros with older tool chains. >> The only one that built cleanly for me was Ubuntu 1604. >> >> Some workarounds (disabling the -W options) let it get a bit further but I >> hit other issues. >> >> Andrew separately mentioned this may be related to C99 initialisation, which >> sounds about right. >> >> At the moment I'm doing a static build and moving the binaries where I need >> to run the tests, which is fine, but it would be nice to have a native c6 >> build working to match the rest of my existing test infra. >> >> Not a C dev, but happy to test any/all things. >> >> Not list subscribed so please include in CC. >> >> Regards, Glenn >> http://rimuhosting.com >> >> ... >> gcc -pipe -I/root/gle/xtf/include -I/root/gle/xtf/arch/x86/include -MMD -MP >> -Wall -Wextra -Werror -std=gnu99 -Wstrict-prototypes -O3 -g -fno-common >> -fno-asynchronous-unwind-tables -fno-strict-aliasing -fno-stack-protector >> -fno-pic -ffreestanding -mno-red-zone -mno-sse -Wno-unused-parameter >> -Winline -m64 -DCONFIG_ENV_pv64 -include arch/config.h -c >> /root/gle/xtf/arch/x86/setup.c -o /root/gle/xtf/arch/x86/setup-pv64.o >> cc1: warnings being treated as errors >> /root/gle/xtf/arch/x86/grant_table.c: In function ‘arch_map_gnttab’: >> /root/gle/xtf/arch/x86/grant_table.c:19: error: implicit declaration of >> function ‘_Static_assert’ >> make[1]: *** [/root/gle/xtf/arch/x86/grant_table-pv64.o] Error 1 >> make[1]: *** Waiting for unfinished jobs.... >> make[1]: Leaving directory `/root/gle/xtf/tests/cpuid' >> make: *** [all] Error 2 >> >> # gcc --version >> gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-18) >> Copyright (C) 2010 Free Software Foundation, Inc. >> This is free software; see the source for copying conditions. There is NO >> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. >> > Please try the following patch: ;p Sadly not. There will be complaints of statements with no effect. Beyond _Static_assert(), there are some anonymous union initialisation problems, register scheduling problems, and binutils lack of understanding of vmfunc. I've a series in progress. ~Andrew
On Thu, Sep 28, 2017 at 09:51:20AM +0100, Andrew Cooper wrote: > On 28/09/2017 09:45, Wei Liu wrote: > > On Thu, Sep 28, 2017 at 02:43:57PM +1300, Glenn Enright wrote: > >> Hi there > >> > >> When building the xen testing framework on CentOS6, I see the below issue. I > >> see similar issues with CentOS7 and other distros with older tool chains. > >> The only one that built cleanly for me was Ubuntu 1604. > >> > >> Some workarounds (disabling the -W options) let it get a bit further but I > >> hit other issues. > >> > >> Andrew separately mentioned this may be related to C99 initialisation, which > >> sounds about right. > >> > >> At the moment I'm doing a static build and moving the binaries where I need > >> to run the tests, which is fine, but it would be nice to have a native c6 > >> build working to match the rest of my existing test infra. > >> > >> Not a C dev, but happy to test any/all things. > >> > >> Not list subscribed so please include in CC. > >> > >> Regards, Glenn > >> http://rimuhosting.com > >> > >> ... > >> gcc -pipe -I/root/gle/xtf/include -I/root/gle/xtf/arch/x86/include -MMD -MP > >> -Wall -Wextra -Werror -std=gnu99 -Wstrict-prototypes -O3 -g -fno-common > >> -fno-asynchronous-unwind-tables -fno-strict-aliasing -fno-stack-protector > >> -fno-pic -ffreestanding -mno-red-zone -mno-sse -Wno-unused-parameter > >> -Winline -m64 -DCONFIG_ENV_pv64 -include arch/config.h -c > >> /root/gle/xtf/arch/x86/setup.c -o /root/gle/xtf/arch/x86/setup-pv64.o > >> cc1: warnings being treated as errors > >> /root/gle/xtf/arch/x86/grant_table.c: In function ‘arch_map_gnttab’: > >> /root/gle/xtf/arch/x86/grant_table.c:19: error: implicit declaration of > >> function ‘_Static_assert’ > >> make[1]: *** [/root/gle/xtf/arch/x86/grant_table-pv64.o] Error 1 > >> make[1]: *** Waiting for unfinished jobs.... > >> make[1]: Leaving directory `/root/gle/xtf/tests/cpuid' > >> make: *** [all] Error 2 > >> > >> # gcc --version > >> gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-18) > >> Copyright (C) 2010 Free Software Foundation, Inc. > >> This is free software; see the source for copying conditions. There is NO > >> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. > >> > > Please try the following patch: > > ;p > > Sadly not. There will be complaints of statements with no effect. > > Beyond _Static_assert(), there are some anonymous union initialisation > problems, register scheduling problems, and binutils lack of > understanding of vmfunc. I've a series in progress. OK. I am more than happy to drop this from my list. :-)
diff --git a/include/xtf/lib.h b/include/xtf/lib.h index d792a8d..1d2a396 100644 --- a/include/xtf/lib.h +++ b/include/xtf/lib.h @@ -28,8 +28,12 @@ void __noreturn panic(const char *fmt, ...) __printf(1, 2); #cond, __FILE__, __LINE__); \ } while ( 0 ) +#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6) #define BUILD_BUG_ON(cond) \ _Static_assert(!(cond), "!(" #cond ")") +#else +#define BUILD_BUG_ON(cond) sizeof(struct { int:-!!(cond); }) +#endif #define min(a, b) \ ({ \