Skip to content

[libc++] Undeprecate POSIX STREAM macros. #88296

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 13, 2024

Conversation

mordante
Copy link
Member

LWG3869 Deprecate std::errc constants related to UNIX STREAMS

deprecates the POSIX macros ENODATA, ENOSR, ENOSTR, and ETIME. These were deprecated in libc++ in
#80542. Based on the post commit feedback the macro are no longer deprecated. Instead libc++ leaves the deprecation to the provider of errno.h.

LWG3869 Deprecate std::errc constants related to UNIX STREAMS

deprecates the POSIX macros ENODATA, ENOSR, ENOSTR, and ETIME. These
were deprecated in libc++ in
llvm#80542. Based on the post
commit feedback the macro are no longer deprecated. Instead libc++
leaves the deprecation to the provider of errno.h.
@mordante mordante requested a review from a team as a code owner April 10, 2024 16:51
@llvmbot llvmbot added the libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. label Apr 10, 2024
@llvmbot
Copy link
Member

llvmbot commented Apr 10, 2024

@llvm/pr-subscribers-libcxx

Author: Mark de Wever (mordante)

Changes

LWG3869 Deprecate std::errc constants related to UNIX STREAMS

deprecates the POSIX macros ENODATA, ENOSR, ENOSTR, and ETIME. These were deprecated in libc++ in
#80542. Based on the post commit feedback the macro are no longer deprecated. Instead libc++ leaves the deprecation to the provider of errno.h.


Full diff: https://github.com/llvm/llvm-project/pull/88296.diff

3 Files Affected:

  • (modified) libcxx/include/__system_error/errc.h (+5)
  • (modified) libcxx/include/cerrno (+6-12)
  • (removed) libcxx/test/std/depr.cerro/cerrno.syn.verify.cpp (-37)
diff --git a/libcxx/include/__system_error/errc.h b/libcxx/include/__system_error/errc.h
index e9f3656b7b9c2b..a262c856fd998f 100644
--- a/libcxx/include/__system_error/errc.h
+++ b/libcxx/include/__system_error/errc.h
@@ -112,6 +112,11 @@ enum class errc
 // macros. So GCC does not need the pushing and popping.
 //
 // TODO Remove this when the deprecated constants are removed.
+//
+// Note based on the post-review comments in
+// https://github.com/llvm/llvm-project/pull/80542 libc++ no longer deprecates
+// the macros. Since C libraries my start to deprecate these POSIX macros the
+// disabling of the deprecated macros is not removed.
 #if defined(_LIBCPP_COMPILER_CLANG_BASED)
 #  define _LIBCPP_SUPPRESS_DEPRECATED_ERRC_PUSH _LIBCPP_SUPPRESS_DEPRECATED_PUSH
 #  define _LIBCPP_SUPPRESS_DEPRECATED_ERRC_POP _LIBCPP_SUPPRESS_DEPRECATED_POP
diff --git a/libcxx/include/cerrno b/libcxx/include/cerrno
index 6171ae31f18479..81e82cf849ab00 100644
--- a/libcxx/include/cerrno
+++ b/libcxx/include/cerrno
@@ -38,17 +38,11 @@ Macros:
 #  pragma GCC system_header
 #endif
 
-#ifdef ENODATA
-#  pragma clang deprecated(ENODATA, "ENODATA is deprecated in ISO C++")
-#endif
-#ifdef ENOSR
-#  pragma clang deprecated(ENOSR, "ENOSR is deprecated in ISO C++")
-#endif
-#ifdef ENOSTR
-#  pragma clang deprecated(ENOSTR, "ENOSTR is deprecated in ISO C++")
-#endif
-#ifdef ETIME
-#  pragma clang deprecated(ETIME, "ETIME is deprecated in ISO C++")
-#endif
+// LWG3869 Deprecate std::errc constants related to UNIX STREAMS
+//
+// deprecates the POSIX macros ENODATA, ENOSR, ENOSTR, and ETIME. These were
+// deprecated in libc++ in https://github.com/llvm/llvm-project/pull/80542.
+// Based on the post commit feedback the macro are no longer deprecated.
+// Instead libc++ leaves the deprecation to the provider of errno.h.
 
 #endif // _LIBCPP_CERRNO
diff --git a/libcxx/test/std/depr.cerro/cerrno.syn.verify.cpp b/libcxx/test/std/depr.cerro/cerrno.syn.verify.cpp
deleted file mode 100644
index 3a38605570dafb..00000000000000
--- a/libcxx/test/std/depr.cerro/cerrno.syn.verify.cpp
+++ /dev/null
@@ -1,37 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// UNSUPPORTED: clang-modules-build
-// UNSUPPORTED: apple-clang && c++03
-
-// <cerrno>
-
-// tests LWG 3869 deprecated macros.
-//
-// Note the macros may not be defined. When they are not defined the
-// ifdef XXX does not trigger a deprecated message. So use them in the
-// ifdef and test for 2 deprecated messages.
-
-#include <cerrno>
-
-#ifdef ENODATA
-[[maybe_unused]] int nodata =
-    ENODATA; // [email protected]:* 2 {{macro 'ENODATA' has been marked as deprecated}}
-#endif
-#ifdef ENOSR
-[[maybe_unused]] int nosr =
-    ENOSR; // [email protected]:* 2 {{macro 'ENOSR' has been marked as deprecated}}
-#endif
-#ifdef ENOSTR
-[[maybe_unused]] int nostr =
-    ENOSTR; // [email protected]:* 2 {{macro 'ENOSTR' has been marked as deprecated}}
-#endif
-#ifdef ETIME
-[[maybe_unused]] int timeout =
-    ETIME; // [email protected]:* 2 {{macro 'ETIME' has been marked as deprecated}}
-#endif

@ldionne ldionne changed the title [libc++] Undprecated POSIX STREAM macros. [libc++] Undeprecate POSIX STREAM macros. Apr 12, 2024
Co-authored-by: Hristo Hristov <[email protected]>
Co-authored-by: Louis Dionne <[email protected]>
@mordante
Copy link
Member Author

Thanks for the suggestions! I'll land this when the CI is green.

@mordante mordante merged commit 910ec6f into llvm:main Apr 13, 2024
@mordante mordante deleted the review/undeprecate_POSIX_macros branch April 13, 2024 11:46
bazuzi pushed a commit to bazuzi/llvm-project that referenced this pull request Apr 15, 2024
LWG3869 Deprecate std::errc constants related to UNIX STREAMS

deprecates the POSIX macros ENODATA, ENOSR, ENOSTR, and ETIME. These
were deprecated in libc++ in
llvm#80542. Based on the post
commit feedback the macro are no longer deprecated. Instead libc++
leaves the deprecation to the provider of errno.h.

---------

Co-authored-by: Hristo Hristov <[email protected]>
Co-authored-by: Louis Dionne <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants