gmacros.h: Use _Static_assert for clang

It appears that CLang supports _Static_assert() even when not in C11
mode, since at least CLang 3.1, so let's just use that for CLang builds.

Fixes issue #2338.
This commit is contained in:
Chun-wei Fan 2021-03-20 10:38:08 +08:00
parent 97959cd7eb
commit 7b76995298

View File

@ -754,7 +754,7 @@
#ifndef __GI_SCANNER__ /* The static assert macro really confuses the introspection parser */
#define G_PASTE_ARGS(identifier1,identifier2) identifier1 ## identifier2
#define G_PASTE(identifier1,identifier2) G_PASTE_ARGS (identifier1, identifier2)
#if !defined(__cplusplus) && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
#if !defined(__cplusplus) && defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L || defined(__clang__))
#define G_STATIC_ASSERT(expr) _Static_assert (expr, "Expression evaluates to false")
#elif (defined(__cplusplus) && __cplusplus >= 201103L) || \
(defined(__cplusplus) && defined (_MSC_VER) && (_MSC_VER >= 1600)) || \