[PATCH] libstdc++: Deprecate std::errc constants related to UNIX STREAMS.
Tomasz KamiĆski <[email protected]> Thu, 6 Aug 2026 14:18:55 +0200
| Newsgroups | gmane.comp.gcc.patches,gmane.comp.gcc.libstdc++.devel |
|---|---|
| Message-ID | <[email protected]> |
Add _GLIBCXX23_DEPRECATED attribute to no_message_available,
no_stream_resources, not_a_stream, stream_timeout, per LWG3869,
"Deprecate std::errc constants related to UNIX STREAMS".
The config/os/mingw32/error_constants.h does not define any
of above enumerators (they definitions are commented out).
libstdc++-v3/ChangeLog:
* config/os/djgpp/error_constants.h (errc::no_message_available)
(errc::no_stream_resources, errc:not_a_stream)
(errc::stream_timeout): Mark as _GLIBCXX23_DEPRECATED
* config/os/generic/error_constants.h
(errc::no_message_available, errc::no_stream_resources)
(errc:not_a_stream, errc::stream_timeout): Likewise.
* config/os/mingw32-w64/error_constants.h
(errc::no_message_available, errc::no_stream_resources)
(errc:not_a_stream, errc::stream_timeout): Likewise.
* testsuite/19_diagnostics/headers/system_error/errc_std_c++0x.cc:
Add dg-warning attributes for expected deprecation warnings.
---
Tested on x86_64-linux locally. system_error/errc_std_c++0x.cc tested
in all standard modes. OK for trunk?
libstdc++-v3/config/os/djgpp/error_constants.h | 8 ++++----
libstdc++-v3/config/os/generic/error_constants.h | 8 ++++----
libstdc++-v3/config/os/mingw32-w64/error_constants.h | 8 ++++----
.../19_diagnostics/headers/system_error/errc_std_c++0x.cc | 8 ++++----
4 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/libstdc++-v3/config/os/djgpp/error_constants.h b/libstdc++-v3/config/os/djgpp/error_constants.h
index 25d702a9b68..217b9fb007d 100644
--- a/libstdc++-v3/config/os/djgpp/error_constants.h
+++ b/libstdc++-v3/config/os/djgpp/error_constants.h
@@ -93,7 +93,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
no_lock_available = ENOLCK,
#ifdef ENODATA
- no_message_available = ENODATA,
+ no_message_available _GLIBCXX23_DEPRECATED = ENODATA,
#endif
// no_message = ENOMSG,
@@ -101,7 +101,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
no_space_on_device = ENOSPC,
#ifdef ENOSR
- no_stream_resources = ENOSR,
+ no_stream_resources _GLIBCXX23_DEPRECATED = ENOSR,
#endif
no_such_device_or_address = ENXIO,
@@ -112,7 +112,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// not_a_socket = ENOTSOCK,
#ifdef ENOSTR
- not_a_stream = ENOSTR,
+ not_a_stream _GLIBCXX23_DEPRECATED = ENOSTR,
#endif
// not_connected = ENOTCONN,
@@ -152,7 +152,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
#endif
#ifdef ETIME
- stream_timeout = ETIME,
+ stream_timeout _GLIBCXX26_DEPRECATED = ETIME,
#endif
#ifdef ETXTBSY
diff --git a/libstdc++-v3/config/os/generic/error_constants.h b/libstdc++-v3/config/os/generic/error_constants.h
index d574455ed3b..c1c8aed251b 100644
--- a/libstdc++-v3/config/os/generic/error_constants.h
+++ b/libstdc++-v3/config/os/generic/error_constants.h
@@ -93,7 +93,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
no_lock_available = ENOLCK,
#ifdef ENODATA
- no_message_available = ENODATA,
+ no_message_available _GLIBCXX23_DEPRECATED = ENODATA,
#endif
no_message = ENOMSG,
@@ -101,7 +101,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
no_space_on_device = ENOSPC,
#ifdef ENOSR
- no_stream_resources = ENOSR,
+ no_stream_resources _GLIBCXX23_DEPRECATED = ENOSR,
#endif
no_such_device_or_address = ENXIO,
@@ -112,7 +112,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
not_a_socket = ENOTSOCK,
#ifdef ENOSTR
- not_a_stream = ENOSTR,
+ not_a_stream _GLIBCXX23_DEPRECATED = ENOSTR,
#endif
not_connected = ENOTCONN,
@@ -152,7 +152,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
#endif
#ifdef ETIME
- stream_timeout = ETIME,
+ stream_timeout _GLIBCXX23_DEPRECATED = ETIME,
#endif
#ifdef ETXTBSY
diff --git a/libstdc++-v3/config/os/mingw32-w64/error_constants.h b/libstdc++-v3/config/os/mingw32-w64/error_constants.h
index a6e68457fe8..f2a4fb57904 100644
--- a/libstdc++-v3/config/os/mingw32-w64/error_constants.h
+++ b/libstdc++-v3/config/os/mingw32-w64/error_constants.h
@@ -90,7 +90,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
#endif
no_lock_available = ENOLCK,
#ifdef ENODATA
- no_message_available = ENODATA,
+ no_message_available _GLIBCXX23_DEPRECATED = ENODATA,
#endif
#ifdef ENOMSG
no_message = ENOMSG,
@@ -100,7 +100,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
no_space_on_device = ENOSPC,
#endif
#ifdef ENOSR
- no_stream_resources = ENOSR,
+ no_stream_resources _GLIBCXX23_DEPRECATED = ENOSR,
#endif
no_such_device_or_address = ENXIO,
no_such_device = ENODEV,
@@ -109,7 +109,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
not_a_directory = ENOTDIR,
not_a_socket = ENOTSOCK,
#ifdef ENOSTR
- not_a_stream = ENOSTR,
+ not_a_stream _GLIBCXX23_DEPRECATED = ENOSTR,
#endif
not_connected = ENOTCONN,
not_enough_memory = ENOMEM,
@@ -139,7 +139,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
state_not_recoverable = ENOTRECOVERABLE,
#endif
#ifdef ETIME
- stream_timeout = ETIME,
+ stream_timeout _GLIBCXX23_DEPRECATED = ETIME,
#endif
#ifdef ETXTBSY
text_file_busy = ETXTBSY,
diff --git a/libstdc++-v3/testsuite/19_diagnostics/headers/system_error/errc_std_c++0x.cc b/libstdc++-v3/testsuite/19_diagnostics/headers/system_error/errc_std_c++0x.cc
index b5b085e28b2..1b1a950c2b0 100644
--- a/libstdc++-v3/testsuite/19_diagnostics/headers/system_error/errc_std_c++0x.cc
+++ b/libstdc++-v3/testsuite/19_diagnostics/headers/system_error/errc_std_c++0x.cc
@@ -82,7 +82,7 @@ void test01()
TEST_ERRC(no_lock_available);
#ifdef ENODATA
- TEST_ERRC(no_message_available);
+ TEST_ERRC(no_message_available); // { dg-warning "deprecated" "" { target c++23 } }
#endif
#ifdef ENOMSG
@@ -95,7 +95,7 @@ void test01()
#endif
#ifdef ENOSR
- TEST_ERRC(no_stream_resources);
+ TEST_ERRC(no_stream_resources); // { dg-warning "deprecated" "" { target c++23 } }
#endif
TEST_ERRC(no_such_device_or_address);
@@ -106,7 +106,7 @@ void test01()
TEST_ERRC(not_a_socket);
#ifdef ENOSTR
- TEST_ERRC(not_a_stream);
+ TEST_ERRC(not_a_stream); // { dg-warning "deprecated" "" { target c++23 } }
#endif
TEST_ERRC(not_connected);
@@ -153,7 +153,7 @@ void test01()
#endif
#ifdef ETIME
- TEST_ERRC(stream_timeout);
+ TEST_ERRC(stream_timeout); // { dg-warning "deprecated" "" { target c++23 } }
#endif
#ifdef ETXTBSY
--
2.55.0