Skip to content

Commit

Permalink
Merge bitcoin/bitcoin#24372: bench: Avoid deprecated use of volatile +=
Browse files Browse the repository at this point in the history
9999f89 bench: Avoid deprecated use of volatile += (MarcoFalke)

Pull request description:

  Deprecated in C++20 according to https://eel.is/c++draft/expr.ass#6 .

  ```
  bench/examples.cpp:16:13: warning: compound assignment with ‘volatile’-qualified left operand is deprecated [-Wvolatile]
     16 |         sum += sin(d);
        |         ~~~~^~~~~~~~~
  ```

  While C++20 is currently unsupported, I don't see any downside to a minor fixup to an example benchmark. This will also make a hypothetical C++20 patch smaller.

ACKs for top commit:
  fanquake:
    ACK 9999f89

Tree-SHA512: ca7d660fa8eba347a4648408a8b97a0ecb8263a825da7abd59129d783058102581e05b273667989f95480436a66d5384bd1e92d9ae79408f5b30e2178935cc38
  • Loading branch information
fanquake committed Feb 23, 2022
2 parents 16d05cf + 9999f89 commit 9977e16
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/bench/examples.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ static void Trig(benchmark::Bench& bench)
{
double d = 0.01;
bench.run([&] {
sum += sin(d);
sum = sum + sin(d);
d += 0.000001;
});
}
Expand Down

0 comments on commit 9977e16

Please sign in to comment.