[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH XTF 1/4] build: Support BUILD_BUG_ON() with compilers lacking _Static_assert()



On 28/09/17 13:32, Jan Beulich wrote:
>>>> On 28.09.17 at 12:59, <andrew.cooper3@xxxxxxxxxx> wrote:
>> --- /dev/null
>> +++ b/include/xtf/compiler-gcc.h
>> @@ -0,0 +1,31 @@
>> +#ifndef XTF_COMPILER_GCC_H
>> +#define XTF_COMPILER_GCC_H
>> +
>> +#define GCC_VER (__GNUC__ * 10000 +         \
>> +             __GNUC_MINOR__ * 100 +         \
>> +             __GNUC_PATCHLEVEL__)
>> +
>> +/*
>> + * The Clang __has_*() infrastructure is a very clean way to identify
>> + * compiler support, without resorting to version checks.  Fake up
>> + * enough support for XTF code to use, even on non-clang compilers.
>> + */
>> +
>> +#ifndef __has_extension
>> +
>> +#define GCC_HAS_c_static_assert (GCC_VER >= 40600) /* _Static_assert() */
>> +
>> +#define __has_extension(x) GCC_HAS_ ## x
> As always I'd recommend against underscore prefixed names.

In this case, its a Clang feature which I'm deliberately trying to use.

https://clang.llvm.org/docs/LanguageExtensions.html#feature-checking-macros

~Andrew

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

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