llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
28.87k stars 11.93k forks source link

Warnings on msvc headers when not in msvc environment #96382

Closed trcrsired closed 3 months ago

trcrsired commented 4 months ago

https://github.com/trcrsired/windows-msvc-cross-runtimes/tree/main

D:\msys64\home\unlvs\projects\fast_io\examples\0001.helloworld>clang++ -o helloworld.exe helloworld.cc -Ofast -std=c++26 --target=x86_64-windows-msvc -I../../include -flto=thin -ID:\msys64\home\unlvs\projects\windows-msvc-cross-runtimes\include -LD:\msys64\home\unlvs\projects\windows-msvc-cross-runtimes\lib\x86_64-windows-msvc -fuse-ld=lld -D_DLL=1 -lmsvcrt -Wall -Wextra
In file included from helloworld.cc:1:
In file included from ../../include/fast_io.h:9:
In file included from ../../include/fast_io_hosted.h:18:
In file included from ../../include/fast_io_freestanding.h:12:
In file included from ../../include/fast_io_core.h:17:
In file included from D:\msys64\home\unlvs\projects\windows-msvc-cross-runtimes\include/bit:14:
In file included from D:\msys64\home\unlvs\projects\windows-msvc-cross-runtimes\include/__msvc_bit_utils.hpp:14:
In file included from D:\msys64\home\unlvs\projects\windows-msvc-cross-runtimes\include/intrin.h:35:
In file included from D:\msys64\home\unlvs\projects\windows-msvc-cross-runtimes\include/immintrin.h:30:
In file included from D:\msys64\home\unlvs\projects\windows-msvc-cross-runtimes\include/wmmintrin.h:31:
In file included from D:\msys64\home\unlvs\projects\windows-msvc-cross-runtimes\include/nmmintrin.h:32:
In file included from D:\msys64\home\unlvs\projects\windows-msvc-cross-runtimes\include/smmintrin.h:32:
In file included from D:\msys64\home\unlvs\projects\windows-msvc-cross-runtimes\include/tmmintrin.h:25:
In file included from D:\msys64\home\unlvs\projects\windows-msvc-cross-runtimes\include/pmmintrin.h:34:
In file included from D:\msys64\home\unlvs\projects\windows-msvc-cross-runtimes\include/emmintrin.h:38:
In file included from D:\msys64\home\unlvs\projects\windows-msvc-cross-runtimes\include/xmmintrin.h:46:
D:\msys64\home\unlvs\projects\windows-msvc-cross-runtimes\include/mmintrin.h:34:26: warning: __declspec attribute 'intrin_type' is not supported [-Wignored-attributes]
   34 | typedef union __declspec(intrin_type) __declspec(align(8)) __m64
      |                          ^~~~~~~~~~~
