mirror of
https://passt.top/passt
synced 2025-05-23 01:35:35 +02:00
clang-tidy: Enable the bugprone-macro-parentheses check
We globally disabled this, with a justification lumped together with several checks about braces. They don't really go together, the others are essentially a stylistic choice which doesn't match our style. Omitting brackets on macro parameters can lead to real and hard to track down bugs if an expression is ever passed to the macro instead of a plain identifier. We've only gotten away with the macros which trigger the warning, because of other conventions its been unlikely to invoke them with anything other than a simple identifier. Fix the macros, and enable the warning for the future. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
This commit is contained in:
parent
7094b91d10
commit
0e36fe1a43
4 changed files with 25 additions and 26 deletions
37
tap.c
37
tap.c
|
@ -674,18 +674,18 @@ resume:
|
|||
continue;
|
||||
}
|
||||
|
||||
#define L4_MATCH(iph, uh, seq) \
|
||||
(seq->protocol == iph->protocol && \
|
||||
seq->source == uh->source && seq->dest == uh->dest && \
|
||||
seq->saddr.s_addr == iph->saddr && seq->daddr.s_addr == iph->daddr)
|
||||
#define L4_MATCH(iph, uh, seq) \
|
||||
((seq)->protocol == (iph)->protocol && \
|
||||
(seq)->source == (uh)->source && (seq)->dest == (uh)->dest && \
|
||||
(seq)->saddr.s_addr == (iph)->saddr && (seq)->daddr.s_addr == (iph)->daddr)
|
||||
|
||||
#define L4_SET(iph, uh, seq) \
|
||||
do { \
|
||||
seq->protocol = iph->protocol; \
|
||||
seq->source = uh->source; \
|
||||
seq->dest = uh->dest; \
|
||||
seq->saddr.s_addr = iph->saddr; \
|
||||
seq->daddr.s_addr = iph->daddr; \
|
||||
(seq)->protocol = (iph)->protocol; \
|
||||
(seq)->source = (uh)->source; \
|
||||
(seq)->dest = (uh)->dest; \
|
||||
(seq)->saddr.s_addr = (iph)->saddr; \
|
||||
(seq)->daddr.s_addr = (iph)->daddr; \
|
||||
} while (0)
|
||||
|
||||
if (seq && L4_MATCH(iph, uh, seq) && seq->p.count < UIO_MAXIOV)
|
||||
|
@ -848,18 +848,19 @@ resume:
|
|||
}
|
||||
|
||||
#define L4_MATCH(ip6h, proto, uh, seq) \
|
||||
(seq->protocol == proto && \
|
||||
seq->source == uh->source && seq->dest == uh->dest && \
|
||||
IN6_ARE_ADDR_EQUAL(&seq->saddr, saddr) && \
|
||||
IN6_ARE_ADDR_EQUAL(&seq->daddr, daddr))
|
||||
((seq)->protocol == (proto) && \
|
||||
(seq)->source == (uh)->source && \
|
||||
(seq)->dest == (uh)->dest && \
|
||||
IN6_ARE_ADDR_EQUAL(&(seq)->saddr, saddr) && \
|
||||
IN6_ARE_ADDR_EQUAL(&(seq)->daddr, daddr))
|
||||
|
||||
#define L4_SET(ip6h, proto, uh, seq) \
|
||||
do { \
|
||||
seq->protocol = proto; \
|
||||
seq->source = uh->source; \
|
||||
seq->dest = uh->dest; \
|
||||
seq->saddr = *saddr; \
|
||||
seq->daddr = *daddr; \
|
||||
(seq)->protocol = (proto); \
|
||||
(seq)->source = (uh)->source; \
|
||||
(seq)->dest = (uh)->dest; \
|
||||
(seq)->saddr = *saddr; \
|
||||
(seq)->daddr = *daddr; \
|
||||
} while (0)
|
||||
|
||||
if (seq && L4_MATCH(ip6h, proto, uh, seq) &&
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue