util: move static_assert polyfill to test-util.h

It's no longer used in the main source code.
This commit is contained in:
Bert Belder 2018-06-04 23:54:55 -07:00
parent 74e6f02ee4
commit dd65a0c06b
No known key found for this signature in database
GPG Key ID: 7A77887B2E2ED461
2 changed files with 8 additions and 6 deletions

View File

@ -25,10 +25,4 @@ typedef intptr_t ssize_t;
#define inline __inline #define inline __inline
#endif #endif
/* Polyfill `static_assert` for some versions of clang and gcc. */
#if (defined(__clang__) || defined(__GNUC__)) && !defined(static_assert)
#define static_assert(condition, message) typedef __attribute__( \
(__unused__)) int __static_assert_##__LINE__[(condition) ? 1 : -1]
#endif
#endif /* WEPOLL_UTIL_H_ */ #endif /* WEPOLL_UTIL_H_ */

View File

@ -1,6 +1,8 @@
#ifndef TEST_UTIL_H_ #ifndef TEST_UTIL_H_
#define TEST_UTIL_H_ #define TEST_UTIL_H_
#include <assert.h>
#ifdef __clang__ #ifdef __clang__
#pragma clang diagnostic ignored "-Wbad-function-cast" #pragma clang diagnostic ignored "-Wbad-function-cast"
#pragma clang diagnostic ignored "-Wcast-qual" #pragma clang diagnostic ignored "-Wcast-qual"
@ -33,4 +35,10 @@ void no_inline no_return check_fail(const char* message);
" line: " _check_to_string(__LINE__) "\n"), \ " line: " _check_to_string(__LINE__) "\n"), \
0)) 0))
/* Polyfill `static_assert` for some versions of clang and gcc. */
#if (defined(__clang__) || defined(__GNUC__)) && !defined(static_assert)
#define static_assert(condition, message) typedef __attribute__( \
(__unused__)) int __static_assert_##__LINE__[(condition) ? 1 : -1]
#endif
#endif /* TEST_UTIL_H_ */ #endif /* TEST_UTIL_H_ */