]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Preserve brackets in DNS_SLABHEADER_GETATTR macro
authorMark Andrews <marka@isc.org>
Wed, 18 Jun 2025 02:01:31 +0000 (12:01 +1000)
committerMark Andrews <marka@isc.org>
Wed, 25 Jun 2025 03:26:13 +0000 (13:26 +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/include/dns/rdataslab.h

index 3061f0ece45a33441cdf74dc048725d7ba962c41..8fc68322cacb964ba953c56e4f6964480fe16d57 100644 (file)
@@ -154,8 +154,10 @@ enum {
        DNS_SLABHEADERATTR_STALE_WINDOW = 1 << 13,
 };
 
+/* clang-format off : RemoveParentheses */
 #define DNS_SLABHEADER_GETATTR(header, attribute) \
-       (atomic_load_acquire(&(header)->attributes) & attribute)
+       (atomic_load_acquire(&(header)->attributes) & (attribute))
+/* clang-format on */
 #define DNS_SLABHEADER_SETATTR(header, attribute) \
        atomic_fetch_or_release(&(header)->attributes, attribute)
 #define DNS_SLABHEADER_CLRATTR(header, attribute) \