Index: clang-tools-extra/clang-tidy/bugprone/MacroParenthesesCheck.cpp =================================================================== --- clang-tools-extra/clang-tidy/bugprone/MacroParenthesesCheck.cpp +++ clang-tools-extra/clang-tidy/bugprone/MacroParenthesesCheck.cpp @@ -158,6 +158,9 @@ // Skip variable declaration. bool VarDecl = possibleVarDecl(MI, MI->tokens_begin()); + // Skip goto argument. + bool FoundGoto = false; + for (auto TI = MI->tokens_begin(), TE = MI->tokens_end(); TI != TE; ++TI) { // First token. if (TI == MI->tokens_begin()) @@ -172,6 +175,16 @@ const Token &Tok = *TI; + // There should not be extra parentheses for the goto argument. + if (Tok.is(tok::kw_goto)) { + FoundGoto = true; + continue; + } + if (FoundGoto) { + FoundGoto = false; + continue; + } + // There should not be extra parentheses in possible variable declaration. if (VarDecl) { if (Tok.isOneOf(tok::equal, tok::semi, tok::l_square, tok::l_paren)) Index: clang-tools-extra/test/clang-tidy/checkers/bugprone-macro-parentheses.cpp =================================================================== --- clang-tools-extra/test/clang-tidy/checkers/bugprone-macro-parentheses.cpp +++ clang-tools-extra/test/clang-tidy/checkers/bugprone-macro-parentheses.cpp @@ -44,6 +44,7 @@ #define GOOD31(X) A*X=2 #define GOOD32(X) std::vector #define GOOD33(x) if (!a__##x) a_##x = &f(#x) +#define GOOD34(x, y) if (x) goto y; // These are allowed for now.. #define MAYBE1 *12.34