sarnex wrote:

> That change was reverted for different reasons. I shouldn't have changed the 
> prototype of _mm_prefetch there, so I'm relanding it here: 
> https://github.com/llvm/llvm-project/pull/138360

Thanks, my bad, I should have looked at the problem in more detail.

> So, winnt.h is supposed to be a system header. We already suppress warnings 
> in system headers. Can you elaborate on why you saw a warning and felt you 
> had to back out the last change? If someone is building with 
> -Wsystem-headers, they should expect to see warnings like this. There are 
> other cases like __cpuidex which are mentioned in winnt.h, but don't break 
> the build:

You're right, we already have a check 
[here](https://github.com/llvm/llvm-project/blob/main/clang/lib/Basic/DiagnosticIDs.cpp#L554)
 to not throw diagnostics with source locations in system headers. The problem 
here is the source location is not in the system header, it's the user's call 
of the system header/builtin function (see repro below). Only the "Spelling" 
(whatever that means) part of the diagnostic is in the header, and the check 
doesn't check for that. 

Maybe that justifies special casing this warning?

Repro (from 
[here](https://github.com/llvm/llvm-project/pull/128222#issuecomment-2820496828))

```
#include <windows.h>
#include <winnt.h>
void func(void) { _InstructionSynchronizationBarrier(); }
```
```
bin/clang-cl --target=aarch64-windows-msvc -c isb.c
```
Of course you'll need to revert b60ee399787cb2a5f50d21932db3492cc4ff0d34 first.




https://github.com/llvm/llvm-project/pull/138205
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to