]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Preserve brackets in DNS_SLABHEADER_GETATTR macro
authorMark Andrews <marka@isc.org>
Wed, 25 Jun 2025 03:58:31 +0000 (13:58 +1000)
committerMark Andrews <marka@isc.org>
Wed, 25 Jun 2025 03:59:44 +0000 (13:59 +1000)
We need to turn off clang-format to preserve the brackets as
'attribute' can be an expression and we need it to be evaluated
first.

Similarly we need the entire result to be evaluated independent of
the adjoining code.

(cherry picked from commit 3620db5ea6f163199cf5a3ad09c32d02b374f748)

lib/dns/rbtdb.c

index 4bd5c728b883ea55826f6401d1addfe0a756c209..5de759f4dd379f8bfe0befe438cf089bc6aff0ba 100644 (file)
@@ -299,8 +299,10 @@ typedef ISC_LIST(dns_rbtnode_t) rbtnodelist_t;
          RDATASET_ATTR_STATCOUNT) != 0)
 #define STALE_TTL(header, rbtdb) (NXDOMAIN(header) ? 0 : rbtdb->serve_stale_ttl)
 
+/* clang-format off : RemoveParentheses */
 #define RDATASET_ATTR_GET(header, attribute) \
-       (atomic_load_acquire(&(header)->attributes) & attribute)
+       (atomic_load_acquire(&(header)->attributes) & (attribute))
+/* clang-format on */
 #define RDATASET_ATTR_SET(header, attribute) \
        atomic_fetch_or_release(&(header)->attributes, attribute)
 #define RDATASET_ATTR_CLR(header, attribute) \