[glib/clang-cl-improvements: 2/2] gmacros.h: Use _Static_assert for clang
- From: Chun-wei Fan <fanchunwei src gnome org>
 
- To: commits-list gnome org
 
- Cc: 
 
- Subject: [glib/clang-cl-improvements: 2/2] gmacros.h: Use _Static_assert for clang
 
- Date: Sat, 20 Mar 2021 02:44:07 +0000 (UTC)
 
commit 7cf9d294fc286c83295fcd2220c110cdc650bf63
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Sat Mar 20 10:38:08 2021 +0800
    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..b886943f1 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)) || \
[
Date Prev][
Date Next]   [
Thread Prev][
Thread Next]   
[
Thread Index]
[
Date Index]
[
Author Index]