util: don't redefine static_assert if it's already defined

This commit is contained in:
Bert Belder 2017-12-08 23:32:04 +01:00
parent d907d3f768
commit 206dff3f6a

View File

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