]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Trie: Tame the static analyzer thread-next
authorMaria Matejka <mq@ucw.cz>
Thu, 8 Jan 2026 15:19:35 +0000 (16:19 +0100)
committerMaria Matejka <mq@ucw.cz>
Thu, 8 Jan 2026 15:24:07 +0000 (16:24 +0100)
The CLang static analyzer claims that there might be an undefined behavior
but it is provably impossible. Adding an ASSUME call to mute the warning.

filter/trie.c

index 4edd6f2ec5d35c66b54b47fda6b48ecb9b6d3dc4..2ffdf7bc93980e1ad108f5b7c11cbd6013e03cde 100644 (file)
@@ -1100,7 +1100,11 @@ trie_node_format(const struct f_trie_node *n, buffer *buf, int v4)
        uint lmask = trie_level_mask(pos, i);
 
        if ((local & lmask) != lmask)
+       {
+         /* trie_level_mask(pos, 0) == 1u << pos */
+         ASSUME(i > 0);
          break;
+       }
 
        local &= ~lmask;
       }