mirror of
https://github.com/libuv/libuv
synced 2025-03-28 21:13:16 +00:00
unix,win: use static_assert when available (#3189)
Fixes: https://github.com/libuv/libuv/issues/3131
This commit is contained in:
parent
2f110a50df
commit
55b5d88b01
@ -53,8 +53,13 @@ extern int snprintf(char*, size_t, const char*, ...);
|
||||
#define container_of(ptr, type, member) \
|
||||
((type *) ((char *) (ptr) - offsetof(type, member)))
|
||||
|
||||
/* C11 defines static_assert to be a macro which calls _Static_assert. */
|
||||
#if defined(static_assert)
|
||||
#define STATIC_ASSERT(expr) static_assert(expr, #expr)
|
||||
#else
|
||||
#define STATIC_ASSERT(expr) \
|
||||
void uv__static_assert(int static_assert_failed[1 - 2 * !(expr)])
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__) && (__GNUC__ > 4 || __GNUC__ == 4 && __GNUC_MINOR__ >= 7)
|
||||
#define uv__load_relaxed(p) __atomic_load_n(p, __ATOMIC_RELAXED)
|
||||
|
Loading…
x
Reference in New Issue
Block a user