[master] 0a789f173 v_static_assert vs. stdc
Nils Goroll
nils.goroll at uplex.de
Thu Oct 31 15:29:05 UTC 2024
commit 0a789f173413e2dbadc9c361e71a3585d4b36263
Author: Nils Goroll <nils.goroll at uplex.de>
Date: Thu Oct 31 16:26:14 2024 +0100
v_static_assert vs. stdc
C11 has _Static_assert and static_assert via assert.h, which we can not include.
C23 has static_assert and deprecated _Static_assert
diff --git a/include/vas.h b/include/vas.h
index 2e6a9ee2a..75c8247c3 100644
--- a/include/vas.h
+++ b/include/vas.h
@@ -114,7 +114,11 @@ do { \
# define __has_extension(x) 0
#endif
-#if __has_extension(c_static_assert)
+#if __STDC_VERSION__ - 0 >= 202311L
+# define v_static_assert static_assert
+#elif __STDC_VERSION__ - 0 >= 201112L
+# define v_static_assert _Static_assert
+#elif __has_extension(c_static_assert)
# define v_static_assert _Static_assert
#elif __GNUC_PREREQ__(4,6) && !defined(__cplusplus)
# define v_static_assert _Static_assert
More information about the varnish-commit
mailing list