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。

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`

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