Implement P2614R2 Deprecating `float_denorm_style`, `numeric_limits::has_denorm`, `numeric_limits::has_denorm_loss` (#3482)

This commit is contained in:
A. Jiang 2023-04-21 04:50:17 +08:00 коммит произвёл GitHub
Родитель 3c1f3d79ea
Коммит 522149cff1
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
4 изменённых файлов: 27 добавлений и 5 удалений

Просмотреть файл

@ -36,7 +36,8 @@ _STL_DISABLE_CLANG_WARNINGS
#undef new
_STD_BEGIN
_EXPORT_STD enum float_denorm_style { // constants for different IEEE float denormalization styles
// constants for different IEEE float denormalization styles
_EXPORT_STD enum _CXX23_DEPRECATE_DENORM float_denorm_style {
denorm_indeterminate = -1,
denorm_absent = 0,
denorm_present = 1
@ -51,8 +52,11 @@ _EXPORT_STD enum float_round_style { // constants for different IEEE rounding st
};
struct _Num_base { // base for all types, with common defaults
static constexpr float_denorm_style has_denorm = denorm_absent;
static constexpr bool has_denorm_loss = false;
_STL_DISABLE_DEPRECATED_WARNING
_CXX23_DEPRECATE_DENORM static constexpr float_denorm_style has_denorm = denorm_absent;
_CXX23_DEPRECATE_DENORM static constexpr bool has_denorm_loss = false;
_STL_RESTORE_DEPRECATED_WARNING
static constexpr bool has_infinity = false;
static constexpr bool has_quiet_NaN = false;
static constexpr bool has_signaling_NaN = false;
@ -134,7 +138,10 @@ struct _Num_int_base : _Num_base { // base for integer types
};
struct _Num_float_base : _Num_base { // base for floating-point types
static constexpr float_denorm_style has_denorm = denorm_present;
_STL_DISABLE_DEPRECATED_WARNING
_CXX23_DEPRECATE_DENORM static constexpr float_denorm_style has_denorm = denorm_present;
_STL_RESTORE_DEPRECATED_WARNING
static constexpr bool has_infinity = true;
static constexpr bool has_quiet_NaN = true;
static constexpr bool has_signaling_NaN = true;

Просмотреть файл

@ -365,6 +365,7 @@
// _HAS_CXX23 and _SILENCE_ALL_CXX23_DEPRECATION_WARNINGS control:
// P1413R3 Deprecate aligned_storage And aligned_union
// P2614R2 Deprecating float_denorm_style, numeric_limits::has_denorm, numeric_limits::has_denorm_loss
// Other C++23 deprecation warnings
// Parallel Algorithms Notes
@ -1431,7 +1432,18 @@ _EMIT_STL_ERROR(STL1004, "C++98 unexpected() is incompatible with C++23 unexpect
#define _CXX23_DEPRECATE_UNIX_STREAMS
#endif // ^^^ warning disabled ^^^
// next warning number: STL4042
#if _HAS_CXX23 && !defined(_SILENCE_CXX23_DENORM_DEPRECATION_WARNING) \
&& !defined(_SILENCE_ALL_CXX23_DEPRECATION_WARNINGS)
#define _CXX23_DEPRECATE_DENORM \
[[deprecated("warning STL4042: " \
"std::float_denorm_style, std::numeric_limits::has_denorm, and std::numeric_limits::has_denorm_loss " \
"are deprecated in C++23. You can define _SILENCE_CXX23_DENORM_DEPRECATION_WARNING or " \
"_SILENCE_ALL_CXX23_DEPRECATION_WARNINGS to suppress this warning.")]]
#else // ^^^ warning enabled / warning disabled vvv
#define _CXX23_DEPRECATE_DENORM
#endif // ^^^ warning disabled ^^^
// next warning number: STL4043
// next error number: STL1006

Просмотреть файл

@ -6,6 +6,7 @@
#define _SILENCE_CXX17_IS_LITERAL_TYPE_DEPRECATION_WARNING
#define _SILENCE_CXX17_NEGATORS_DEPRECATION_WARNING
#define _SILENCE_CXX20_IS_POD_DEPRECATION_WARNING
#define _SILENCE_CXX23_DENORM_DEPRECATION_WARNING
#include <algorithm>
#include <array>

Просмотреть файл

@ -4,6 +4,8 @@
// test <limits>
#define TEST_NAME "<limits>"
#define _SILENCE_CXX23_DENORM_DEPRECATION_WARNING
#include "tdefs.h"
#include <float.h>
#include <limits.h>