Comments (4)
I don't have a 32-bit or iOS build to test against. Could you drop a log of the errors into this issue please?
from benchmark.
It turns out to be sufficient to add -Wshorten-64-to-32 to the compilation flags, at least on my system:
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 480d8a5..d46c0dd 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -33,6 +33,7 @@ endif()
# Turn compiler warnings up to 11
include(AddCXXCompilerFlag)
+add_cxx_compiler_flag(-Wshorten-64-to-32)
add_cxx_compiler_flag(-Wall)
add_cxx_compiler_flag(-Wshadow)
add_cxx_compiler_flag(-Werror)
The resulting warnings (treated as errors):
[ 50%] Building CXX object src/CMakeFiles/benchmark.dir/benchmark.cc.o
In file included from /usr/local/src/benchmark/src/benchmark.cc:15:
/usr/local/src/benchmark/include/benchmark/benchmark.h:230:35: error: implicit conversion loses integer precision: 'const int64_t' (aka 'const long long') to 'int' [-Werror,-Wshorten-64-to-32]
int iterations() const { return total_iterations_; }
~~~~~~ ^~~~~~~~~~~~~~~~~
/usr/local/src/benchmark/src/benchmark.cc:119:23: error: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Werror,-Wshorten-64-to-32]
*exponent = i + 1;
~ ~~^~~
/usr/local/src/benchmark/src/benchmark.cc:133:24: error: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Werror,-Wshorten-64-to-32]
*exponent = -i - 1;
~ ~~~^~~
/usr/local/src/benchmark/src/benchmark.cc:351:14: error: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'int' [-Werror,-Wshorten-64-to-32]
return index;
~~~~~~ ^~~~~
/usr/local/src/benchmark/src/benchmark.cc:354:15: error: implicit conversion loses integer precision: 'size_type' (aka 'unsigned long') to 'int' [-Werror,-Wshorten-64-to-32]
int index = families_.size();
~~~~~ ^~~~~~~~~~~~~~~~
/usr/local/src/benchmark/src/benchmark.cc:397:54: error: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'int' [-Werror,-Wshorten-64-to-32]
instances = family->CreateBenchmarkInstances(x, Benchmark::kNoRange);
~~~~~~ ^
/usr/local/src/benchmark/src/benchmark.cc:404:56: error: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'int' [-Werror,-Wshorten-64-to-32]
instances = family->CreateBenchmarkInstances(x, y);
~~~~~~ ^
/usr/local/src/benchmark/src/benchmark.cc:404:59: error: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'int' [-Werror,-Wshorten-64-to-32]
instances = family->CreateBenchmarkInstances(x, y);
~~~~~~ ^
/usr/local/src/benchmark/src/benchmark.cc:1239:65: error: implicit conversion loses integer precision: 'unsigned long' to 'const int' [-Werror,-Wshorten-64-to-32]
std::max<int>(name_field_width, benchmark.name.size() + 17);
~~~ ~~~~~~~~~~~~~~~~~~~~~~^~~~
/usr/local/src/benchmark/src/benchmark.cc:1242:65: error: implicit conversion loses integer precision: 'unsigned long' to 'const int' [-Werror,-Wshorten-64-to-32]
std::max<int>(name_field_width, benchmark.name.size() + 10);
~~~ ~~~~~~~~~~~~~~~~~~~~~~^~~~
/usr/local/src/benchmark/src/benchmark.cc:1245:65: error: implicit conversion loses integer precision: 'unsigned long' to 'const int' [-Werror,-Wshorten-64-to-32]
std::max<int>(name_field_width, benchmark.name.size() + 7);
~~~ ~~~~~~~~~~~~~~~~~~~~~~^~~
/usr/local/src/benchmark/src/benchmark.cc:1247:58: error: implicit conversion loses integer precision: 'size_type' (aka 'unsigned long') to 'const int' [-Werror,-Wshorten-64-to-32]
name_field_width = std::max<int>(name_field_width, benchmark.name.size());
~~~ ^~~~~~~~~~~~~~~~~~~~~
12 errors generated.
make[2]: *** [src/CMakeFiles/benchmark.dir/benchmark.cc.o] Error 1
from benchmark.
Thanks!
from benchmark.
Actually, there's one more:
../../3rdparty/benchmark/src/sleep.cc:30:36: error: implicit conversion loses integer precision: 'long long' to '__darwin_time_t' (aka 'long') [-Werror,-Wshorten-64-to-32]
sleep_time.tv_sec = microseconds / kNumMicrosPerSecond;
~ ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
from benchmark.
Related Issues (20)
- [FR] Add `CMake` option to disable `benchmark_main` target HOT 2
- [BUG] Weird behavior of bytes_per_second and items_per_second HOT 8
- [FR] cp312 release on pypi
- [BUG] Reported iterations per run when using repetitions always the same value? HOT 3
- [BUG] With NDEBUG, early-returning without SkipWithError leads to indefinite retries HOT 5
- Complexity calculation does not work for manual timing
- [FR] Reuse benchmark functions with arbitrary fixture templates
- [FR] BENCHMARK_VERSION is not set by default HOT 4
- [BUG] Iteration count in Report looks suspicious HOT 5
- [Q] Need help with understanding the results HOT 1
- [BUG] benchmark::DoNotOptimize does not prevent a reference from being optimized away. HOT 4
- [FR]disable threads for wasm? HOT 9
- [FR] Remove COMPILER_IBMXL macro for z/OS HOT 4
- [BUG] Fixture test with StrictMock crashed HOT 2
- [BUG] HOT 2
- [FR] possible to stop benchmark loop from doing a memory allocation at the end? HOT 1
- [FR] Please release benchmark 1.8.4 HOT 5
- `Wconversion` compile warnings since `1.8.4` HOT 2
- Update nanobind to v2.0 HOT 2
- [REGRESSION] Cmake script in 1.8.4 says that its version is 0.0.0, libbenchmark_main.so.1 became libbenchmark_main.so.0 HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from benchmark.