You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[libcu++] Add [[nodiscard]] to numeric_limits methods - #12594
No actionable comments were generated in the recent review.
Summary
Summary by CodeRabbit
Improvements
Numeric limit value functions across standard and extended numeric types now produce a compiler warning when their results are ignored, making unconsumed values more visible during development. Function signatures and returned values are unchanged, so existing calculations and calling patterns continue to behave as before. This applies to integral, Boolean, and floating-point numeric limits.
Value-returning functions in the standard and extended numeric limits implementations now use [[nodiscard]] and _CCCL_TRIVIAL_API. Their signatures, return values, and conditional implementations remain unchanged.
Changes: Numeric limits annotations
Layer / File(s)
Summary
Standard numeric limits functions libcudacxx/include/cuda/std/__limits/numeric_limits.h
The generic, integral, bool, float, double, and long double implementations add [[nodiscard]] and replace _CCCL_API with _CCCL_TRIVIAL_API for value-returning functions.
The NVFP16, NVBF16, NVFP8, NVFP6, NVFP4, and __float128 implementations make the same declaration changes. Return expressions and conditional implementations remain unchanged.
Possibly related issues
NVIDIA/cccl#3701: The issue tracks modernize-use-nodiscard and identifies [[nodiscard]] as a relevant API change.
Possibly related PRs
NVIDIA/cccl#12570: Adds the __nv_fp8_ue5m3 numeric limits specialization whose value-returning methods this change annotates.
Suggested reviewers:miscco
Change: Feature
Merge Risk: Minimal · up to 3e3cc
This change adds discard warnings and inlining attributes to numeric limits functions without altering their results. No concrete merge-blocking risk was established.
Architecture risk: Medium · up to 3e3cc
The change affects 1 system.
Changed systems:libcudacxx
Architecture concerns
No architecture-level concerns identified.
Review details
Systems and components
observed — libcudacxx (service) was modified; 2 changed files map to changed impact.
Before / after behavior
observed — Modified behavior in libcudacxx/include/cuda/std/__limits/numeric_limits.h: The generic implementation’s min, max, and lowest declarations are now [[nodiscard]] and use _CCCL_TRIVIAL_API instead of _CCCL_API; signatures and return values are unchanged.
observed — Modified behavior in libcudacxx/include/cuda/std/__limits/numeric_limits.h: The generic implementation’s epsilon and round_error declarations receive the same attribute and API-macro change, with behavior unchanged.
observed — Modified behavior in libcudacxx/include/cuda/std/__limits/numeric_limits.h: The generic implementation’s infinity, NaN, and denormal-minimum declarations receive the same attribute and API-macro change; their bodies are unchanged.
observed — Modified behavior in libcudacxx/include/cuda/std/__limits/numeric_limits.h: The integral implementation’s min, max, lowest, epsilon, and round_error declarations now use [[nodiscard]] and _CCCL_TRIVIAL_API; calculation and return behavior are unchanged.
Reliability and maintainability
inferred — Risk-relevant change factors for libcudacxx: blast_radius_1; direct_dependents_1
- [ ] Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 10 remain after this review.
The supplied max.pass.cpp consumes the results, so it does not check the new diagnostic. Add diagnostic tests for discarded and explicitly void-cast results across representative standard and extended types.
Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 11 remain after this review.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.