From: Wouter Wijngaards Date: Fri, 16 Feb 2018 10:31:48 +0000 (+0000) Subject: - Fixes for clang static analyzer, the missing ; in X-Git-Tag: release-1.7.0rc1~23 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5b7942d197e9f28c3fdf11aea533b16a2cafd56c;p=thirdparty%2Funbound.git - Fixes for clang static analyzer, the missing ; in edns-subnet/addrtree.c after the assert made clang analyzer produce a failure to analyze it. git-svn-id: file:///svn/unbound/trunk@4538 be551aaa-1e26-0410-a405-d3ace91eadb9 --- diff --git a/doc/Changelog b/doc/Changelog index 9750edb31..52552ed18 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -1,3 +1,8 @@ +16 February 2018: Wouter + - Fixes for clang static analyzer, the missing ; in + edns-subnet/addrtree.c after the assert made clang analyzer + produce a failure to analyze it. + 13 February 2018: Ralph - Aggressive NSEC tests diff --git a/edns-subnet/addrtree.c b/edns-subnet/addrtree.c index 050eb31fc..9a02db062 100644 --- a/edns-subnet/addrtree.c +++ b/edns-subnet/addrtree.c @@ -485,7 +485,7 @@ addrtree_find(struct addrtree *tree, const addrkey_t *addr, /* does this node have data? if yes, see if we have a match */ if (node->elem && node->ttl >= now) { /* saved at wrong depth */; - log_assert(node->scope >= depth) + log_assert(node->scope >= depth); if (depth == node->scope || (node->scope > sourcemask && depth == sourcemask)) { diff --git a/util/log.h b/util/log.h index 0053e2de8..7bc3d9e76 100644 --- a/util/log.h +++ b/util/log.h @@ -189,11 +189,17 @@ void log_vmsg(int pri, const char* type, const char* format, va_list args); * an assertion that is thrown to the logfile. */ #ifdef UNBOUND_DEBUG +#ifdef __clang_analyzer__ +/* clang analyzer needs to know that log_assert is an assertion, otherwise + * it could complain about the nullptr the assert is guarding against. */ +#define log_assert(x) assert(x) +#else # define log_assert(x) \ do { if(!(x)) \ fatal_exit("%s:%d: %s: assertion %s failed", \ __FILE__, __LINE__, __func__, #x); \ } while(0); +#endif #else # define log_assert(x) /*nothing*/ #endif