@@ -17,8 +17,10 @@ static auto const* volatile Some = &Keywords;
1717
1818static void BM_IntInFzSet (benchmark::State& state) {
1919 for (auto _ : state) {
20- for (auto kw : *Some)
21- volatile bool status = Keywords.count (kw);
20+ for (auto kw : *Some) {
21+ volatile bool status = Keywords.count (kw);
22+ (void ) status;
23+ }
2224 }
2325}
2426BENCHMARK (BM_IntInFzSet);
@@ -27,8 +29,10 @@ static const std::set<int> Keywords_(Keywords.begin(), Keywords.end());
2729
2830static void BM_IntInStdSet (benchmark::State& state) {
2931 for (auto _ : state) {
30- for (auto kw : *Some)
31- volatile bool status = Keywords_.count (kw);
32+ for (auto kw : *Some) {
33+ volatile bool status = Keywords_.count (kw);
34+ (void )status;
35+ }
3236 }
3337}
3438
@@ -42,8 +46,10 @@ static const std::array<int, 32> Keywords__{{
4246}};
4347static void BM_IntInStdArray (benchmark::State& state) {
4448 for (auto _ : state) {
45- for (auto kw : *Some)
46- volatile bool status = std::find (Keywords__.begin (), Keywords__.end (), kw) != Keywords__.end ();
49+ for (auto kw : *Some) {
50+ volatile bool status = std::find (Keywords__.begin (), Keywords__.end (), kw) != Keywords__.end ();
51+ (void )status;
52+ }
4753 }
4854}
4955
@@ -59,24 +65,30 @@ static auto const * volatile SomeIntsPtr = &SomeInts;
5965
6066static void BM_IntNotInFzSet (benchmark::State& state) {
6167 for (auto _ : state) {
62- for (auto kw : *SomeIntsPtr)
63- volatile bool status = Keywords.count (kw);
68+ for (auto kw : *SomeIntsPtr) {
69+ volatile bool status = Keywords.count (kw);
70+ (void )status;
71+ }
6472 }
6573}
6674BENCHMARK (BM_IntNotInFzSet);
6775
6876static void BM_IntNotInStdSet (benchmark::State& state) {
6977 for (auto _ : state) {
70- for (auto kw : *SomeIntsPtr)
71- volatile bool status = Keywords_.count (kw);
78+ for (auto kw : *SomeIntsPtr) {
79+ volatile bool status = Keywords_.count (kw);
80+ (void )status;
81+ }
7282 }
7383}
7484BENCHMARK (BM_IntNotInStdSet);
7585
7686static void BM_IntNotInStdArray (benchmark::State& state) {
7787 for (auto _ : state) {
78- for (auto kw : *SomeIntsPtr)
79- volatile bool status = std::find (Keywords__.begin (), Keywords__.end (), kw) != Keywords__.end ();
88+ for (auto kw : *SomeIntsPtr) {
89+ volatile bool status = std::find (Keywords__.begin (), Keywords__.end (), kw) != Keywords__.end ();
90+ (void )status;
91+ }
8092 }
8193}
8294BENCHMARK (BM_IntNotInStdArray);
0 commit comments