In file included from helloworld.cc:1:
In file included from ../../include/fast_io.h:9:
In file included from ../../include/fast_io_hosted.h:18:
In file included from ../../include/fast_io_freestanding.h:12:
In file included from ../../include/fast_io_core.h:17:
In file included from D:\msys64\home\unlvs\projects\windows-msvc-cross-runtimes\include/bit:14:
In file included from D:\msys64\home\unlvs\projects\windows-msvc-cross-runtimes\include/__msvc_bit_utils.hpp:14:
In file included from D:\msys64\home\unlvs\projects\windows-msvc-cross-runtimes\include/intrin.h:35:
In file included from D:\msys64\home\unlvs\projects\windows-msvc-cross-runtimes\include/immintrin.h:30:
In file included from D:\msys64\home\unlvs\projects\windows-msvc-cross-runtimes\include/wmmintrin.h:31:
In file included from D:\msys64\home\unlvs\projects\windows-msvc-cross-runtimes\include/nmmintrin.h:32:
In file included from D:\msys64\home\unlvs\projects\windows-msvc-cross-runtimes\include/smmintrin.h:32:
In file included from D:\msys64\home\unlvs\projects\windows-msvc-cross-runtimes\include/tmmintrin.h:25:
In file included from D:\msys64\home\unlvs\projects\windows-msvc-cross-runtimes\include/pmmintrin.h:34:
In file included from D:\msys64\home\unlvs\projects\windows-msvc-cross-runtimes\include/emmintrin.h:38:
D:\msys64\home\unlvs\projects\windows-msvc-cross-runtimes\include/xmmintrin.h:65:26: warning: __declspec attribute 'intrin_type' is not supported [-Wignored-attributes]
   65 | typedef union __declspec(intrin_type) __declspec(align(16)) __m128 {
      |                          ^~~~~~~~~~~
In file included from helloworld.cc:1:
In file included from ../../include/fast_io.h:9:
In file included from ../../include/fast_io_hosted.h:18:
In file included from ../../include/fast_io_freestanding.h:12:
In file included from ../../include/fast_io_core.h:17:
In file included from D:\msys64\home\unlvs\projects\windows-msvc-cross-runtimes\include/bit:14:
In file included from D:\msys64\home\unlvs\projects\windows-msvc-cross-runtimes\include/__msvc_bit_utils.hpp:14:
In file included from D:\msys64\home\unlvs\projects\windows-msvc-cross-runtimes\include/intrin.h:35:
In file included from D:\msys64\home\unlvs\projects\windows-msvc-cross-runtimes\include/immintrin.h:30:
In file included from D:\msys64\home\unlvs\projects\windows-msvc-cross-runtimes\include/wmmintrin.h:31:
In file included from D:\msys64\home\unlvs\projects\windows-msvc-cross-runtimes\include/nmmintrin.h:32:
In file included from D:\msys64\home\unlvs\projects\windows-msvc-cross-runtimes\include/smmintrin.h:32:
In file included from D:\msys64\home\unlvs\projects\windows-msvc-cross-runtimes\include/tmmintrin.h:25:
In file included from D:\msys64\home\unlvs\projects\windows-msvc-cross-runtimes\include/pmmintrin.h:34:
D:\msys64\home\unlvs\projects\windows-msvc-cross-runtimes\include/emmintrin.h:40:26: warning: __declspec attribute 'intrin_type' is not supported [-Wignored-attributes]
   40 | typedef union __declspec(intrin_type) __declspec(align(16)) __m128i {
      |                          ^~~~~~~~~~~
D:\msys64\home\unlvs\projects\windows-msvc-cross-runtimes\include/emmintrin.h:51:27: warning: __declspec attribute 'intrin_type' is not supported [-Wignored-attributes]
   51 | typedef struct __declspec(intrin_type) __declspec(align(16)) __m128d {
      |                           ^~~~~~~~~~~
In file included from helloworld.cc:1:
In file included from ../../include/fast_io.h:9:
In file included from ../../include/fast_io_hosted.h:18:
In file included from ../../include/fast_io_freestanding.h:12:
In file included from ../../include/fast_io_core.h:17:
In file included from D:\msys64\home\unlvs\projects\windows-msvc-cross-runtimes\include/bit:14:
In file included from D:\msys64\home\unlvs\projects\windows-msvc-cross-runtimes\include/__msvc_bit_utils.hpp:14:
In file included from D:\msys64\home\unlvs\projects\windows-msvc-cross-runtimes\include/intrin.h:35:
D:\msys64\home\unlvs\projects\windows-msvc-cross-runtimes\include/immintrin.h:39:26: warning: __declspec attribute 'intrin_type' is not supported [-Wignored-attributes]
   39 | typedef union __declspec(intrin_type) __declspec(align(32)) __m256 {
      |                          ^~~~~~~~~~~
D:\msys64\home\unlvs\projects\windows-msvc-cross-runtimes\include/immintrin.h:43:27: warning: __declspec attribute 'intrin_type' is not supported [-Wignored-attributes]
   43 | typedef struct __declspec(intrin_type) __declspec(align(32)) __m256d {
      |                           ^~~~~~~~~~~
D:\msys64\home\unlvs\projects\windows-msvc-cross-runtimes\include/immintrin.h:47:27: warning: __declspec attribute 'intrin_type' is not supported [-Wignored-attributes]
   47 | typedef union  __declspec(intrin_type) __declspec(align(32)) __m256i {
      |                           ^~~~~~~~~~~
In file included from helloworld.cc:1:
In file included from ../../include/fast_io.h:9:
In file included from ../../include/fast_io_hosted.h:18:
In file included from ../../include/fast_io_freestanding.h:12:
In file included from ../../include/fast_io_core.h:17:
In file included from D:\msys64\home\unlvs\projects\windows-msvc-cross-runtimes\include/bit:14:
In file included from D:\msys64\home\unlvs\projects\windows-msvc-cross-runtimes\include/__msvc_bit_utils.hpp:14:
In file included from D:\msys64\home\unlvs\projects\windows-msvc-cross-runtimes\include/intrin.h:35:
In file included from D:\msys64\home\unlvs\projects\windows-msvc-cross-runtimes\include/immintrin.h:2511:
D:\msys64\home\unlvs\projects\windows-msvc-cross-runtimes\include/zmmintrin.h:47:26: warning: __declspec attribute 'intrin_type' is not supported [-Wignored-attributes]
   47 | typedef union __declspec(intrin_type) __declspec(align(64)) __m512 {
      |                          ^~~~~~~~~~~
D:\msys64\home\unlvs\projects\windows-msvc-cross-runtimes\include/zmmintrin.h:51:27: warning: __declspec attribute 'intrin_type' is not supported [-Wignored-attributes]
   51 | typedef struct __declspec(intrin_type) __declspec(align(64)) __m512d {
      |                           ^~~~~~~~~~~
D:\msys64\home\unlvs\projects\windows-msvc-cross-runtimes\include/zmmintrin.h:55:27: warning: __declspec attribute 'intrin_type' is not supported [-Wignored-attributes]
   55 | typedef union  __declspec(intrin_type) __declspec(align(64)) __m512i {
      |                           ^~~~~~~~~~~
In file included from helloworld.cc:1:
In file included from ../../include/fast_io.h:9:
In file included from ../../include/fast_io_hosted.h:18:
In file included from ../../include/fast_io_freestanding.h:12:
In file included from ../../include/fast_io_core.h:18:
D:\msys64\home\unlvs\projects\windows-msvc-cross-runtimes\include/limits:883:16: warning: use of NaN is undefined behavior due to the currently enabled floating-point options [-Wnan-infinity-disabled]
  883 |         return __builtin_nanf("0");
      |                ^~~~~~~~~~~~~~~~~~~
11 warnings generated.
llvmbot commented 4 months ago

@llvm/issue-subscribers-clang-frontend

Author: cqwrteur (trcrsired)

https://github.com/trcrsired/windows-msvc-cross-runtimes/tree/main ```cpp D:\msys64\home\unlvs\projects\fast_io\examples\0001.helloworld>clang++ -o helloworld.exe helloworld.cc -Ofast -std=c++26 --target=x86_64-windows-msvc -I../../include -flto=thin -ID:\msys64\home\unlvs\projects\windows-msvc-cross-runtimes\include -LD:\msys64\home\unlvs\projects\windows-msvc-cross-runtimes\lib\x86_64-windows-msvc -fuse-ld=lld -D_DLL=1 -lmsvcrt -Wall -Wextra In file included from helloworld.cc:1: In file included from ../../include/fast_io.h:9: In file included from ../../include/fast_io_hosted.h:18: In file included from ../../include/fast_io_freestanding.h:12: In file included from ../../include/fast_io_core.h:17: In file included from D:\msys64\home\unlvs\projects\windows-msvc-cross-runtimes\include/bit:14: In file included from D:\msys64\home\unlvs\projects\windows-msvc-cross-runtimes\include/__msvc_bit_utils.hpp:14: In file included from D:\msys64\home\unlvs\projects\windows-msvc-cross-runtimes\include/intrin.h:35: In file included from D:\msys64\home\unlvs\projects\windows-msvc-cross-runtimes\include/immintrin.h:30: In file included from D:\msys64\home\unlvs\projects\windows-msvc-cross-runtimes\include/wmmintrin.h:31: In file included from D:\msys64\home\unlvs\projects\windows-msvc-cross-runtimes\include/nmmintrin.h:32: In file included from D:\msys64\home\unlvs\projects\windows-msvc-cross-runtimes\include/smmintrin.h:32: In file included from D:\msys64\home\unlvs\projects\windows-msvc-cross-runtimes\include/tmmintrin.h:25: In file included from D:\msys64\home\unlvs\projects\windows-msvc-cross-runtimes\include/pmmintrin.h:34: In file included from D:\msys64\home\unlvs\projects\windows-msvc-cross-runtimes\include/emmintrin.h:38: In file included from D:\msys64\home\unlvs\projects\windows-msvc-cross-runtimes\include/xmmintrin.h:46: D:\msys64\home\unlvs\projects\windows-msvc-cross-runtimes\include/mmintrin.h:34:26: warning: __declspec attribute 'intrin_type' is not supported [-Wignored-attributes] 34 | typedef union __declspec(intrin_type) __declspec(align(8)) __m64 | ^~~~~~~~~~~ In file included from helloworld.cc:1: In file included from ../../include/fast_io.h:9: In file included from ../../include/fast_io_hosted.h:18: In file included from ../../include/fast_io_freestanding.h:12: In file included from ../../include/fast_io_core.h:17: In file included from D:\msys64\home\unlvs\projects\windows-msvc-cross-runtimes\include/bit:14: In file included from D:\msys64\home\unlvs\projects\windows-msvc-cross-runtimes\include/__msvc_bit_utils.hpp:14: In file included from D:\msys64\home\unlvs\projects\windows-msvc-cross-runtimes\include/intrin.h:35: In file included from D:\msys64\home\unlvs\projects\windows-msvc-cross-runtimes\include/immintrin.h:30: In file included from D:\msys64\home\unlvs\projects\windows-msvc-cross-runtimes\include/wmmintrin.h:31: In file included from D:\msys64\home\unlvs\projects\windows-msvc-cross-runtimes\include/nmmintrin.h:32: In file included from D:\msys64\home\unlvs\projects\windows-msvc-cross-runtimes\include/smmintrin.h:32: In file included from D:\msys64\home\unlvs\projects\windows-msvc-cross-runtimes\include/tmmintrin.h:25: In file included from D:\msys64\home\unlvs\projects\windows-msvc-cross-runtimes\include/pmmintrin.h:34: In file included from D:\msys64\home\unlvs\projects\windows-msvc-cross-runtimes\include/emmintrin.h:38: D:\msys64\home\unlvs\projects\windows-msvc-cross-runtimes\include/xmmintrin.h:65:26: warning: __declspec attribute 'intrin_type' is not supported [-Wignored-attributes] 65 | typedef union __declspec(intrin_type) __declspec(align(16)) __m128 { | ^~~~~~~~~~~ In file included from helloworld.cc:1: In file included from ../../include/fast_io.h:9: In file included from ../../include/fast_io_hosted.h:18: In file included from ../../include/fast_io_freestanding.h:12: In file included from ../../include/fast_io_core.h:17: In file included from D:\msys64\home\unlvs\projects\windows-msvc-cross-runtimes\include/bit:14: In file included from D:\msys64\home\unlvs\projects\windows-msvc-cross-runtimes\include/__msvc_bit_utils.hpp:14: In file included from D:\msys64\home\unlvs\projects\windows-msvc-cross-runtimes\include/intrin.h:35: In file included from D:\msys64\home\unlvs\projects\windows-msvc-cross-runtimes\include/immintrin.h:30: In file included from D:\msys64\home\unlvs\projects\windows-msvc-cross-runtimes\include/wmmintrin.h:31: In file included from D:\msys64\home\unlvs\projects\windows-msvc-cross-runtimes\include/nmmintrin.h:32: In file included from D:\msys64\home\unlvs\projects\windows-msvc-cross-runtimes\include/smmintrin.h:32: In file included from D:\msys64\home\unlvs\projects\windows-msvc-cross-runtimes\include/tmmintrin.h:25: In file included from D:\msys64\home\unlvs\projects\windows-msvc-cross-runtimes\include/pmmintrin.h:34: D:\msys64\home\unlvs\projects\windows-msvc-cross-runtimes\include/emmintrin.h:40:26: warning: __declspec attribute 'intrin_type' is not supported [-Wignored-attributes] 40 | typedef union __declspec(intrin_type) __declspec(align(16)) __m128i { | ^~~~~~~~~~~ D:\msys64\home\unlvs\projects\windows-msvc-cross-runtimes\include/emmintrin.h:51:27: warning: __declspec attribute 'intrin_type' is not supported [-Wignored-attributes] 51 | typedef struct __declspec(intrin_type) __declspec(align(16)) __m128d { | ^~~~~~~~~~~ In file included from helloworld.cc:1: In file included from ../../include/fast_io.h:9: In file included from ../../include/fast_io_hosted.h:18: In file included from ../../include/fast_io_freestanding.h:12: In file included from ../../include/fast_io_core.h:17: In file included from D:\msys64\home\unlvs\projects\windows-msvc-cross-runtimes\include/bit:14: In file included from D:\msys64\home\unlvs\projects\windows-msvc-cross-runtimes\include/__msvc_bit_utils.hpp:14: In file included from D:\msys64\home\unlvs\projects\windows-msvc-cross-runtimes\include/intrin.h:35: D:\msys64\home\unlvs\projects\windows-msvc-cross-runtimes\include/immintrin.h:39:26: warning: __declspec attribute 'intrin_type' is not supported [-Wignored-attributes] 39 | typedef union __declspec(intrin_type) __declspec(align(32)) __m256 { | ^~~~~~~~~~~ D:\msys64\home\unlvs\projects\windows-msvc-cross-runtimes\include/immintrin.h:43:27: warning: __declspec attribute 'intrin_type' is not supported [-Wignored-attributes] 43 | typedef struct __declspec(intrin_type) __declspec(align(32)) __m256d { | ^~~~~~~~~~~ D:\msys64\home\unlvs\projects\windows-msvc-cross-runtimes\include/immintrin.h:47:27: warning: __declspec attribute 'intrin_type' is not supported [-Wignored-attributes] 47 | typedef union __declspec(intrin_type) __declspec(align(32)) __m256i { | ^~~~~~~~~~~ In file included from helloworld.cc:1: In file included from ../../include/fast_io.h:9: In file included from ../../include/fast_io_hosted.h:18: In file included from ../../include/fast_io_freestanding.h:12: In file included from ../../include/fast_io_core.h:17: In file included from D:\msys64\home\unlvs\projects\windows-msvc-cross-runtimes\include/bit:14: In file included from D:\msys64\home\unlvs\projects\windows-msvc-cross-runtimes\include/__msvc_bit_utils.hpp:14: In file included from D:\msys64\home\unlvs\projects\windows-msvc-cross-runtimes\include/intrin.h:35: In file included from D:\msys64\home\unlvs\projects\windows-msvc-cross-runtimes\include/immintrin.h:2511: D:\msys64\home\unlvs\projects\windows-msvc-cross-runtimes\include/zmmintrin.h:47:26: warning: __declspec attribute 'intrin_type' is not supported [-Wignored-attributes] 47 | typedef union __declspec(intrin_type) __declspec(align(64)) __m512 { | ^~~~~~~~~~~ D:\msys64\home\unlvs\projects\windows-msvc-cross-runtimes\include/zmmintrin.h:51:27: warning: __declspec attribute 'intrin_type' is not supported [-Wignored-attributes] 51 | typedef struct __declspec(intrin_type) __declspec(align(64)) __m512d { | ^~~~~~~~~~~ D:\msys64\home\unlvs\projects\windows-msvc-cross-runtimes\include/zmmintrin.h:55:27: warning: __declspec attribute 'intrin_type' is not supported [-Wignored-attributes] 55 | typedef union __declspec(intrin_type) __declspec(align(64)) __m512i { | ^~~~~~~~~~~ In file included from helloworld.cc:1: In file included from ../../include/fast_io.h:9: In file included from ../../include/fast_io_hosted.h:18: In file included from ../../include/fast_io_freestanding.h:12: In file included from ../../include/fast_io_core.h:18: D:\msys64\home\unlvs\projects\windows-msvc-cross-runtimes\include/limits:883:16: warning: use of NaN is undefined behavior due to the currently enabled floating-point options [-Wnan-infinity-disabled] 883 | return __builtin_nanf("0"); | ^~~~~~~~~~~~~~~~~~~ 11 warnings generated. ```
shafik commented 4 months ago

CC @AaronBallman

AaronBallman commented 3 months ago

This doesn't appear to be a bug with Clang.

1) The compilation is using the MSVC environment: --target=x86_64-windows-msvc 2) The source code is including a header file that eventually gets into header files in D:\msys64\home\unlvs\projects\windows-msvc-cross-runtimes\include that are using Microsoft-specific extensions. We support many of Microsoft's attributes, but don't yet support intrin_type, which is why there are diagnostics about it being ignored.

Closing the issue, but if I've misunderstood the situation, feel free to reopen with more information.