-
Notifications
You must be signed in to change notification settings - Fork 254
Enable -Wshadow=local #2417
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
Enable -Wshadow=local #2417
Changes from 1 commit
08cef2a
5d0f07c
f6a8a42
9937c3c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,7 +20,7 @@ | |
| cuda_event_timer::cuda_event_timer(benchmark::State& state, | ||
| bool flush_l2_cache, | ||
| rmm::cuda_stream_view stream) | ||
| : stream(stream), p_state(&state) | ||
| : stream_(stream), p_state(&state) | ||
| { | ||
|
Comment on lines
-23
to
24
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. FWIW, as is the case with most style guides, this is tremendously hateful.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @wence- Can you clarify what you mean here? Are you saying you dislike the idea of suffixing member variables with an underscore as a general practice? I don't mind that rule, and I find it somewhat helpful for reasoning about member state.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am ok with us deciding that all struct members should have (say) trailing underscore names. But doing single point rewrites to pacify a warning that I broadly think is just not worth it makes the code worse. I note as well that the ctor body here is no longer implemented correctly (it refers to stream, not stream_) so this warning didn't help us anyway
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks, that is helpful. I agree this will need some polish and close verification to get right. |
||
| // flush all of L2$ | ||
| if (flush_l2_cache) { | ||
|
|
@@ -47,7 +47,7 @@ cuda_event_timer::cuda_event_timer(benchmark::State& state, | |
|
|
||
| cuda_event_timer::~cuda_event_timer() | ||
| { | ||
| RMM_CUDA_ASSERT_OK(cudaEventRecord(stop, stream.value())); | ||
| RMM_CUDA_ASSERT_OK(cudaEventRecord(stop, stream_.value())); | ||
| RMM_CUDA_ASSERT_OK(cudaEventSynchronize(stop)); | ||
|
|
||
| float milliseconds = 0.0F; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,8 +27,8 @@ namespace mr::detail { | |
| */ | ||
| struct block : public block_base { | ||
| block() = default; | ||
| block(char* ptr, std::size_t size, bool is_head) | ||
| : block_base{ptr}, size_bytes{size}, head{is_head} | ||
| block(char* raw_pointer, std::size_t size, bool is_head) | ||
| : block_base{raw_pointer}, size_bytes{size}, head{is_head} | ||
| { | ||
|
Comment on lines
-30
to
32
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why? |
||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,7 +20,7 @@ struct block_base { | |
| void* ptr{}; ///< Raw memory pointer | ||
|
|
||
| block_base() = default; | ||
| block_base(void* ptr) : ptr{ptr} {}; | ||
| block_base(void* raw_pointer) : ptr{raw_pointer} {}; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why? |
||
|
|
||
| /// Returns the raw pointer for this block | ||
| [[nodiscard]] inline void* pointer() const { return ptr; } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -95,8 +95,8 @@ class pinned_host_memory_resource final { | |
| [[maybe_unused]] std::size_t alignment = rmm::CUDA_ALLOCATION_ALIGNMENT) noexcept | ||
| { | ||
| std::size_t constexpr alloc_alignment = rmm::CUDA_ALLOCATION_ALIGNMENT; | ||
| rmm::detail::aligned_host_deallocate(ptr, bytes, alloc_alignment, [](void* ptr) { | ||
| RMM_ASSERT_CUDA_SUCCESS_SAFE_SHUTDOWN(cudaFreeHost(ptr)); | ||
| rmm::detail::aligned_host_deallocate(ptr, bytes, alloc_alignment, [](void* memory) { | ||
| RMM_ASSERT_CUDA_SUCCESS_SAFE_SHUTDOWN(cudaFreeHost(memory)); | ||
| }); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh, I see, |
||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -135,7 +135,7 @@ class system_memory_resource final { | |
| RMM_ASSERT_CUDA_SUCCESS_SAFE_SHUTDOWN(cudaStreamSynchronize(stream.get())); | ||
|
|
||
| rmm::detail::aligned_host_deallocate( | ||
| ptr, bytes, rmm::CUDA_ALLOCATION_ALIGNMENT, [](void* ptr) { ::operator delete(ptr); }); | ||
| ptr, bytes, rmm::CUDA_ALLOCATION_ALIGNMENT, [](void* memory) { ::operator delete(memory); }); | ||
| } | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why? |
||
|
|
||
| /** | ||
|
|
||
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.
why?