From 7b76995298fb2ce2f751d630bb5c23a56a018725 Mon Sep 17 00:00:00 2001 From: Chun-wei Fan Date: Sat, 20 Mar 2021 10:38:08 +0800 Subject: 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. --- glib/gmacros.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/glib/gmacros.h b/glib/gmacros.h index 2ece48ba0..666db5790 100644 --- a/glib/gmacros.h +++ b/glib/gmacros.h @@ -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)) || \ -- cgit v1.2.1