Use __has_extension and __has_feature is a way compatible with old gcc
diff --git a/src/pthreadpool.c b/src/pthreadpool.c index 5eb7972..e9dbd18 100644 --- a/src/pthreadpool.c +++ b/src/pthreadpool.c
@@ -15,12 +15,16 @@ #define PTHREADPOOL_CACHELINE_SIZE 64 #define PTHREADPOOL_CACHELINE_ALIGNED __attribute__((__aligned__(PTHREADPOOL_CACHELINE_SIZE))) -#if (defined(__clang__) && (__has_extension(c_static_assert) || __has_feature(c_static_assert))) || \ - (defined(__GNUC__) && ((__GNUC__ > 4) || (__GNUC__ == 4) && (__GNUC_MINOR__ >= 6))) - /* Static assert is supported by gcc >= 4.6 and modern clang */ +#if defined(__clang__) + #if __has_extension(c_static_assert) || __has_feature(c_static_assert) + #define PTHREADPOOL_STATIC_ASSERT(predicate, message) _Static_assert((predicate), message) + #else + #define PTHREADPOOL_STATIC_ASSERT(predicate, message) + #endif +#elif defined(__GNUC__) && ((__GNUC__ > 4) || (__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) + /* Static assert is supported by gcc >= 4.6 */ #define PTHREADPOOL_STATIC_ASSERT(predicate, message) _Static_assert((predicate), message) #else - /* Dummy declaration for legacy compilers */ #define PTHREADPOOL_STATIC_ASSERT(predicate, message) #endif