From b5e13d0e05ce054f0cdcb3fe07b8572d6124904e Mon Sep 17 00:00:00 2001 From: sebres Date: Sun, 29 Dec 2024 22:19:40 +0000 Subject: [PATCH] windows only: better way to get cpuid data with internal facility of clang/gcc (also silence warning " header is deprecated", including ) --- win/tclWin32Dll.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/win/tclWin32Dll.c b/win/tclWin32Dll.c index d418b56d3dd..017bd0f66cf 100644 --- a/win/tclWin32Dll.c +++ b/win/tclWin32Dll.c @@ -12,7 +12,9 @@ */ #include "tclWinInt.h" -#if defined(HAVE_INTRIN_H) +#if defined (__clang__) || ((__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 8)))) +# include +#elif defined(HAVE_INTRIN_H) # include #endif @@ -661,7 +663,12 @@ TclWinCPUID( { int status = TCL_ERROR; -#if defined(HAVE_INTRIN_H) && defined(_WIN64) && defined(HAVE_CPUID) +#if defined (__clang__) || ((__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 8)))) + + __get_cpuid(index, ®sPtr[0], ®sPtr[1], ®sPtr[2], ®sPtr[3]); + status = TCL_OK; + +#elif defined(HAVE_INTRIN_H) && defined(_WIN64) && defined(HAVE_CPUID) __cpuid((int *)regsPtr, (int)index); status = TCL_OK;