| From 6189ecd3d44a693460f86280ccf49d33cb4b18e1 Mon Sep 17 00:00:00 2001 |
| From: Yann Collet <cyan@fb.com> |
| Date: Sun, 26 Dec 2021 15:15:26 -0800 |
| Subject: [PATCH] do no longer depend on `<assert.h>` for XXH_STATIC_ASSERT |
| |
| since some versions are buggy. |
| |
| Use `_Static_assert` instead, which is part of the C11 language. |
| [Retrieved from: |
| https://github.com/Cyan4973/xxHash/commit/6189ecd3d44a693460f86280ccf49d33cb4b18e1] |
| Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com> |
| --- |
| xxhash.h | 3 +-- |
| 1 file changed, 1 insertion(+), 2 deletions(-) |
| |
| diff --git a/xxhash.h b/xxhash.h |
| index 311a69c7..5dfd5c45 100644 |
| --- a/xxhash.h |
| +++ b/xxhash.h |
| @@ -1749,8 +1749,7 @@ static void* XXH_memcpy(void* dest, const void* src, size_t size) |
| /* 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) |
| +# 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 |