Martell Malone
2017-04-14 14:14:48 UTC
Updated clang no longer defines __IA32INTRIN_H so lets do this properly.
I assume intrin-impl.h is only ever included by intrin.h?
If not I will have to find a way to deal with __has_builtin in both files
Please Review
Kind Regards
Martell
diff --git a/mingw-w64-crt/intrincs/rdtsc.c b/mingw-w64-crt/intrincs/rdtsc.c
index fd9cb75d..11e8d597 100644
--- a/mingw-w64-crt/intrincs/rdtsc.c
+++ b/mingw-w64-crt/intrincs/rdtsc.c
@@ -4,11 +4,9 @@
* No warranty is given; refer to the file DISCLAIMER.PD within this
package.
*/
-#ifdef __clang__
-#define __IA32INTRIN_H
-#endif
#include <intrin.h>
+#if !__has_builtin(__rdtsc)
unsigned __int64 __rdtsc(void)
{
#ifdef _WIN64
@@ -21,4 +19,4 @@ unsigned __int64 __rdtsc(void)
: "=a" (val1), "=d" (val2));
return ((unsigned __int64)val1) | (((unsigned __int64)val2) << 32);
}
-
+#endif
diff --git a/mingw-w64-headers/crt/intrin.h b/mingw-w64-headers/crt/intrin.h
index 0b2343fb..75bc3e30 100644
--- a/mingw-w64-headers/crt/intrin.h
+++ b/mingw-w64-headers/crt/intrin.h
@@ -38,6 +38,13 @@
#include <setjmp.h>
#endif
#include <stddef.h>
+
+/* Clang has support for MSVC builtins, GCC doesn't */
+#pragma push_macro("__has_builtin")
+#ifndef __has_builtin
+ #define __has_builtin(x) 0
+#endif
+
#include <psdk_inc/intrin-impl.h>
/*
diff --git a/mingw-w64-headers/include/psdk_inc/intrin-impl.h
b/mingw-w64-headers/include/psdk_inc/intrin-impl.h
index 340d6fba..58af8804 100644
--- a/mingw-w64-headers/include/psdk_inc/intrin-impl.h
+++ b/mingw-w64-headers/include/psdk_inc/intrin-impl.h
@@ -61,12 +61,6 @@ __INTRINSICS_USEINLINE
#ifdef __MINGW_INTRIN_INLINE
-/* Clang has support for MSVC builtins, GCC doesn't */
-#pragma push_macro("__has_builtin")
-#ifndef __has_builtin
- #define __has_builtin(x) 0
-#endif
-
/* These macros are used by the routines below. While this file may be
included
multiple times, these macros only need to be defined once. */
#ifndef _INTRIN_MAC_
I assume intrin-impl.h is only ever included by intrin.h?
If not I will have to find a way to deal with __has_builtin in both files
Please Review
Kind Regards
Martell
diff --git a/mingw-w64-crt/intrincs/rdtsc.c b/mingw-w64-crt/intrincs/rdtsc.c
index fd9cb75d..11e8d597 100644
--- a/mingw-w64-crt/intrincs/rdtsc.c
+++ b/mingw-w64-crt/intrincs/rdtsc.c
@@ -4,11 +4,9 @@
* No warranty is given; refer to the file DISCLAIMER.PD within this
package.
*/
-#ifdef __clang__
-#define __IA32INTRIN_H
-#endif
#include <intrin.h>
+#if !__has_builtin(__rdtsc)
unsigned __int64 __rdtsc(void)
{
#ifdef _WIN64
@@ -21,4 +19,4 @@ unsigned __int64 __rdtsc(void)
: "=a" (val1), "=d" (val2));
return ((unsigned __int64)val1) | (((unsigned __int64)val2) << 32);
}
-
+#endif
diff --git a/mingw-w64-headers/crt/intrin.h b/mingw-w64-headers/crt/intrin.h
index 0b2343fb..75bc3e30 100644
--- a/mingw-w64-headers/crt/intrin.h
+++ b/mingw-w64-headers/crt/intrin.h
@@ -38,6 +38,13 @@
#include <setjmp.h>
#endif
#include <stddef.h>
+
+/* Clang has support for MSVC builtins, GCC doesn't */
+#pragma push_macro("__has_builtin")
+#ifndef __has_builtin
+ #define __has_builtin(x) 0
+#endif
+
#include <psdk_inc/intrin-impl.h>
/*
diff --git a/mingw-w64-headers/include/psdk_inc/intrin-impl.h
b/mingw-w64-headers/include/psdk_inc/intrin-impl.h
index 340d6fba..58af8804 100644
--- a/mingw-w64-headers/include/psdk_inc/intrin-impl.h
+++ b/mingw-w64-headers/include/psdk_inc/intrin-impl.h
@@ -61,12 +61,6 @@ __INTRINSICS_USEINLINE
#ifdef __MINGW_INTRIN_INLINE
-/* Clang has support for MSVC builtins, GCC doesn't */
-#pragma push_macro("__has_builtin")
-#ifndef __has_builtin
- #define __has_builtin(x) 0
-#endif
-
/* These macros are used by the routines below. While this file may be
included
multiple times, these macros only need to be defined once. */
#ifndef _INTRIN_MAC_