This is an archive of the discontinued LLVM Phabricator instance.

[libc++] Fix minor warnings in libcxx benchmarks
ClosedPublic

Authored by ilvokhin on Jul 30 2023, 6:28 AM.

Details

Reviewers
Mordante
Group Reviewers
Restricted Project
Commits
rG3df9c2984b4e: [libc++] Fix minor warnings in libcxx benchmarks
Summary
llvm-project/libcxx/benchmarks/allocation.bench.cpp:80:16: warning: unused
variable 'End' [-Wunused-variable]
   80 |   void** const End = Pointers.data() + Pointers.size();
      |

End is used in assert later, but benchmarks usually built in release
mode, so this warning triggers every time.

llvm-project/libcxx/benchmarks/monotonic_buffer.bench.cpp:19:26:
warning: comparison of integers of different signs: 'size_t' (aka 'unsigned
long') and 'int64_t' (aka 'long long') [-Wsign-compare]
   19 |     for (size_t i = 0; i != state.range(); ++i) {
      |

Made variable i type int64_t instead of size_t.

Diff Detail

Event Timeline

ilvokhin created this revision.Jul 30 2023, 6:28 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 30 2023, 6:28 AM
ilvokhin requested review of this revision.Jul 30 2023, 6:28 AM
ilvokhin updated this revision to Diff 545432.Jul 30 2023, 6:47 AM

Fix formatting.

Thanks for working on this! A few comments.

libcxx/benchmarks/allocation.bench.cpp
80

I prefer a [[maybe_unused]] attribute instead. That makes it easier to inspect the value in the debugger.

libcxx/benchmarks/monotonic_buffer.bench.cpp
19

I see we use size_t in other benchmarks too. Can you fix all of them?

ilvokhin updated this revision to Diff 545463.Jul 30 2023, 12:29 PM

Comments addressed.

ilvokhin marked an inline comment as done.Jul 30 2023, 12:32 PM
ilvokhin added inline comments.
libcxx/benchmarks/monotonic_buffer.bench.cpp
19

Sure, I don't mind fixing others as well, but I couldn't find any.

The problem is state.range() as it returns int64_t. I searched for other use cases in libcxx/benchmarks and they don't have such problem as they result used to directly initialize vector size.

ilvokhin retitled this revision from [libc++] Fix minor warning is libcxx benchmarks to [libc++] Fix minor warnings in libcxx benchmarks.Jul 31 2023, 11:19 AM
Mordante accepted this revision.Sep 11 2023, 10:10 AM

Sorry I missed the ping. LGTM!

This revision is now accepted and ready to land.Sep 11 2023, 10:10 AM

Thanks for review. I don't have commit access. Could you please land the patch in my behalf?

Dmitry Ilvokhin
d@ilvokhin.com

This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptSep 13 2023, 2:07 PM