From 04bddd8b38599934bb012424502e204c0954269b Mon Sep 17 00:00:00 2001 From: "A. Jiang" Date: Mon, 20 Feb 2023 10:16:15 +0800 Subject: [PATCH 01/18] Implement P2614R2 and LWG-3869 --- stl/inc/limits | 78 +++++++++++----------- stl/inc/xerrc.h | 156 +++++++++++++++++++++---------------------- stl/inc/yvals_core.h | 28 +++++++- 3 files changed, 144 insertions(+), 118 deletions(-) diff --git a/stl/inc/limits b/stl/inc/limits index 01e0f119c50..ae4a70a0762 100644 --- a/stl/inc/limits +++ b/stl/inc/limits @@ -10,7 +10,6 @@ #if _STL_COMPILER_PREPROCESSOR #include #include -#include #include _STL_INTRIN_HEADER #include #include @@ -35,10 +34,11 @@ _STL_DISABLE_CLANG_WARNINGS #undef new _STD_BEGIN -_EXPORT_STD enum float_denorm_style { // constants for different IEEE float denormalization styles - denorm_indeterminate = -1, - denorm_absent = 0, - denorm_present = 1 +// constants for different IEEE float denormalization styles +_EXPORT_STD enum _CXX23_DEPRECATE_DENOM float_denorm_style { + denorm_indeterminate _CXX23_DEPRECATE_DENOM = -1, + denorm_absent _CXX23_DEPRECATE_DENOM = 0, + denorm_present _CXX23_DEPRECATE_DENOM = 1 }; _EXPORT_STD enum float_round_style { // constants for different IEEE rounding styles @@ -50,29 +50,29 @@ _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; - static constexpr bool has_infinity = false; - static constexpr bool has_quiet_NaN = false; - static constexpr bool has_signaling_NaN = false; - static constexpr bool is_bounded = false; - static constexpr bool is_exact = false; - static constexpr bool is_iec559 = false; - static constexpr bool is_integer = false; - static constexpr bool is_modulo = false; - static constexpr bool is_signed = false; - static constexpr bool is_specialized = false; - static constexpr bool tinyness_before = false; - static constexpr bool traps = false; - static constexpr float_round_style round_style = round_toward_zero; - static constexpr int digits = 0; - static constexpr int digits10 = 0; - static constexpr int max_digits10 = 0; - static constexpr int max_exponent = 0; - static constexpr int max_exponent10 = 0; - static constexpr int min_exponent = 0; - static constexpr int min_exponent10 = 0; - static constexpr int radix = 0; + _CXX23_DEPRECATE_DENOM static constexpr float_denorm_style has_denorm = denorm_absent; + _CXX23_DEPRECATE_DENOM static constexpr bool has_denorm_loss = false; + static constexpr bool has_infinity = false; + static constexpr bool has_quiet_NaN = false; + static constexpr bool has_signaling_NaN = false; + static constexpr bool is_bounded = false; + static constexpr bool is_exact = false; + static constexpr bool is_iec559 = false; + static constexpr bool is_integer = false; + static constexpr bool is_modulo = false; + static constexpr bool is_signed = false; + static constexpr bool is_specialized = false; + static constexpr bool tinyness_before = false; + static constexpr bool traps = false; + static constexpr float_round_style round_style = round_toward_zero; + static constexpr int digits = 0; + static constexpr int digits10 = 0; + static constexpr int max_digits10 = 0; + static constexpr int max_exponent = 0; + static constexpr int max_exponent10 = 0; + static constexpr int min_exponent = 0; + static constexpr int min_exponent10 = 0; + static constexpr int radix = 0; }; _EXPORT_STD template @@ -133,16 +133,16 @@ 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; - static constexpr bool has_infinity = true; - static constexpr bool has_quiet_NaN = true; - static constexpr bool has_signaling_NaN = true; - static constexpr bool is_bounded = true; - static constexpr bool is_iec559 = true; - static constexpr bool is_signed = true; - static constexpr bool is_specialized = true; - static constexpr float_round_style round_style = round_to_nearest; - static constexpr int radix = FLT_RADIX; + _CXX23_DEPRECATE_DENOM static constexpr float_denorm_style has_denorm = denorm_present; + static constexpr bool has_infinity = true; + static constexpr bool has_quiet_NaN = true; + static constexpr bool has_signaling_NaN = true; + static constexpr bool is_bounded = true; + static constexpr bool is_iec559 = true; + static constexpr bool is_signed = true; + static constexpr bool is_specialized = true; + static constexpr float_round_style round_style = round_to_nearest; + static constexpr int radix = FLT_RADIX; }; template <> @@ -462,7 +462,7 @@ public: } _NODISCARD static constexpr wchar_t(max)() noexcept { - return WCHAR_MAX; + return 0xFFFF; } _NODISCARD static constexpr wchar_t lowest() noexcept { diff --git a/stl/inc/xerrc.h b/stl/inc/xerrc.h index 86bb85850e5..bf7651ae6cc 100644 --- a/stl/inc/xerrc.h +++ b/stl/inc/xerrc.h @@ -18,84 +18,84 @@ _STL_DISABLE_CLANG_WARNINGS _STD_BEGIN _EXPORT_STD enum class errc { // names for generic error codes - address_family_not_supported = 102, // EAFNOSUPPORT - address_in_use = 100, // EADDRINUSE - address_not_available = 101, // EADDRNOTAVAIL - already_connected = 113, // EISCONN - argument_list_too_long = 7, // E2BIG - argument_out_of_domain = 33, // EDOM - bad_address = 14, // EFAULT - bad_file_descriptor = 9, // EBADF - bad_message = 104, // EBADMSG - broken_pipe = 32, // EPIPE - connection_aborted = 106, // ECONNABORTED - connection_already_in_progress = 103, // EALREADY - connection_refused = 107, // ECONNREFUSED - connection_reset = 108, // ECONNRESET - cross_device_link = 18, // EXDEV - destination_address_required = 109, // EDESTADDRREQ - device_or_resource_busy = 16, // EBUSY - directory_not_empty = 41, // ENOTEMPTY - executable_format_error = 8, // ENOEXEC - file_exists = 17, // EEXIST - file_too_large = 27, // EFBIG - filename_too_long = 38, // ENAMETOOLONG - function_not_supported = 40, // ENOSYS - host_unreachable = 110, // EHOSTUNREACH - identifier_removed = 111, // EIDRM - illegal_byte_sequence = 42, // EILSEQ - inappropriate_io_control_operation = 25, // ENOTTY - interrupted = 4, // EINTR - invalid_argument = 22, // EINVAL - invalid_seek = 29, // ESPIPE - io_error = 5, // EIO - is_a_directory = 21, // EISDIR - message_size = 115, // EMSGSIZE - network_down = 116, // ENETDOWN - network_reset = 117, // ENETRESET - network_unreachable = 118, // ENETUNREACH - no_buffer_space = 119, // ENOBUFS - no_child_process = 10, // ECHILD - no_link = 121, // ENOLINK - no_lock_available = 39, // ENOLCK - no_message_available = 120, // ENODATA - no_message = 122, // ENOMSG - no_protocol_option = 123, // ENOPROTOOPT - no_space_on_device = 28, // ENOSPC - no_stream_resources = 124, // ENOSR - no_such_device_or_address = 6, // ENXIO - no_such_device = 19, // ENODEV - no_such_file_or_directory = 2, // ENOENT - no_such_process = 3, // ESRCH - not_a_directory = 20, // ENOTDIR - not_a_socket = 128, // ENOTSOCK - not_a_stream = 125, // ENOSTR - not_connected = 126, // ENOTCONN - not_enough_memory = 12, // ENOMEM - not_supported = 129, // ENOTSUP - operation_canceled = 105, // ECANCELED - operation_in_progress = 112, // EINPROGRESS - operation_not_permitted = 1, // EPERM - operation_not_supported = 130, // EOPNOTSUPP - operation_would_block = 140, // EWOULDBLOCK - owner_dead = 133, // EOWNERDEAD - permission_denied = 13, // EACCES - protocol_error = 134, // EPROTO - protocol_not_supported = 135, // EPROTONOSUPPORT - read_only_file_system = 30, // EROFS - resource_deadlock_would_occur = 36, // EDEADLK - resource_unavailable_try_again = 11, // EAGAIN - result_out_of_range = 34, // ERANGE - state_not_recoverable = 127, // ENOTRECOVERABLE - stream_timeout = 137, // ETIME - text_file_busy = 139, // ETXTBSY - timed_out = 138, // ETIMEDOUT - too_many_files_open_in_system = 23, // ENFILE - too_many_files_open = 24, // EMFILE - too_many_links = 31, // EMLINK - too_many_symbolic_link_levels = 114, // ELOOP - value_too_large = 132, // EOVERFLOW - wrong_protocol_type = 136 // EPROTOTYPE + address_family_not_supported = 102, // EAFNOSUPPORT + address_in_use = 100, // EADDRINUSE + address_not_available = 101, // EADDRNOTAVAIL + already_connected = 113, // EISCONN + argument_list_too_long = 7, // E2BIG + argument_out_of_domain = 33, // EDOM + bad_address = 14, // EFAULT + bad_file_descriptor = 9, // EBADF + bad_message = 104, // EBADMSG + broken_pipe = 32, // EPIPE + connection_aborted = 106, // ECONNABORTED + connection_already_in_progress = 103, // EALREADY + connection_refused = 107, // ECONNREFUSED + connection_reset = 108, // ECONNRESET + cross_device_link = 18, // EXDEV + destination_address_required = 109, // EDESTADDRREQ + device_or_resource_busy = 16, // EBUSY + directory_not_empty = 41, // ENOTEMPTY + executable_format_error = 8, // ENOEXEC + file_exists = 17, // EEXIST + file_too_large = 27, // EFBIG + filename_too_long = 38, // ENAMETOOLONG + function_not_supported = 40, // ENOSYS + host_unreachable = 110, // EHOSTUNREACH + identifier_removed = 111, // EIDRM + illegal_byte_sequence = 42, // EILSEQ + inappropriate_io_control_operation = 25, // ENOTTY + interrupted = 4, // EINTR + invalid_argument = 22, // EINVAL + invalid_seek = 29, // ESPIPE + io_error = 5, // EIO + is_a_directory = 21, // EISDIR + message_size = 115, // EMSGSIZE + network_down = 116, // ENETDOWN + network_reset = 117, // ENETRESET + network_unreachable = 118, // ENETUNREACH + no_buffer_space = 119, // ENOBUFS + no_child_process = 10, // ECHILD + no_link = 121, // ENOLINK + no_lock_available = 39, // ENOLCK + no_message_available _CXX23_DEPRECATE_UNIX_STREAM = 120, // ENODATA + no_message = 122, // ENOMSG + no_protocol_option = 123, // ENOPROTOOPT + no_space_on_device = 28, // ENOSPC + no_stream_resources _CXX23_DEPRECATE_UNIX_STREAM = 124, // ENOSR + no_such_device_or_address = 6, // ENXIO + no_such_device = 19, // ENODEV + no_such_file_or_directory = 2, // ENOENT + no_such_process = 3, // ESRCH + not_a_directory = 20, // ENOTDIR + not_a_socket = 128, // ENOTSOCK + not_a_stream _CXX23_DEPRECATE_UNIX_STREAM = 125, // ENOSTR + not_connected = 126, // ENOTCONN + not_enough_memory = 12, // ENOMEM + not_supported = 129, // ENOTSUP + operation_canceled = 105, // ECANCELED + operation_in_progress = 112, // EINPROGRESS + operation_not_permitted = 1, // EPERM + operation_not_supported = 130, // EOPNOTSUPP + operation_would_block = 140, // EWOULDBLOCK + owner_dead = 133, // EOWNERDEAD + permission_denied = 13, // EACCES + protocol_error = 134, // EPROTO + protocol_not_supported = 135, // EPROTONOSUPPORT + read_only_file_system = 30, // EROFS + resource_deadlock_would_occur = 36, // EDEADLK + resource_unavailable_try_again = 11, // EAGAIN + result_out_of_range = 34, // ERANGE + state_not_recoverable = 127, // ENOTRECOVERABLE + stream_timeout _CXX23_DEPRECATE_UNIX_STREAM = 137, // ETIME + text_file_busy = 139, // ETXTBSY + timed_out = 138, // ETIMEDOUT + too_many_files_open_in_system = 23, // ENFILE + too_many_files_open = 24, // EMFILE + too_many_links = 31, // EMLINK + too_many_symbolic_link_levels = 114, // ELOOP + value_too_large = 132, // EOVERFLOW + wrong_protocol_type = 136 // EPROTOTYPE }; _STD_END diff --git a/stl/inc/yvals_core.h b/stl/inc/yvals_core.h index ce8d39dcec3..1c90b21e77c 100644 --- a/stl/inc/yvals_core.h +++ b/stl/inc/yvals_core.h @@ -1403,7 +1403,33 @@ _EMIT_STL_ERROR(STL1004, "C++98 unexpected() is incompatible with C++23 unexpect // STL4040 is used to warn that "The contents of require static RTTI." -// next warning number: STL4041 +#if _HAS_CXX23 && !defined(_SILENCE_CXX23_DENOM_DEPRECATION_WARNING) \ + && !defined(_SILENCE_ALL_CXX23_DEPRECATION_WARNINGS) +#define _CXX23_DEPRECATE_DENOM \ + [[deprecated("warning STL4041: " \ + "std::float_denorm_style, std::numeric_limits::has_denorm, and " \ + "std::numeric_limits::has_denorm_loss are deprecated in C++23. They are not well specified and " \ + "should not be dependent on. You can define _SILENCE_CXX23_DENOM_WARNING or " \ + "_SILENCE_ALL_CXX23_DEPRECATION_WARNINGS to suppress this warning.")]] +#else // ^^^ warning enabled / warning disabled vvv +#define _CXX23_DEPRECATE_DENOM +#endif // ^^^ warning disabled ^^^ + +#if _HAS_CXX23 && !defined(_SILENCE_CXX23_UNIX_STREAM_DEPRECATION_WARNING) \ + && !defined(_SILENCE_ALL_CXX23_DEPRECATION_WARNINGS) +#define _CXX23_DEPRECATE_UNIX_STREAM \ + [[deprecated( \ + "warning STL4042: " \ + "std::errc enumerators std::errc::no_message_available, std::errc::no_stream_resources, " \ + "std::errc::not_a_stream, and std::errc::stream_timeout and their corresponding errno macros ENODATA, ENOSR, " \ + "ENOSTR and ETIME are deprecated in C++23 by LWG-3869. These errno macros are deprecated in POSIX 2008 and " \ + "removed in POSIX 202x. You can define _SILENCE_CXX23_UNIX_STREAM_WARNING or " \ + "_SILENCE_ALL_CXX23_DEPRECATION_WARNINGS to suppress this warning.")]] +#else // ^^^ warning enabled / warning disabled vvv +#define _CXX23_DEPRECATE_UNIX_STREAM +#endif // ^^^ warning disabled ^^^ + +// next warning number: STL4043 // next error number: STL1006 From f969f3deedd8058e7fabb7ccbf78a25ecb896b66 Mon Sep 17 00:00:00 2001 From: "A. Jiang" Date: Mon, 20 Feb 2023 10:16:58 +0800 Subject: [PATCH 02/18] `_SILENCE_CXX23_UNIX_STREAM_DEPRECATION_WARNING` --- tests/tr1/tests/system_error/test.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/tr1/tests/system_error/test.cpp b/tests/tr1/tests/system_error/test.cpp index a80cbf3b373..809ef8625a8 100644 --- a/tests/tr1/tests/system_error/test.cpp +++ b/tests/tr1/tests/system_error/test.cpp @@ -4,6 +4,8 @@ // test #define TEST_NAME "" +#define _SILENCE_CXX23_UNIX_STREAM_DEPRECATION_WARNING + #include "tdefs.h" #include #include From b777537957abec0f94f114420f9de696b5ec9d0b Mon Sep 17 00:00:00 2001 From: "A. Jiang" Date: Mon, 20 Feb 2023 10:17:34 +0800 Subject: [PATCH 03/18] `_SILENCE_CXX23_DENOM_DEPRECATION_WARNING` --- tests/tr1/tests/limits/test.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/tr1/tests/limits/test.cpp b/tests/tr1/tests/limits/test.cpp index 96bdfa08d86..e8d7c9c205a 100644 --- a/tests/tr1/tests/limits/test.cpp +++ b/tests/tr1/tests/limits/test.cpp @@ -4,6 +4,8 @@ // test #define TEST_NAME "" +#define _SILENCE_CXX23_DENOM_DEPRECATION_WARNING + #include "tdefs.h" #include #include From 600fb26206d8d711c8059b43d61f3898c8ce1465 Mon Sep 17 00:00:00 2001 From: "A. Jiang" Date: Mon, 20 Feb 2023 10:18:20 +0800 Subject: [PATCH 04/18] `_SILENCE_CXX23_DENOM_DEPRECATION_WARNING` again --- tests/std/tests/Dev11_1074023_constexpr/test.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/std/tests/Dev11_1074023_constexpr/test.cpp b/tests/std/tests/Dev11_1074023_constexpr/test.cpp index cdd745fd63c..bd51237f649 100644 --- a/tests/std/tests/Dev11_1074023_constexpr/test.cpp +++ b/tests/std/tests/Dev11_1074023_constexpr/test.cpp @@ -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_DENOM_DEPRECATION_WARNING #include #include From 343c75a62d1036b84a77378f80d5978da8fe6769 Mon Sep 17 00:00:00 2001 From: "A. Jiang" Date: Mon, 20 Feb 2023 10:28:19 +0800 Subject: [PATCH 05/18] Tweak comments in `yvals_core.h` --- stl/inc/yvals_core.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/stl/inc/yvals_core.h b/stl/inc/yvals_core.h index 1c90b21e77c..417d0c2a139 100644 --- a/stl/inc/yvals_core.h +++ b/stl/inc/yvals_core.h @@ -313,7 +313,6 @@ // P1223R5 ranges::find_last, ranges::find_last_if, ranges::find_last_if_not // P1272R4 byteswap() // P1328R1 constexpr type_info::operator==() -// P1413R3 Deprecate aligned_storage And aligned_union // P1425R4 Iterator Pair Constructors For stack And queue // P1659R3 ranges::starts_with, ranges::ends_with // P1679R3 contains() For basic_string/basic_string_view @@ -353,6 +352,11 @@ // P2549R1 unexpected::error() // P2602R2 Poison Pills Are Too Toxic +// _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 // C++ allows an implementation to implement parallel algorithms as calls to the serial algorithms. // This implementation parallelizes several common algorithm calls, but not all. From 0a2b7d37652dedab536bff32dac234f1ba401ff1 Mon Sep 17 00:00:00 2001 From: "A. Jiang" Date: Mon, 20 Feb 2023 10:50:51 +0800 Subject: [PATCH 06/18] Missing change for `numeric_limits::min` --- stl/inc/limits | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stl/inc/limits b/stl/inc/limits index ae4a70a0762..1b70c71c373 100644 --- a/stl/inc/limits +++ b/stl/inc/limits @@ -458,7 +458,7 @@ template <> class numeric_limits : public _Num_int_base { public: _NODISCARD static constexpr wchar_t(min)() noexcept { - return WCHAR_MIN; + return 0; } _NODISCARD static constexpr wchar_t(max)() noexcept { From 5b2e6ce4a495b4934f51d4a06f10f501a3ab72f4 Mon Sep 17 00:00:00 2001 From: "A. Jiang" Date: Mon, 20 Feb 2023 10:54:35 +0800 Subject: [PATCH 07/18] `_SILENCE_CXX23_UNIX_STREAM_DEPRECATION_WARNING` again --- stl/src/syserror.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/stl/src/syserror.cpp b/stl/src/syserror.cpp index ca926166cf0..652d1246541 100644 --- a/stl/src/syserror.cpp +++ b/stl/src/syserror.cpp @@ -3,6 +3,8 @@ // system_error message mapping +#define _SILENCE_CXX23_UNIX_STREAM_DEPRECATION_WARNING + #include #include #include From 07129a54a2842f723dc22904561a40c4cc3ba174 Mon Sep 17 00:00:00 2001 From: "A. Jiang" Date: Mon, 20 Feb 2023 11:13:11 +0800 Subject: [PATCH 08/18] Less aggressive deprecation --- stl/inc/limits | 64 +++++++++++++++++++++++++++----------------------- 1 file changed, 34 insertions(+), 30 deletions(-) diff --git a/stl/inc/limits b/stl/inc/limits index 1b70c71c373..26beb9a36d1 100644 --- a/stl/inc/limits +++ b/stl/inc/limits @@ -50,29 +50,31 @@ _EXPORT_STD enum float_round_style { // constants for different IEEE rounding st }; struct _Num_base { // base for all types, with common defaults + _STL_DISABLE_DEPRECATED_WARNING _CXX23_DEPRECATE_DENOM static constexpr float_denorm_style has_denorm = denorm_absent; _CXX23_DEPRECATE_DENOM static constexpr bool has_denorm_loss = false; - static constexpr bool has_infinity = false; - static constexpr bool has_quiet_NaN = false; - static constexpr bool has_signaling_NaN = false; - static constexpr bool is_bounded = false; - static constexpr bool is_exact = false; - static constexpr bool is_iec559 = false; - static constexpr bool is_integer = false; - static constexpr bool is_modulo = false; - static constexpr bool is_signed = false; - static constexpr bool is_specialized = false; - static constexpr bool tinyness_before = false; - static constexpr bool traps = false; - static constexpr float_round_style round_style = round_toward_zero; - static constexpr int digits = 0; - static constexpr int digits10 = 0; - static constexpr int max_digits10 = 0; - static constexpr int max_exponent = 0; - static constexpr int max_exponent10 = 0; - static constexpr int min_exponent = 0; - static constexpr int min_exponent10 = 0; - static constexpr int radix = 0; + _STL_RESTORE_DEPRECATED_WARNING + static constexpr bool has_infinity = false; + static constexpr bool has_quiet_NaN = false; + static constexpr bool has_signaling_NaN = false; + static constexpr bool is_bounded = false; + static constexpr bool is_exact = false; + static constexpr bool is_iec559 = false; + static constexpr bool is_integer = false; + static constexpr bool is_modulo = false; + static constexpr bool is_signed = false; + static constexpr bool is_specialized = false; + static constexpr bool tinyness_before = false; + static constexpr bool traps = false; + static constexpr float_round_style round_style = round_toward_zero; + static constexpr int digits = 0; + static constexpr int digits10 = 0; + static constexpr int max_digits10 = 0; + static constexpr int max_exponent = 0; + static constexpr int max_exponent10 = 0; + static constexpr int min_exponent = 0; + static constexpr int min_exponent10 = 0; + static constexpr int radix = 0; }; _EXPORT_STD template @@ -133,16 +135,18 @@ struct _Num_int_base : _Num_base { // base for integer types }; struct _Num_float_base : _Num_base { // base for floating-point types + _STL_DISABLE_DEPRECATED_WARNING _CXX23_DEPRECATE_DENOM static constexpr float_denorm_style has_denorm = denorm_present; - static constexpr bool has_infinity = true; - static constexpr bool has_quiet_NaN = true; - static constexpr bool has_signaling_NaN = true; - static constexpr bool is_bounded = true; - static constexpr bool is_iec559 = true; - static constexpr bool is_signed = true; - static constexpr bool is_specialized = true; - static constexpr float_round_style round_style = round_to_nearest; - static constexpr int radix = FLT_RADIX; + _STL_RESTORE_DEPRECATED_WARNING + static constexpr bool has_infinity = true; + static constexpr bool has_quiet_NaN = true; + static constexpr bool has_signaling_NaN = true; + static constexpr bool is_bounded = true; + static constexpr bool is_iec559 = true; + static constexpr bool is_signed = true; + static constexpr bool is_specialized = true; + static constexpr float_round_style round_style = round_to_nearest; + static constexpr int radix = FLT_RADIX; }; template <> From e522fbf08b7b4ac639d391d3cdf954039d7de489 Mon Sep 17 00:00:00 2001 From: "A. Jiang" Date: Mon, 20 Feb 2023 11:58:54 +0800 Subject: [PATCH 09/18] Less aggressive deprecation again It seems sufficient to deprecate the enumeration type only. --- stl/inc/limits | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/stl/inc/limits b/stl/inc/limits index 26beb9a36d1..34e31578834 100644 --- a/stl/inc/limits +++ b/stl/inc/limits @@ -36,9 +36,9 @@ _STL_DISABLE_CLANG_WARNINGS _STD_BEGIN // constants for different IEEE float denormalization styles _EXPORT_STD enum _CXX23_DEPRECATE_DENOM float_denorm_style { - denorm_indeterminate _CXX23_DEPRECATE_DENOM = -1, - denorm_absent _CXX23_DEPRECATE_DENOM = 0, - denorm_present _CXX23_DEPRECATE_DENOM = 1 + denorm_indeterminate = -1, + denorm_absent = 0, + denorm_present = 1 }; _EXPORT_STD enum float_round_style { // constants for different IEEE rounding styles From f19693ecb6d9f968c37e5a25ed849f880b4a60c3 Mon Sep 17 00:00:00 2001 From: "A. Jiang" Date: Mon, 20 Feb 2023 13:22:48 +0800 Subject: [PATCH 10/18] Another try --- stl/inc/limits | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/stl/inc/limits b/stl/inc/limits index 34e31578834..7bc3931bc2a 100644 --- a/stl/inc/limits +++ b/stl/inc/limits @@ -49,11 +49,11 @@ _EXPORT_STD enum float_round_style { // constants for different IEEE rounding st round_toward_neg_infinity = 3 }; +_STL_DISABLE_DEPRECATED_WARNING struct _Num_base { // base for all types, with common defaults - _STL_DISABLE_DEPRECATED_WARNING _CXX23_DEPRECATE_DENOM static constexpr float_denorm_style has_denorm = denorm_absent; _CXX23_DEPRECATE_DENOM 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; @@ -76,6 +76,7 @@ struct _Num_base { // base for all types, with common defaults static constexpr int min_exponent10 = 0; static constexpr int radix = 0; }; +_STL_RESTORE_DEPRECATED_WARNING _EXPORT_STD template class numeric_limits : public _Num_base { // numeric limits for arbitrary type _Ty (say little or nothing) @@ -134,10 +135,10 @@ struct _Num_int_base : _Num_base { // base for integer types static constexpr int radix = 2; }; +_STL_DISABLE_DEPRECATED_WARNING struct _Num_float_base : _Num_base { // base for floating-point types - _STL_DISABLE_DEPRECATED_WARNING _CXX23_DEPRECATE_DENOM 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; @@ -148,6 +149,7 @@ struct _Num_float_base : _Num_base { // base for floating-point types static constexpr float_round_style round_style = round_to_nearest; static constexpr int radix = FLT_RADIX; }; +_STL_RESTORE_DEPRECATED_WARNING template <> class numeric_limits : public _Num_int_base { From 8a5450835ba8a9e08efe529ce46f9ea5a350b5d0 Mon Sep 17 00:00:00 2001 From: "A. Jiang" Date: Mon, 20 Feb 2023 14:05:13 +0800 Subject: [PATCH 11/18] Try using unwarned global variables --- stl/inc/limits | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/stl/inc/limits b/stl/inc/limits index 7bc3931bc2a..ef04a86ef11 100644 --- a/stl/inc/limits +++ b/stl/inc/limits @@ -41,6 +41,12 @@ _EXPORT_STD enum _CXX23_DEPRECATE_DENOM float_denorm_style { denorm_present = 1 }; +// TRANSITION, should be used within class bodies +_STL_DISABLE_DEPRECATED_WARNING +_INLINE_VAR constexpr auto _Unwarned_denorm_absent = denorm_absent; +_INLINE_VAR constexpr auto _Unwarned_denorm_present = denorm_present; +_STL_RESTORE_DEPRECATED_WARNING + _EXPORT_STD enum float_round_style { // constants for different IEEE rounding styles round_indeterminate = -1, round_toward_zero = 0, @@ -49,10 +55,9 @@ _EXPORT_STD enum float_round_style { // constants for different IEEE rounding st round_toward_neg_infinity = 3 }; -_STL_DISABLE_DEPRECATED_WARNING struct _Num_base { // base for all types, with common defaults - _CXX23_DEPRECATE_DENOM static constexpr float_denorm_style has_denorm = denorm_absent; - _CXX23_DEPRECATE_DENOM static constexpr bool has_denorm_loss = false; + _CXX23_DEPRECATE_DENOM static constexpr auto has_denorm = _Unwarned_denorm_absent; + _CXX23_DEPRECATE_DENOM static constexpr bool has_denorm_loss = false; static constexpr bool has_infinity = false; static constexpr bool has_quiet_NaN = false; @@ -76,7 +81,6 @@ struct _Num_base { // base for all types, with common defaults static constexpr int min_exponent10 = 0; static constexpr int radix = 0; }; -_STL_RESTORE_DEPRECATED_WARNING _EXPORT_STD template class numeric_limits : public _Num_base { // numeric limits for arbitrary type _Ty (say little or nothing) @@ -135,9 +139,8 @@ struct _Num_int_base : _Num_base { // base for integer types static constexpr int radix = 2; }; -_STL_DISABLE_DEPRECATED_WARNING struct _Num_float_base : _Num_base { // base for floating-point types - _CXX23_DEPRECATE_DENOM static constexpr float_denorm_style has_denorm = denorm_present; + _CXX23_DEPRECATE_DENOM static constexpr auto has_denorm = _Unwarned_denorm_present; static constexpr bool has_infinity = true; static constexpr bool has_quiet_NaN = true; @@ -149,7 +152,6 @@ struct _Num_float_base : _Num_base { // base for floating-point types static constexpr float_round_style round_style = round_to_nearest; static constexpr int radix = FLT_RADIX; }; -_STL_RESTORE_DEPRECATED_WARNING template <> class numeric_limits : public _Num_int_base { From 661408e5bb5ee1526f48f9d365de9720bdd59322 Mon Sep 17 00:00:00 2001 From: "A. Jiang" Date: Tue, 21 Feb 2023 02:28:55 +0800 Subject: [PATCH 12/18] Separate PR --- stl/inc/limits | 18 ++- stl/inc/xerrc.h | 156 +++++++++++++------------- stl/inc/yvals_core.h | 26 ++--- stl/src/syserror.cpp | 2 - tests/tr1/tests/system_error/test.cpp | 2 - 5 files changed, 103 insertions(+), 101 deletions(-) diff --git a/stl/inc/limits b/stl/inc/limits index ef04a86ef11..ddd40fbc493 100644 --- a/stl/inc/limits +++ b/stl/inc/limits @@ -34,18 +34,20 @@ _STL_DISABLE_CLANG_WARNINGS #undef new _STD_BEGIN +#ifdef _BUILD_STD_MODULE // TRANSITION, _Pragma("warning(disable : 4996)") doesn't work in modules +#define _CXX23_DEPRECATE_FLOAT_DENOM_STYLE +#else // ^^^ defined(_BUILD_STD_MODULE) / !defined(_BUILD_STD_MODULE) vvv +#define _CXX23_DEPRECATE_FLOAT_DENOM_STYLE _CXX23_DEPRECATE_DENOM +#endif // ^^^ !defined(_BUILD_STD_MODULE) ^^^ + // constants for different IEEE float denormalization styles -_EXPORT_STD enum _CXX23_DEPRECATE_DENOM float_denorm_style { +_EXPORT_STD enum _CXX23_DEPRECATE_FLOAT_DENOM_STYLE float_denorm_style { denorm_indeterminate = -1, denorm_absent = 0, denorm_present = 1 }; -// TRANSITION, should be used within class bodies -_STL_DISABLE_DEPRECATED_WARNING -_INLINE_VAR constexpr auto _Unwarned_denorm_absent = denorm_absent; -_INLINE_VAR constexpr auto _Unwarned_denorm_present = denorm_present; -_STL_RESTORE_DEPRECATED_WARNING +#undef _CXX23_DEPRECATE_FLOAT_DENOM_STYLE _EXPORT_STD enum float_round_style { // constants for different IEEE rounding styles round_indeterminate = -1, @@ -56,8 +58,10 @@ _EXPORT_STD enum float_round_style { // constants for different IEEE rounding st }; struct _Num_base { // base for all types, with common defaults + _STL_DISABLE_DEPRECATED_WARNING _CXX23_DEPRECATE_DENOM static constexpr auto has_denorm = _Unwarned_denorm_absent; _CXX23_DEPRECATE_DENOM static constexpr bool has_denorm_loss = false; + _STL_RESTORE_DEPRECATED_WARNING static constexpr bool has_infinity = false; static constexpr bool has_quiet_NaN = false; @@ -140,7 +144,9 @@ struct _Num_int_base : _Num_base { // base for integer types }; struct _Num_float_base : _Num_base { // base for floating-point types + _STL_DISABLE_DEPRECATED_WARNING _CXX23_DEPRECATE_DENOM static constexpr auto has_denorm = _Unwarned_denorm_present; + _STL_RESTORE_DEPRECATED_WARNING static constexpr bool has_infinity = true; static constexpr bool has_quiet_NaN = true; diff --git a/stl/inc/xerrc.h b/stl/inc/xerrc.h index bf7651ae6cc..86bb85850e5 100644 --- a/stl/inc/xerrc.h +++ b/stl/inc/xerrc.h @@ -18,84 +18,84 @@ _STL_DISABLE_CLANG_WARNINGS _STD_BEGIN _EXPORT_STD enum class errc { // names for generic error codes - address_family_not_supported = 102, // EAFNOSUPPORT - address_in_use = 100, // EADDRINUSE - address_not_available = 101, // EADDRNOTAVAIL - already_connected = 113, // EISCONN - argument_list_too_long = 7, // E2BIG - argument_out_of_domain = 33, // EDOM - bad_address = 14, // EFAULT - bad_file_descriptor = 9, // EBADF - bad_message = 104, // EBADMSG - broken_pipe = 32, // EPIPE - connection_aborted = 106, // ECONNABORTED - connection_already_in_progress = 103, // EALREADY - connection_refused = 107, // ECONNREFUSED - connection_reset = 108, // ECONNRESET - cross_device_link = 18, // EXDEV - destination_address_required = 109, // EDESTADDRREQ - device_or_resource_busy = 16, // EBUSY - directory_not_empty = 41, // ENOTEMPTY - executable_format_error = 8, // ENOEXEC - file_exists = 17, // EEXIST - file_too_large = 27, // EFBIG - filename_too_long = 38, // ENAMETOOLONG - function_not_supported = 40, // ENOSYS - host_unreachable = 110, // EHOSTUNREACH - identifier_removed = 111, // EIDRM - illegal_byte_sequence = 42, // EILSEQ - inappropriate_io_control_operation = 25, // ENOTTY - interrupted = 4, // EINTR - invalid_argument = 22, // EINVAL - invalid_seek = 29, // ESPIPE - io_error = 5, // EIO - is_a_directory = 21, // EISDIR - message_size = 115, // EMSGSIZE - network_down = 116, // ENETDOWN - network_reset = 117, // ENETRESET - network_unreachable = 118, // ENETUNREACH - no_buffer_space = 119, // ENOBUFS - no_child_process = 10, // ECHILD - no_link = 121, // ENOLINK - no_lock_available = 39, // ENOLCK - no_message_available _CXX23_DEPRECATE_UNIX_STREAM = 120, // ENODATA - no_message = 122, // ENOMSG - no_protocol_option = 123, // ENOPROTOOPT - no_space_on_device = 28, // ENOSPC - no_stream_resources _CXX23_DEPRECATE_UNIX_STREAM = 124, // ENOSR - no_such_device_or_address = 6, // ENXIO - no_such_device = 19, // ENODEV - no_such_file_or_directory = 2, // ENOENT - no_such_process = 3, // ESRCH - not_a_directory = 20, // ENOTDIR - not_a_socket = 128, // ENOTSOCK - not_a_stream _CXX23_DEPRECATE_UNIX_STREAM = 125, // ENOSTR - not_connected = 126, // ENOTCONN - not_enough_memory = 12, // ENOMEM - not_supported = 129, // ENOTSUP - operation_canceled = 105, // ECANCELED - operation_in_progress = 112, // EINPROGRESS - operation_not_permitted = 1, // EPERM - operation_not_supported = 130, // EOPNOTSUPP - operation_would_block = 140, // EWOULDBLOCK - owner_dead = 133, // EOWNERDEAD - permission_denied = 13, // EACCES - protocol_error = 134, // EPROTO - protocol_not_supported = 135, // EPROTONOSUPPORT - read_only_file_system = 30, // EROFS - resource_deadlock_would_occur = 36, // EDEADLK - resource_unavailable_try_again = 11, // EAGAIN - result_out_of_range = 34, // ERANGE - state_not_recoverable = 127, // ENOTRECOVERABLE - stream_timeout _CXX23_DEPRECATE_UNIX_STREAM = 137, // ETIME - text_file_busy = 139, // ETXTBSY - timed_out = 138, // ETIMEDOUT - too_many_files_open_in_system = 23, // ENFILE - too_many_files_open = 24, // EMFILE - too_many_links = 31, // EMLINK - too_many_symbolic_link_levels = 114, // ELOOP - value_too_large = 132, // EOVERFLOW - wrong_protocol_type = 136 // EPROTOTYPE + address_family_not_supported = 102, // EAFNOSUPPORT + address_in_use = 100, // EADDRINUSE + address_not_available = 101, // EADDRNOTAVAIL + already_connected = 113, // EISCONN + argument_list_too_long = 7, // E2BIG + argument_out_of_domain = 33, // EDOM + bad_address = 14, // EFAULT + bad_file_descriptor = 9, // EBADF + bad_message = 104, // EBADMSG + broken_pipe = 32, // EPIPE + connection_aborted = 106, // ECONNABORTED + connection_already_in_progress = 103, // EALREADY + connection_refused = 107, // ECONNREFUSED + connection_reset = 108, // ECONNRESET + cross_device_link = 18, // EXDEV + destination_address_required = 109, // EDESTADDRREQ + device_or_resource_busy = 16, // EBUSY + directory_not_empty = 41, // ENOTEMPTY + executable_format_error = 8, // ENOEXEC + file_exists = 17, // EEXIST + file_too_large = 27, // EFBIG + filename_too_long = 38, // ENAMETOOLONG + function_not_supported = 40, // ENOSYS + host_unreachable = 110, // EHOSTUNREACH + identifier_removed = 111, // EIDRM + illegal_byte_sequence = 42, // EILSEQ + inappropriate_io_control_operation = 25, // ENOTTY + interrupted = 4, // EINTR + invalid_argument = 22, // EINVAL + invalid_seek = 29, // ESPIPE + io_error = 5, // EIO + is_a_directory = 21, // EISDIR + message_size = 115, // EMSGSIZE + network_down = 116, // ENETDOWN + network_reset = 117, // ENETRESET + network_unreachable = 118, // ENETUNREACH + no_buffer_space = 119, // ENOBUFS + no_child_process = 10, // ECHILD + no_link = 121, // ENOLINK + no_lock_available = 39, // ENOLCK + no_message_available = 120, // ENODATA + no_message = 122, // ENOMSG + no_protocol_option = 123, // ENOPROTOOPT + no_space_on_device = 28, // ENOSPC + no_stream_resources = 124, // ENOSR + no_such_device_or_address = 6, // ENXIO + no_such_device = 19, // ENODEV + no_such_file_or_directory = 2, // ENOENT + no_such_process = 3, // ESRCH + not_a_directory = 20, // ENOTDIR + not_a_socket = 128, // ENOTSOCK + not_a_stream = 125, // ENOSTR + not_connected = 126, // ENOTCONN + not_enough_memory = 12, // ENOMEM + not_supported = 129, // ENOTSUP + operation_canceled = 105, // ECANCELED + operation_in_progress = 112, // EINPROGRESS + operation_not_permitted = 1, // EPERM + operation_not_supported = 130, // EOPNOTSUPP + operation_would_block = 140, // EWOULDBLOCK + owner_dead = 133, // EOWNERDEAD + permission_denied = 13, // EACCES + protocol_error = 134, // EPROTO + protocol_not_supported = 135, // EPROTONOSUPPORT + read_only_file_system = 30, // EROFS + resource_deadlock_would_occur = 36, // EDEADLK + resource_unavailable_try_again = 11, // EAGAIN + result_out_of_range = 34, // ERANGE + state_not_recoverable = 127, // ENOTRECOVERABLE + stream_timeout = 137, // ETIME + text_file_busy = 139, // ETXTBSY + timed_out = 138, // ETIMEDOUT + too_many_files_open_in_system = 23, // ENFILE + too_many_files_open = 24, // EMFILE + too_many_links = 31, // EMLINK + too_many_symbolic_link_levels = 114, // ELOOP + value_too_large = 132, // EOVERFLOW + wrong_protocol_type = 136 // EPROTOTYPE }; _STD_END diff --git a/stl/inc/yvals_core.h b/stl/inc/yvals_core.h index 417d0c2a139..8fdd8aeb6ea 100644 --- a/stl/inc/yvals_core.h +++ b/stl/inc/yvals_core.h @@ -1407,23 +1407,11 @@ _EMIT_STL_ERROR(STL1004, "C++98 unexpected() is incompatible with C++23 unexpect // STL4040 is used to warn that "The contents of require static RTTI." -#if _HAS_CXX23 && !defined(_SILENCE_CXX23_DENOM_DEPRECATION_WARNING) \ - && !defined(_SILENCE_ALL_CXX23_DEPRECATION_WARNINGS) -#define _CXX23_DEPRECATE_DENOM \ - [[deprecated("warning STL4041: " \ - "std::float_denorm_style, std::numeric_limits::has_denorm, and " \ - "std::numeric_limits::has_denorm_loss are deprecated in C++23. They are not well specified and " \ - "should not be dependent on. You can define _SILENCE_CXX23_DENOM_WARNING or " \ - "_SILENCE_ALL_CXX23_DEPRECATION_WARNINGS to suppress this warning.")]] -#else // ^^^ warning enabled / warning disabled vvv -#define _CXX23_DEPRECATE_DENOM -#endif // ^^^ warning disabled ^^^ - #if _HAS_CXX23 && !defined(_SILENCE_CXX23_UNIX_STREAM_DEPRECATION_WARNING) \ && !defined(_SILENCE_ALL_CXX23_DEPRECATION_WARNINGS) #define _CXX23_DEPRECATE_UNIX_STREAM \ [[deprecated( \ - "warning STL4042: " \ + "warning STL4041: " \ "std::errc enumerators std::errc::no_message_available, std::errc::no_stream_resources, " \ "std::errc::not_a_stream, and std::errc::stream_timeout and their corresponding errno macros ENODATA, ENOSR, " \ "ENOSTR and ETIME are deprecated in C++23 by LWG-3869. These errno macros are deprecated in POSIX 2008 and " \ @@ -1433,6 +1421,18 @@ _EMIT_STL_ERROR(STL1004, "C++98 unexpected() is incompatible with C++23 unexpect #define _CXX23_DEPRECATE_UNIX_STREAM #endif // ^^^ warning disabled ^^^ +#if _HAS_CXX23 && !defined(_SILENCE_CXX23_DENOM_DEPRECATION_WARNING) \ + && !defined(_SILENCE_ALL_CXX23_DEPRECATION_WARNINGS) +#define _CXX23_DEPRECATE_DENOM \ + [[deprecated("warning STL4042: " \ + "std::float_denorm_style, std::numeric_limits::has_denorm, and " \ + "std::numeric_limits::has_denorm_loss are deprecated in C++23. They are not well specified and " \ + "should not be dependent on. You can define _SILENCE_CXX23_DENOM_WARNING or " \ + "_SILENCE_ALL_CXX23_DEPRECATION_WARNINGS to suppress this warning.")]] +#else // ^^^ warning enabled / warning disabled vvv +#define _CXX23_DEPRECATE_DENOM +#endif // ^^^ warning disabled ^^^ + // next warning number: STL4043 // next error number: STL1006 diff --git a/stl/src/syserror.cpp b/stl/src/syserror.cpp index 652d1246541..ca926166cf0 100644 --- a/stl/src/syserror.cpp +++ b/stl/src/syserror.cpp @@ -3,8 +3,6 @@ // system_error message mapping -#define _SILENCE_CXX23_UNIX_STREAM_DEPRECATION_WARNING - #include #include #include diff --git a/tests/tr1/tests/system_error/test.cpp b/tests/tr1/tests/system_error/test.cpp index 809ef8625a8..a80cbf3b373 100644 --- a/tests/tr1/tests/system_error/test.cpp +++ b/tests/tr1/tests/system_error/test.cpp @@ -4,8 +4,6 @@ // test #define TEST_NAME "" -#define _SILENCE_CXX23_UNIX_STREAM_DEPRECATION_WARNING - #include "tdefs.h" #include #include From 36b197e6abef3f56ca114e791ea39f6cbcb5870c Mon Sep 17 00:00:00 2001 From: "A. Jiang" Date: Tue, 21 Feb 2023 02:44:50 +0800 Subject: [PATCH 13/18] Missed restoration --- stl/inc/limits | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/stl/inc/limits b/stl/inc/limits index ddd40fbc493..aff33c39adb 100644 --- a/stl/inc/limits +++ b/stl/inc/limits @@ -59,8 +59,8 @@ _EXPORT_STD enum float_round_style { // constants for different IEEE rounding st struct _Num_base { // base for all types, with common defaults _STL_DISABLE_DEPRECATED_WARNING - _CXX23_DEPRECATE_DENOM static constexpr auto has_denorm = _Unwarned_denorm_absent; - _CXX23_DEPRECATE_DENOM static constexpr bool has_denorm_loss = false; + _CXX23_DEPRECATE_DENOM static constexpr float_denorm_style has_denorm = denorm_absent; + _CXX23_DEPRECATE_DENOM static constexpr bool has_denorm_loss = false; _STL_RESTORE_DEPRECATED_WARNING static constexpr bool has_infinity = false; @@ -145,7 +145,7 @@ struct _Num_int_base : _Num_base { // base for integer types struct _Num_float_base : _Num_base { // base for floating-point types _STL_DISABLE_DEPRECATED_WARNING - _CXX23_DEPRECATE_DENOM static constexpr auto has_denorm = _Unwarned_denorm_present; + _CXX23_DEPRECATE_DENOM static constexpr float_denorm_style has_denorm = denorm_present; _STL_RESTORE_DEPRECATED_WARNING static constexpr bool has_infinity = true; From 3dd765a3f92188ebcc3b4ef11c303eb993ae48d1 Mon Sep 17 00:00:00 2001 From: "A. Jiang" Date: Wed, 5 Apr 2023 15:50:24 +0800 Subject: [PATCH 14/18] Fix typos and mistakes in merging --- stl/inc/limits | 8 ++++---- stl/inc/yvals_core.h | 17 ++++++----------- 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/stl/inc/limits b/stl/inc/limits index 1836eb2ff64..e4cdf08be4d 100644 --- a/stl/inc/limits +++ b/stl/inc/limits @@ -38,7 +38,7 @@ _STD_BEGIN #ifdef _BUILD_STD_MODULE // TRANSITION, _Pragma("warning(disable : 4996)") doesn't work in modules #define _CXX23_DEPRECATE_FLOAT_DENOM_STYLE #else // ^^^ defined(_BUILD_STD_MODULE) / !defined(_BUILD_STD_MODULE) vvv -#define _CXX23_DEPRECATE_FLOAT_DENOM_STYLE _CXX23_DEPRECATE_DENOM +#define _CXX23_DEPRECATE_FLOAT_DENOM_STYLE _CXX23_DEPRECATE_DENORM #endif // ^^^ !defined(_BUILD_STD_MODULE) ^^^ // constants for different IEEE float denormalization styles @@ -60,8 +60,8 @@ _EXPORT_STD enum float_round_style { // constants for different IEEE rounding st struct _Num_base { // base for all types, with common defaults _STL_DISABLE_DEPRECATED_WARNING - _CXX23_DEPRECATE_DENOM static constexpr float_denorm_style has_denorm = denorm_absent; - _CXX23_DEPRECATE_DENOM static constexpr bool has_denorm_loss = false; + _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; @@ -146,7 +146,7 @@ struct _Num_int_base : _Num_base { // base for integer types struct _Num_float_base : _Num_base { // base for floating-point types _STL_DISABLE_DEPRECATED_WARNING - _CXX23_DEPRECATE_DENOM static constexpr float_denorm_style has_denorm = denorm_present; + _CXX23_DEPRECATE_DENORM static constexpr float_denorm_style has_denorm = denorm_present; _STL_RESTORE_DEPRECATED_WARNING static constexpr bool has_infinity = true; diff --git a/stl/inc/yvals_core.h b/stl/inc/yvals_core.h index f07e347b3e7..47857de97e1 100644 --- a/stl/inc/yvals_core.h +++ b/stl/inc/yvals_core.h @@ -362,10 +362,6 @@ // P2549R1 unexpected::error() // P2652R2 Disallowing User Specialization Of allocator_traits -// _HAS_CXX23 and _SILENCE_ALL_CXX23_DEPRECATION_WARNINGS control: -// P1413R3 Deprecate aligned_storage And aligned_union -// Other C++23 deprecation warnings - // _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 @@ -1435,16 +1431,15 @@ _EMIT_STL_ERROR(STL1004, "C++98 unexpected() is incompatible with C++23 unexpect #define _CXX23_DEPRECATE_UNIX_STREAMS #endif // ^^^ warning disabled ^^^ -#if _HAS_CXX23 && !defined(_SILENCE_CXX23_DENOM_DEPRECATION_WARNING) \ +#if _HAS_CXX23 && !defined(_SILENCE_CXX23_DENORM_DEPRECATION_WARNING) \ && !defined(_SILENCE_ALL_CXX23_DEPRECATION_WARNINGS) -#define _CXX23_DEPRECATE_DENOM \ - [[deprecated("warning STL4042: " \ - "std::float_denorm_style, std::numeric_limits::has_denorm, and " \ - "std::numeric_limits::has_denorm_loss are deprecated in C++23. They are not well specified and " \ - "should not be dependent on. You can define _SILENCE_CXX23_DENOM_WARNING or " \ +#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_DENOM +#define _CXX23_DEPRECATE_DENORM #endif // ^^^ warning disabled ^^^ // next warning number: STL4043 From bbd08cf377dc6eaf62a376f997cdf340320088c3 Mon Sep 17 00:00:00 2001 From: "A. Jiang" Date: Wed, 5 Apr 2023 15:55:32 +0800 Subject: [PATCH 15/18] Try removing workaround Although the PR is still blocked. --- stl/inc/limits | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/stl/inc/limits b/stl/inc/limits index e4cdf08be4d..ec3610bc396 100644 --- a/stl/inc/limits +++ b/stl/inc/limits @@ -35,21 +35,13 @@ _STL_DISABLE_CLANG_WARNINGS #undef new _STD_BEGIN -#ifdef _BUILD_STD_MODULE // TRANSITION, _Pragma("warning(disable : 4996)") doesn't work in modules -#define _CXX23_DEPRECATE_FLOAT_DENOM_STYLE -#else // ^^^ defined(_BUILD_STD_MODULE) / !defined(_BUILD_STD_MODULE) vvv -#define _CXX23_DEPRECATE_FLOAT_DENOM_STYLE _CXX23_DEPRECATE_DENORM -#endif // ^^^ !defined(_BUILD_STD_MODULE) ^^^ - // constants for different IEEE float denormalization styles -_EXPORT_STD enum _CXX23_DEPRECATE_FLOAT_DENOM_STYLE float_denorm_style { +_EXPORT_STD enum _CXX23_DEPRECATE_DENORM float_denorm_style { denorm_indeterminate = -1, denorm_absent = 0, denorm_present = 1 }; -#undef _CXX23_DEPRECATE_FLOAT_DENOM_STYLE - _EXPORT_STD enum float_round_style { // constants for different IEEE rounding styles round_indeterminate = -1, round_toward_zero = 0, From c96a0dd7a2e5c37d068513111c35024dcf85a5d2 Mon Sep 17 00:00:00 2001 From: "A. Jiang" Date: Wed, 5 Apr 2023 15:58:51 +0800 Subject: [PATCH 16/18] Fix typo in test files --- tests/std/tests/Dev11_1074023_constexpr/test.cpp | 2 +- tests/tr1/tests/limits/test.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/std/tests/Dev11_1074023_constexpr/test.cpp b/tests/std/tests/Dev11_1074023_constexpr/test.cpp index bd51237f649..58c32ebc3e2 100644 --- a/tests/std/tests/Dev11_1074023_constexpr/test.cpp +++ b/tests/std/tests/Dev11_1074023_constexpr/test.cpp @@ -6,7 +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_DENOM_DEPRECATION_WARNING +#define _SILENCE_CXX23_DENORM_DEPRECATION_WARNING #include #include diff --git a/tests/tr1/tests/limits/test.cpp b/tests/tr1/tests/limits/test.cpp index e8d7c9c205a..08e98d73468 100644 --- a/tests/tr1/tests/limits/test.cpp +++ b/tests/tr1/tests/limits/test.cpp @@ -4,7 +4,7 @@ // test #define TEST_NAME "" -#define _SILENCE_CXX23_DENOM_DEPRECATION_WARNING +#define _SILENCE_CXX23_DENORM_DEPRECATION_WARNING #include "tdefs.h" #include From bee91dc3904b05215be377fd6c3f553ee82a7908 Mon Sep 17 00:00:00 2001 From: "A. Jiang" Date: Wed, 5 Apr 2023 17:27:23 +0800 Subject: [PATCH 17/18] Remove superfluous U+0060 Grave Accent --- stl/inc/yvals_core.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stl/inc/yvals_core.h b/stl/inc/yvals_core.h index 47857de97e1..ab31d08d6e2 100644 --- a/stl/inc/yvals_core.h +++ b/stl/inc/yvals_core.h @@ -364,7 +364,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 +// P2614R2 Deprecating float_denorm_style, numeric_limits::has_denorm, numeric_limits::has_denorm_loss // Other C++23 deprecation warnings // Parallel Algorithms Notes From c4d9497e7d6d8969449c9060782a61ee389590a2 Mon Sep 17 00:00:00 2001 From: "A. Jiang" Date: Fri, 7 Apr 2023 01:58:51 +0800 Subject: [PATCH 18/18] Separate inclusion reduction to another PR --- stl/inc/limits | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/stl/inc/limits b/stl/inc/limits index ec3610bc396..b2d189e003e 100644 --- a/stl/inc/limits +++ b/stl/inc/limits @@ -10,6 +10,7 @@ #if _STL_COMPILER_PREPROCESSOR #include #include +#include #include #include @@ -465,11 +466,11 @@ template <> class numeric_limits : public _Num_int_base { public: _NODISCARD static constexpr wchar_t(min)() noexcept { - return 0; + return WCHAR_MIN; } _NODISCARD static constexpr wchar_t(max)() noexcept { - return 0xFFFF; + return WCHAR_MAX; } _NODISCARD static constexpr wchar_t lowest() noexcept {