mstorsjo added a comment.

In D150646#4379543 <https://reviews.llvm.org/D150646#4379543>, @glandium wrote:

> There seem to still be two problems with this change, with mingw:
>
> - with `-fms-extensions`:
>
>   echo '#include "cpuid.h"' | ./clang/bin/clang++ 
> --target=x86_64-w64-windows-gnu -xc++ - -fms-extensions
>   In file included from <stdin>:1:
>   /tmp/clang/lib/clang/17/include/cpuid.h:334:22: error: definition of 
> builtin function '__cpuidex'
>   static __inline void __cpuidex (int __cpu_info[4], int __leaf, int 
> __subleaf)
>                        ^
>   1 error generated.

Ouch - this one is tricky, as `-fms-extensions` doesn't seem to set any define 
(it doesn't set `_MSC_EXTENSIONS` at least - and I don't know if it would 
unlock surprises all around if it started doing that?); the main noticable 
difference in the output of `clang -E -dM - < /dev/null` seems to be that 
`__stdcall` and `__cdecl` and other calling conventions no longer are defines. 
But that's a rather brittle thing to check against.

> - conflict with mingw headers without the extensions:
>
>   $ echo '#include "intrin.h"' | ./clang/bin/x86_64-w64-mingw32-clang++ -xc++ 
> -
>   In file included from <stdin>:1:
>   In file included from /tmp/clang/lib/clang/17/include/intrin.h:12:
>   In file included from 
> /tmp/clang/bin/../x86_64-w64-mingw32/include/intrin.h:70:
>   /tmp/clang/lib/clang/17/include/cpuid.h:334:22: error: static declaration 
> of '__cpuidex' follows non-static declaration
>   static __inline void __cpuidex (int __cpu_info[4], int __leaf, int 
> __subleaf)
>                        ^
>   /tmp/clang/bin/../x86_64-w64-mingw32/include/psdk_inc/intrin-impl.h:2031:6: 
> note: previous definition is here
>   void __cpuidex(int CPUInfo[4], int function_id, int subfunction_id) {
>        ^
>   1 error generated.
>
> Although, for the latter, this was "fixed" in 
> https://sourceforge.net/p/mingw-w64/mingw-w64/ci/2b6c9247613aa830374e3686e09d3b8d582a92a6/

Regarding "fixed" - do you see any better way of fixing it there? As it's a 
static inline function, there's no simple way of knowing whether it was already 
defined or not; I went with the same pattern used for the existing version 
check for GCC.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D150646/new/

https://reviews.llvm.org/D150646

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to