Skip to content

Add maybe_unused to ranges and nodiscard to start_range. - #61

Merged
evanramos-nvidia merged 5 commits into
NVIDIA:devfrom
jrhemstad:unused-nodiscard
Dec 17, 2024
Merged

evanramos-nvidia merged 5 commits into
NVIDIA:devfrom
jrhemstad:unused-nodiscard

Conversation

@jrhemstad

Copy link
Copy Markdown
Contributor

Some compilers issues spurious warnings about unused variables for
instances of scoped_range and unique_range. Use [[maybe_unused]] when available
to silence these warnings.

Likewise, added [[nodiscard]] when available to start_range() to issue a warning
if a user accidently forgets to store the result of start_range(). It is not possible to correctly
use start_range() without using the result to call end_range().

Some compilers issues spurious warnings about unused variables for
instances of scoped_range and unique_range. Use [[maybe_unused]] when available
to silence these warnings.

Likewise, added `[[nodiscard]]` when available to `start_range()` to issue a warning
if a user accidently forgets to store the result of `start_range()`. It is not possible to correctly
use `start_range()` without using the result to call `end_range()`.
And adds NVTX3_NO_DISCARD on all the `get()` singleton functions.
@jrhemstad

Copy link
Copy Markdown
Contributor Author

Hey @jcohen-nvidia would you mind reviewing this so we can get it merged?

@evanramos-nvidia
evanramos-nvidia marked this pull request as draft November 6, 2024 15:38
Comment thread c/include/nvtx3/nvtx3.hpp Resolved
Comment thread c/include/nvtx3/nvtx3.hpp Resolved
@evanramos-nvidia
evanramos-nvidia marked this pull request as ready for review December 17, 2024 17:20
@evanramos-nvidia
evanramos-nvidia merged commit c19ecc1 into NVIDIA:dev Dec 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants