Issue 96036
Summary [Clang]logical-op-parentheses warning is ignored within macro
Labels clang
Assignees
Reporter keyihao
    With the following minimum case 
```
#include <cstdio>

using namespace std;

int main()
{
#define TEST(v1, v2, v3)       \
    if( v1 && v2 || v3)        \
        printf("hello test\n");  

    bool a=1, b=1, c=1;
    if( a && b || c)                
        printf("hello world\n");
    TEST(a, b,c );                  
    return 0;
}
```

Both clang 17.0.1 and 18.1.0,`clang++ test.cpp -o test -Wall` only report 1 warning but ignoring the warning within TEST macro。
![image](https://github.com/llvm/llvm-project/assets/928986/f3caeea5-63d4-4739-8f8b-54253ee2ac97)
Case: https://godbolt.org/z/8WjWfv8TY


If separate into preprocess and compile phases, the compiler reports 2 warnings exactly.
`clang++ -E test.cpp -o test.ii -Wall` and `clang++ -c test.ii -o test.o -Wall`
![image](https://github.com/llvm/llvm-project/assets/928986/8a4cb7dc-53e0-469a-a96c-0e21bff37434)
Preprocess output: https://godbolt.org/z/hjM4o7q78
Compile output: https://godbolt.org/z/aM65z5j7f
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to