Suppress C++23 float_denorm_style deprecation warning in numeric_limits<half>#546
Open
cary-ilm wants to merge 1 commit intoAcademySoftwareFoundation:mainfrom
Open
Suppress C++23 float_denorm_style deprecation warning in numeric_limits<half>#546cary-ilm wants to merge 1 commit intoAcademySoftwareFoundation:mainfrom
cary-ilm wants to merge 1 commit intoAcademySoftwareFoundation:mainfrom
Conversation
…ts<half>
Part of an effort to get CI building without warnings.
C++23 deprecates std::float_denorm_style and std::denorm_present
but does not remove them or provide a replacement; std::numeric_limits
still requires has_denorm to be of that type, so we must use it, which leads to a warning:
src/Imath/half.h:948:22: warning: 'float_denorm_style' is deprecated [-Wdeprecated-declarations]
static constexpr float_denorm_style has_denorm = denorm_present;
^
Suppress the warning for this use and only when building in C++23 (or
later): wrap the has_denorm declaration in compiler-specific pragmas
(GCC/Clang -Wdeprecated-declarations, MSVC 4996) guarded by
(__cplusplus >= 202302L) and the compiler macro. Pre-C++23 builds are
unchanged and use no pragmas.
Made-with: Cursor
Signed-off-by: Cary Phillips <cary@ilm.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Part of an effort to get CI building without warnings.
C++23 deprecates std::float_denorm_style and std::denorm_present but does not remove them or provide a replacement; std::numeric_limits still requires has_denorm to be of that type, so we must use it, which leads to a warning:
Suppress the warning for this use and only when building in C++23 (or later): wrap the has_denorm declaration in compiler-specific pragmas (GCC/Clang -Wdeprecated-declarations, MSVC 4996) guarded by (__cplusplus >= 202302L) and the compiler macro. Pre-C++23 builds are unchanged and use no pragmas.
Made-with: Cursor