Issue |
96476
|
Summary |
[Clang] Warning not displayed when using `-include`
|
Labels |
clang
|
Assignees |
|
Reporter |
VitorRamos
|
## Description
While compiling a c++ source file with clang++ using the `-include` flag to include a header file, some warnings are not shown.
## Steps to Reproduce
1. header file `assert.h`:
```c++
#pragma once
#define CUSTOM_MACRO(expr) (void)(!!(expr))
```
2. cpp file `main.cpp` :
```c++
int main()
{
int x = 0;
CUSTOM_MACRO(x > 0 || x <= 0);
}
```
3. Compile the file with the following command:
```sh
clang++ -Wall -Wextra -include assert.h -c main.cpp
```
4. Observe that no warning is outputted.
5. Compile the file again with the additional `-save-temps=obj` flag:
```sh
clang++ -Wall -Wextra -include assert.h -c main.cpp -save-temps=obj
```
6. Observe that the following warning is generated:
```log
main.cpp:5:21: warning: overlapping comparisons always evaluate to true [-Wtautological-overlap-compare]
(void)(!!(x > 0 || x <= 0));
~~~~~~^~~~~~~~~
1 warning generated.
```
## Expected Behavior
The warning indicating that the comparison always evaluates to true should be displayed regardless of the use of the `-save-temps=obj` flag.
## Additional Information
- **Compiler Version:** Clang 16.0.0
- **Operating System:** Ubuntu 22.04
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs