================ @@ -1444,7 +1444,7 @@ struct PragmaWarningHandler : public PragmaHandler { .Case("once", PPCallbacks::PWS_Once) .Case("suppress", PPCallbacks::PWS_Suppress) .Default(-1); - if ((SpecifierValid = SpecifierInt != -1)) + if (SpecifierValid = (SpecifierInt != -1)) ---------------- fhahn wrote:
Unfortunately this introduces a new warning ``` /Users/florianhahn/projects/llvm-project/clang/lib/Lex/Pragma.cpp:1447:30: warning: using the result of an assignment as a condition without parentheses [-Wparentheses] 1447 | if (SpecifierValid = (SpecifierInt != -1)) | ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ /Users/florianhahn/projects/llvm-project/clang/lib/Lex/Pragma.cpp:1447:30: note: place parentheses around the assignment to silence this warning 1447 | if (SpecifierValid = (SpecifierInt != -1)) | ^ | ( ) /Users/florianhahn/projects/llvm-project/clang/lib/Lex/Pragma.cpp:1447:30: note: use '==' to turn this assignment into an equality comparison 1447 | if (SpecifierValid = (SpecifierInt != -1)) | ^ | == 1 warning generated. ``` We likely need to outer parenthesis as well ``` diff --git a/clang/lib/Lex/Pragma.cpp b/clang/lib/Lex/Pragma.cpp index ced407355e00..2972ee2197e2 100644 --- a/clang/lib/Lex/Pragma.cpp +++ b/clang/lib/Lex/Pragma.cpp @@ -1444,7 +1444,7 @@ struct PragmaWarningHandler : public PragmaHandler { .Case("once", PPCallbacks::PWS_Once) .Case("suppress", PPCallbacks::PWS_Suppress) .Default(-1); - if (SpecifierValid = (SpecifierInt != -1)) + if ((SpecifierValid = (SpecifierInt != -1))) Specifier = static_cast<PPCallbacks::PragmaWarningSpecifier>(SpecifierInt); ``` https://github.com/llvm/llvm-project/pull/89923 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits