From 6f8449d88e2e8a16fad65aae7e34e7d5765dcced Mon Sep 17 00:00:00 2001 From: Alexey Milovidov Date: Sat, 9 May 2020 21:07:16 +0300 Subject: [PATCH 1/2] Applied a patch from @tavplubix --- libcpuid/cpuid_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libcpuid/cpuid_main.c b/libcpuid/cpuid_main.c index d51e096..0daad06 100644 --- a/libcpuid/cpuid_main.c +++ b/libcpuid/cpuid_main.c @@ -38,7 +38,7 @@ /* Implementation: */ -static int _libcpiud_errno = ERR_OK; +_Thread_local int _libcpiud_errno = ERR_OK; int set_error(cpu_error_t err) { From a9fe7b6aca4e7dfe49c21c221f74ab3b87c15c3b Mon Sep 17 00:00:00 2001 From: alexey-milovidov Date: Mon, 11 May 2020 00:26:23 +0300 Subject: [PATCH 2/2] Update cpuid_main.c --- libcpuid/cpuid_main.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libcpuid/cpuid_main.c b/libcpuid/cpuid_main.c index 0daad06..e98a66f 100644 --- a/libcpuid/cpuid_main.c +++ b/libcpuid/cpuid_main.c @@ -38,7 +38,13 @@ /* Implementation: */ -_Thread_local int _libcpiud_errno = ERR_OK; +#if defined(__STDC_VERSION__) && __STDC_VERSION__ == 201112L + _Thread_local int _libcpiud_errno = ERR_OK; +#elif defined(__GNUC__) // Also works for clang + __thread int _libcpiud_errno = ERR_OK; +#else + static int _libcpiud_errno = ERR_OK; +#endif int set_error(cpu_error_t err) {