]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
- Fixes for clang static analyzer, the missing ; in
authorWouter Wijngaards <wouter@nlnetlabs.nl>
Fri, 16 Feb 2018 10:31:48 +0000 (10:31 +0000)
committerWouter Wijngaards <wouter@nlnetlabs.nl>
Fri, 16 Feb 2018 10:31:48 +0000 (10:31 +0000)
  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

doc/Changelog
edns-subnet/addrtree.c
util/log.h

index 9750edb3122b60cc1e070255dbaec9fd7672fb02..52552ed18755774d730947ad49897cf8c3b11942 100644 (file)
@@ -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
 
index 050eb31fc98f5d1e4573ed6a6942db2b6ee32623..9a02db062c51af04970ce95b36c7a8b94071c6a3 100644 (file)
@@ -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)) {
index 0053e2de828f46b2d8aab1f8e4dfe438d8c7cc02..7bc3d9e76152dc66410766123e3cb6532ad67271 100644 (file)
@@ -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