include/intrin: Don't define `__cpuid` and `__cpuidex` for GCC 11
GCC has `__cpuid` as a macro. GCC 11 has `__cpuidex` as a static inline
function taking the same arguments, but without any indicative macros.
Reference: https://github.com/gcc-mirror/gcc/blob/23855a176609fe8dda6abaf2b21846b4517966eb/gcc/config/i386/cpuid.h#L333
Signed-off-by: Liu Hao <lh_mouse@126.com>
(cherry picked from commit d2374f898457b0f4ea8bd4084a94f2dafc87a99a)
diff --git a/mingw-w64-headers/crt/intrin.h b/mingw-w64-headers/crt/intrin.h
index 5dd44b8..8ffe7ec 100644
--- a/mingw-w64-headers/crt/intrin.h
+++ b/mingw-w64-headers/crt/intrin.h
@@ -71,6 +71,10 @@
#endif
#include <x86intrin.h>
+#include <cpuid.h>
+
+/* Undefine the GCC one taking 5 parameters to prefer the mingw-w64 one. */
+#undef __cpuid
/* Before 4.9.2, x86intrin.h had broken versions of these. */
#undef _lrotl
diff --git a/mingw-w64-headers/include/psdk_inc/intrin-impl.h b/mingw-w64-headers/include/psdk_inc/intrin-impl.h
index 27cc26a..d59682c 100644
--- a/mingw-w64-headers/include/psdk_inc/intrin-impl.h
+++ b/mingw-w64-headers/include/psdk_inc/intrin-impl.h
@@ -1906,6 +1906,7 @@
#define __INTRINSIC_DEFINED___cpuid
#endif /* __INTRINSIC_PROLOG */
+#if (!defined(__GNUC__) || __GNUC__ < 11)
#if __INTRINSIC_PROLOG(__cpuidex)
void __cpuidex(int CPUInfo[4], int, int);
#if !__has_builtin(__cpuidex)
@@ -1919,6 +1920,7 @@
#endif
#define __INTRINSIC_DEFINED___cpuidex
#endif /* __INTRINSIC_PROLOG */
+#endif /* __GNUC__ < 11 */
#if __INTRINSIC_PROLOG(__readmsr)
__MINGW_EXTENSION unsigned __int64 __readmsr(unsigned __LONG32);