google / benchmark

A microbenchmark support library
Apache License 2.0
8.94k stars 1.62k forks source link

[BUG]error: 'DoNotOptimize<unsigned int>' is deprecated #1561

Closed EnzoLu94 closed 1 year ago

EnzoLu94 commented 1 year ago

Describe the bug Build failed

System Which OS, compiler, and compiler version are you using:

Expected behavior A clear and concise description of what you expected to happen.

Screenshots

ERROR: /home/luyahan/source/wasm-micro-runtime/samples/workload/XNNPACK/xnnpack/build-user-output/e53e44f5d68d2c7b33bc36bf8ecec2f7/external/com_google_benchmark/BUILD.bazel:35:11: Compiling src/sysinfo.cc failed: (Exit 1): emcc.sh failed: error executing command (from target @com_google_benchmark//:benchmark) external/emsdk/emscripten_toolchain/emcc.sh '--sysroot=external/emscripten_bin_linux/emscripten/cache/sysroot' -fdiagnostics-color -fno-exceptions -fno-strict-aliasing -funsigned-char ... (remaining 33 arguments skipped)

Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
external/com_google_benchmark/src/sysinfo.cc:806:3: error: 'DoNotOptimize<unsigned int>' is deprecated: The const-ref version of this method can permit undesired compiler optimizations in benchmarks [-Werror,-Wdeprecated-declarations]
  DoNotOptimize(state);
  ^
bazel-out/wasm-opt/bin/external/com_google_benchmark/_virtual_includes/benchmark/benchmark/benchmark.h:535:1: note: 'DoNotOptimize<unsigned int>' has been explicitly marked deprecated here
BENCHMARK_DEPRECATED_MSG(
^
bazel-out/wasm-opt/bin/external/com_google_benchmark/_virtual_includes/benchmark/benchmark/benchmark.h:236:54: note: expanded from macro 'BENCHMARK_DEPRECATED_MSG'
#define BENCHMARK_DEPRECATED_MSG(msg) __attribute__((deprecated(msg)))
                                                     ^
1 error generated.

Additional context Add any other context about the problem here.

dmah42 commented 1 year ago

hm, when i build i see this as a warning rather than an error.

i'm also not sure why this deprecation message is firing for sysinfo for you as i'm only seeing them failing for tests.

dmah42 commented 1 year ago

doing some much needed cleanup in #1562 but it doesn't affect this.

EnzoLu94 commented 1 year ago

hm, when i build i see this as a warning rather than an error.

i'm also not sure why this deprecation message is firing for sysinfo for you as i'm only seeing them failing for tests.

I build XNNPACK with -Werror. Maybe I can remove it.