mirror of
https://github.com/isc-projects/bind9.git
synced 2026-06-11 01:31:48 -04:00
Merge branch 'ondrej/use-static-assert' into 'master'
Use static assertions on non-Windows platforms (requires C11 or gcc-4.6+) See merge request isc-projects/bind9!1045
This commit is contained in:
commit
995bafbd72
2 changed files with 14 additions and 1 deletions
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -747,7 +747,8 @@ isc_mem_createx(size_t init_max_size, size_t target_size,
|
|||
REQUIRE(memalloc != NULL);
|
||||
REQUIRE(memfree != NULL);
|
||||
|
||||
INSIST((ALIGNMENT_SIZE & (ALIGNMENT_SIZE - 1)) == 0);
|
||||
STATIC_ASSERT((ALIGNMENT_SIZE & (ALIGNMENT_SIZE - 1)) == 0,
|
||||
"wrong alignment size");
|
||||
|
||||
RUNTIME_CHECK(isc_once_do(&once, initialize_action) == ISC_R_SUCCESS);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue