From 773d9cace39552b12823cdba689f9487c0d188b2 Mon Sep 17 00:00:00 2001 From: Bert Belder Date: Sat, 23 Sep 2017 13:51:24 +0200 Subject: [PATCH] util: add static_assert() polyfill for clang --- src/util.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/util.h b/src/util.h index b2e76b2..6d1f6bf 100644 --- a/src/util.h +++ b/src/util.h @@ -15,4 +15,10 @@ typedef intptr_t ssize_t; #define unused(v) ((void) (v)) +#ifdef __clang__ +/* Polyfill static_assert() because clang doesn't support it. */ +#define static_assert(condition, message) typedef __attribute__( \ + (unused)) int __static_assert_##__LINE__[(condition) ? 1 : -1]; +#endif + #endif /* EPOLL_UTIL_H_ */