A macro that stands for an expression with an operator has no parentheses around it

tx0/c:macro-body-unparenthesizedstrictwarningbug

What it finds

#define SIZE HEADER + 16: wherever the macro is used, its text replaces the name, so SIZE * 2 becomes HEADER + 16 * 2. Parentheses around the whole body keep it one value.

The body must consist only of names, integer literals, parentheses and arithmetic or bitwise operators, with one of the operators outside any parentheses.

From the rule's source, macro_body_unparenthesized.rs.

Example from the rule's tests
#define HEADER 8#define SIZE HEADER + 16tx0 reports: the body of SIZE is not in parentheses#define WRAPPED (HEADER + 16)#define NEGATIVE -1#define CALLED f(1) + 2
Highlighted lines are the ones tx0 reports, with its message under each; the other lines are left alone.

Turn it on, off or suppress it

The rule runs from the strict tier up. To turn it on in a lower tier, give it a level in tx0.toml:

tx0.toml
[rules]
"tx0/c:macro-body-unparenthesized" = "warning"

To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:

// tx0: ignore[tx0/c:macro-body-unparenthesized] reason="..."

tx0 explain tx0/c:macro-body-unparenthesized shows the same in the terminal. Found a false positive? Report it.