<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/96036>96036</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[Clang]logical-op-parentheses warning is ignored within macro
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
keyihao
</td>
</tr>
</table>
<pre>
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
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy0VV2PqzYQ_TWTlxEIxnyYBx5uko3UhytV6kqrPhozBG8dTLHJdu-vryBfu7etevtQFE1w7OM5PmfGUd6b48BcQ76FfL9Rc-jdVP_G76ZXbtO49r1-MaHH0DN2zlr3ZoYjnsxgTvMJtfKMkOwh-QJFcv1chiTMoO3cMoLYaR9a40A8XSfXOPtlq0Gd2I9KM_rQgth-XGGGgCdlBiAJVF1nyu09Q8udGRifn355BpLnFGiHZ1qjAKrw8kC-uyCWgemAJJ5TBCqACjwTQrmD8jPkM2Z5xskMoVuJUM_WOgzsA-S7AYgWcmK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