-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix passing non-const lvalue refs to DoNotOptimize #1622
Conversation
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
Thank you! |
What i mean is that we should have noticed those new deprecation warnings. |
I'm not familiar with Bazel, and don't know where and how compiler flags are set. For CMake, the deprecations warnings are disabled: Line 192 in 408f9e0
Edit: Apparently also when Lines 200 to 202 in 408f9e0
But |
Yep, no idea whatsoever either.
Well, my point is, we should have some test, which is always compiled with |
TBN, not sure we can globally enable |
I see. We would need some way to explicitly build the library with those flags. Setting compile flags for a test does not affect the library (where the error would be emitted from). For now, I just tried not disabling those warnings (removing |
That statement makes no sense, isn't the exact opposite is true? |
Yes, it's nonsense :) If found that However, benchmark/cmake/GoogleTest.cmake Line 36 in 408f9e0
Causes tests to be compiled with -w , so nothing will be emitted.
I changed it locally to
which will cause the |
214c3fe
to
da135f5
Compare
Hm, are you sure? That is only for building the googletest library itself, |
da135f5
to
998aa39
Compare
My interpretation is: On main, CMakeLists.txt does this: if (BENCHMARK_ENABLE_TESTING)
enable_testing()
if (BENCHMARK_ENABLE_GTEST_TESTS AND
NOT (TARGET gtest AND TARGET gtest_main AND
TARGET gmock AND TARGET gmock_main))
if (BENCHMARK_USE_BUNDLED_GTEST)
include(GoogleTest)
else()
# ...
endif()
endif()
add_subdirectory(test)
endif()
Instead of changing the |
Huh, okay, that does appear broken indeed :| |
998aa39
to
227057d
Compare
227057d
to
3cb21d6
Compare
https://github.com/google/benchmark/blob/main/test/BUILD#L10 for the options that are passed to the tests. not necessary to update here unless it's trivial. |
Nice! Looks like the builds aren't massively failing, that's a very good sign. |
ccc3add
to
676a571
Compare
Formatting should be fixed |
@eseiler so i'm looking at the |
Mhm, when I remove the benchmark.h changes on this branch, there are multiple errors in the I guess I'll have to double check |
I just tried that, and i don't see any (clang16 + release build mode) |
Apparently, clang prefers the So, for clang the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LG.
@dmah42 ?
@eseiler thank you! I've verified that this addresses false-positives i was seeing, |
thanks |
(i'll release 1.8.2 tomorrow my time.. in about 12 hours) |
Resolves #1619
I re-added the
&
overloads that were changed to&&
in df9a99d. New tests do not seem necessary because the existing tests already emitted the deprecation warnings.