From: Ondřej Surý Date: Tue, 13 Nov 2018 20:43:11 +0000 (+0100) Subject: Define STATIC_ASSERT(cond, msg) to be _Static_assert(cond, msg) everywhere but on... X-Git-Tag: v9.13.4~23^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5e44a1008f9ae6570bc3dc5841110381ae8cc4df;p=thirdparty%2Fbind9.git Define STATIC_ASSERT(cond, msg) to be _Static_assert(cond, msg) everywhere but on Windows where it stays to be INSIST(cond) --- diff --git a/lib/isc/include/isc/util.h b/lib/isc/include/isc/util.h index 97eb51a193f..ecd9e8c52ac 100644 --- a/lib/isc/include/isc/util.h +++ b/lib/isc/include/isc/util.h @@ -208,6 +208,18 @@ #define ISC_UNREACHABLE() #endif +#if !defined(__has_feature) +#define __has_feature(x) 0 +#endif + +#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR >= 6) +#define STATIC_ASSERT(cond, msg) _Static_assert(cond, msg) +#elif __has_feature(c_static_assert) +#define STATIC_ASSERT(cond, msg) _Static_assert(cond, msg) +#else +#define STATIC_ASSERT(cond, msg) INSIST(cond) +#endif + #ifdef UNIT_TESTING extern void mock_assert(const int result, const char* const expression, const char * const file, const int line);