I got email from Robert Reif about false positive(s) for such code:
struct Fred { enum Foo { First, Second }; }; const char * to_string(Fred::Foo foo, bool verbose) { switch (foo) { #define CASE(a, b) case Fred::a: if (verbose) return b; else return #a CASE(First, "This is the first one"); CASE(Second, "This is the second one"); #undef CASE } return "unknown"; }
The macro-parentheses checker currently warns about both macro arguments a and b. The warning about a is wrong. The warning about b is annoying.
This patch fixes so no warning is shown for that example code.
nit: "Assignment/return, i.e. '= x;' or 'return x;'.