1
0
mirror of https://github.com/google/cpu_features.git synced 2025-07-03 22:23:18 +02:00
Missing `string_view` header and invalid `_Static_assert` statement
This commit is contained in:
Guillaume Chatelet
2021-10-25 09:48:46 +02:00
committed by GitHub
parent cf589a2844
commit 769287c384

View File

@ -102,7 +102,6 @@
defined(CPU_FEATURES_OS_FREEBSD) defined(CPU_FEATURES_OS_FREEBSD)
#include "internal/filesystem.h" // Needed to parse /proc/cpuinfo #include "internal/filesystem.h" // Needed to parse /proc/cpuinfo
#include "internal/stack_line_reader.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) #elif defined(CPU_FEATURES_OS_DARWIN)
#if !defined(HAVE_SYSCTLBYNAME) #if !defined(HAVE_SYSCTLBYNAME)
#error "Darwin needs support for sysctlbyname" #error "Darwin needs support for sysctlbyname"
@ -112,6 +111,8 @@
#error "Unsupported OS" #error "Unsupported OS"
#endif // CPU_FEATURES_OS #endif // CPU_FEATURES_OS
#include "internal/string_view.h"
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// Definitions for CpuId and GetXCR0Eax. // 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, 0x80000003),
SafeCpuId(max_cpuid_leaf_ext, 0x80000004), SafeCpuId(max_cpuid_leaf_ext, 0x80000004),
}; };
const size_t leaves_size = sizeof(leaves);
#if __STDC_VERSION__ >= 201112L #if __STDC_VERSION__ >= 201112L
_Static_assert(leaves_size == 48, "Leaves must be packed"); _Static_assert(sizeof(leaves) == 48, "Leaves must be packed");
#endif #endif
CpuFeatures_StringView_CopyString(view((const char*)leaves, leaves_size), CpuFeatures_StringView_CopyString(view((const char*)leaves, sizeof(leaves)),
brand_string, 49); brand_string, 49);
} }