From 769287c3848e87068461ea7772ecdc170bbcdb59 Mon Sep 17 00:00:00 2001 From: Guillaume Chatelet Date: Mon, 25 Oct 2021 09:48:46 +0200 Subject: [PATCH] Fixes #185 (#187) Missing `string_view` header and invalid `_Static_assert` statement --- src/cpuinfo_x86.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/cpuinfo_x86.c b/src/cpuinfo_x86.c index 18e88c1..ccbe4aa 100644 --- a/src/cpuinfo_x86.c +++ b/src/cpuinfo_x86.c @@ -102,7 +102,6 @@ defined(CPU_FEATURES_OS_FREEBSD) #include "internal/filesystem.h" // Needed to parse /proc/cpuinfo #include "internal/stack_line_reader.h" // Needed to parse /proc/cpuinfo -#include "internal/string_view.h" // Needed to parse /proc/cpuinfo #elif defined(CPU_FEATURES_OS_DARWIN) #if !defined(HAVE_SYSCTLBYNAME) #error "Darwin needs support for sysctlbyname" @@ -112,6 +111,8 @@ #error "Unsupported OS" #endif // CPU_FEATURES_OS +#include "internal/string_view.h" + //////////////////////////////////////////////////////////////////////////////// // Definitions for CpuId and GetXCR0Eax. //////////////////////////////////////////////////////////////////////////////// @@ -1698,11 +1699,10 @@ void FillX86BrandString(char brand_string[49]) { SafeCpuId(max_cpuid_leaf_ext, 0x80000003), SafeCpuId(max_cpuid_leaf_ext, 0x80000004), }; - const size_t leaves_size = sizeof(leaves); #if __STDC_VERSION__ >= 201112L - _Static_assert(leaves_size == 48, "Leaves must be packed"); + _Static_assert(sizeof(leaves) == 48, "Leaves must be packed"); #endif - CpuFeatures_StringView_CopyString(view((const char*)leaves, leaves_size), + CpuFeatures_StringView_CopyString(view((const char*)leaves, sizeof(leaves)), brand_string, 49); }