Skip to content

Commit

Permalink
Fixes #185 (#187)
Browse files Browse the repository at this point in the history
Missing `string_view` header and invalid `_Static_assert` statement
  • Loading branch information
gchatelet authored Oct 25, 2021
1 parent cf589a2 commit 769287c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/cpuinfo_x86.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -112,6 +111,8 @@
#error "Unsupported OS"
#endif // CPU_FEATURES_OS

#include "internal/string_view.h"

////////////////////////////////////////////////////////////////////////////////
// Definitions for CpuId and GetXCR0Eax.
////////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -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);
}

Expand Down

0 comments on commit 769287c

Please sign in to comment.