]> mj.ucw.cz Git - pciutils.git/commitdiff
libpci: i386-io-windows.h: Do not define __readeflags() for GCC 4.9+
authorPali Rohár <pali@kernel.org>
Sat, 16 Apr 2022 15:23:45 +0000 (17:23 +0200)
committerPali Rohár <pali@kernel.org>
Mon, 20 Jun 2022 17:45:34 +0000 (19:45 +0200)
GCC header file <x86intrin.h> defines static inline function __readeflags()
which calls correct __builtin_ia32_readeflags_XX() builtin.

Header file <x86intrin.h> is included by MinGW-w64's <intrin.h> header file
in new versions of MinGW-w64 and <intrin.h> may be included transitionally
by some other header files automatically.

Defining __readeflags() as both macro and static inline function cause
compile errors.

Fix this compile error by not defining __readeflags() macro and instead
include GCC header file <x86intrin.h>.

lib/i386-io-windows.h

index ac2a55dfb7ba337f41cf712de86c3dcfc69a167e..1509d7de86803252718d3f70aa11054872b841a6 100644 (file)
@@ -107,16 +107,13 @@ unsigned long _inpd(unsigned short port);
  * function conflicts with some MSVC intrinsic.
  * MSVC supports inline assembly via __asm keyword in 32-bit mode only.
  * GCC version 4.9.0 and higher provides __builtin_ia32_readeflags_uXX()
- * builtin for XX-mode.
+ * builtin for XX-mode. This builtin is also available as __readeflags()
+ * function indirectly via <x86intrin.h> header file.
  */
 #if defined(_MSC_VER) && (_MSC_VER >= 1500 || (_MSC_VER >= 1400 && defined(__BUILDMACHINE__)))
 #pragma intrinsic(__readeflags)
 #elif defined(__GNUC__) && ((__GNUC__ == 4 && __GNUC_MINOR__ >= 9) || (__GNUC__ > 4))
-#ifdef __x86_64__
-#define __readeflags() __builtin_ia32_readeflags_u64()
-#else
-#define __readeflags() __builtin_ia32_readeflags_u32()
-#endif
+#include <x86intrin.h>
 #elif defined(_MSC_VER) && defined(_M_IX86)
 static inline unsigned int
 __readeflags(void)