raven/base/rspamd/rspamd-define-static_assert.patch
2024-02-21 13:47:54 +06:00

35 lines
1.3 KiB
Diff

diff -Naur a/src/rspamd.h b/src/rspamd.h
--- a/src/rspamd.h 2023-11-14 21:01:02.000000000 +0600
+++ b/src/rspamd.h 2023-11-20 21:25:47.323505357 +0600
@@ -52,6 +52,11 @@
#define CR '\r'
#define LF '\n'
+#if defined __USE_ISOC11 && !defined __cplusplus
+# undef static_assert
+# define static_assert _Static_assert
+#endif
+
#ifdef __cplusplus
extern "C" {
#endif
diff -Naur a/contrib/xxhash/xxhash.h b/contrib/xxhash/xxhash.h
--- a/contrib/xxhash/xxhash.h 2023-11-14 21:01:02.000000000 +0600
+++ b/contrib/xxhash/xxhash.h 2023-11-28 16:40:07.976183701 +0600
@@ -1545,14 +1545,7 @@
/* note: use after variable declarations */
#ifndef XXH_STATIC_ASSERT
-# if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) /* C11 */
-# include <assert.h>
-# define XXH_STATIC_ASSERT_WITH_MESSAGE(c,m) do { static_assert((c),m); } while(0)
-# elif defined(__cplusplus) && (__cplusplus >= 201103L) /* C++11 */
-# define XXH_STATIC_ASSERT_WITH_MESSAGE(c,m) do { static_assert((c),m); } while(0)
-# else
-# define XXH_STATIC_ASSERT_WITH_MESSAGE(c,m) do { struct xxh_sa { char x[(c) ? 1 : -1]; }; } while(0)
-# endif
+# define XXH_STATIC_ASSERT_WITH_MESSAGE(c,m) do { struct xxh_sa { char x[(c) ? 1 : -1]; }; } while(0)
# define XXH_STATIC_ASSERT(c) XXH_STATIC_ASSERT_WITH_MESSAGE((c),#c)
#endif