Commit f0901417 by Roman Lebedev Committed by Dominic Hamon

GetCacheSizesMacOSX(): use consistent types. (#667)

I have absolutely no way to test this, but this looks obviously-good. This was reported by Tim Northover @TNorthover in http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20180903/584223.html > I think this breaks some 32-bit configurations (well, mine at least). > I was using Clang (from Xcode 10 beta) on macOS and got a bunch of > errors referencing sysinfo.cc:292 and onwards: > /Users/tim/llvm/llvm-project/llvm/utils/benchmark/src/sysinfo.cc:292:47: > error: non-constant-expression cannot be narrowed from type > 'std::__1::array<unsigned long long, 4>::value_type' (aka 'unsigned > long long') to 'size_t' (aka 'unsigned long') in initializer list > [-Wc++11-narrowing] > } Cases[] = {{"hw.l1dcachesize", "Data", 1, CacheCounts[1]}, > ^~~~~~~~~~~~~~ > > The same happens when self-hosting ToT. Unfortunately I couldn't > reproduce the issue on Debian (Clang 6.0.1) even with libc++; I'm not > sure what the difference is.
parent a7ed76ad
...@@ -288,7 +288,7 @@ std::vector<CPUInfo::CacheInfo> GetCacheSizesMacOSX() { ...@@ -288,7 +288,7 @@ std::vector<CPUInfo::CacheInfo> GetCacheSizesMacOSX() {
std::string name; std::string name;
std::string type; std::string type;
int level; int level;
size_t num_sharing; uint64_t num_sharing;
} Cases[] = {{"hw.l1dcachesize", "Data", 1, CacheCounts[1]}, } Cases[] = {{"hw.l1dcachesize", "Data", 1, CacheCounts[1]},
{"hw.l1icachesize", "Instruction", 1, CacheCounts[1]}, {"hw.l1icachesize", "Instruction", 1, CacheCounts[1]},
{"hw.l2cachesize", "Unified", 2, CacheCounts[2]}, {"hw.l2cachesize", "Unified", 2, CacheCounts[2]},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment