diff options
author | Chun-wei Fan <fanchunwei@src.gnome.org> | 2021-03-20 10:38:08 +0800 |
---|---|---|
committer | Chun-wei Fan <fanchunwei@src.gnome.org> | 2021-03-30 16:45:07 +0800 |
commit | 7b76995298fb2ce2f751d630bb5c23a56a018725 (patch) | |
tree | 2ba98ae79c20b81c3e8acd89dce2ffcc219deb1b | |
parent | 97959cd7eb76b7ff52b3c40002d974e3d4c03f77 (diff) | |
download | glib-7b76995298fb2ce2f751d630bb5c23a56a018725.tar.gz |
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.
-rw-r--r-- | glib/gmacros.h | 2 |
1 files changed, 1 insertions, 1 deletions
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)) || \ |