-
Notifications
You must be signed in to change notification settings - Fork 12k
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
[libc++] Remove _LIBCPP_USING_IF_EXISTS from fundamental aliases #107220
Conversation
@llvm/pr-subscribers-libcxx Author: Nikolas Klauser (philnik777) ChangesThere are a few types without which the library is hopelessly broken. Specifically, these are Full diff: https://github.com/llvm/llvm-project/pull/107220.diff 8 Files Affected:
diff --git a/libcxx/include/cstddef b/libcxx/include/cstddef
index 592f6261a6de3f..223eab878050e9 100644
--- a/libcxx/include/cstddef
+++ b/libcxx/include/cstddef
@@ -56,8 +56,8 @@ Types:
_LIBCPP_BEGIN_NAMESPACE_STD
using ::nullptr_t;
-using ::ptrdiff_t _LIBCPP_USING_IF_EXISTS;
-using ::size_t _LIBCPP_USING_IF_EXISTS;
+using ::ptrdiff_t;
+using ::size_t;
#if !defined(_LIBCPP_CXX03_LANG)
using ::max_align_t _LIBCPP_USING_IF_EXISTS;
diff --git a/libcxx/include/cstdint b/libcxx/include/cstdint
index 8c4782859426dd..88f6f901f9fd09 100644
--- a/libcxx/include/cstdint
+++ b/libcxx/include/cstdint
@@ -158,15 +158,15 @@ Types:
_LIBCPP_BEGIN_NAMESPACE_STD
-using ::int8_t _LIBCPP_USING_IF_EXISTS;
-using ::int16_t _LIBCPP_USING_IF_EXISTS;
-using ::int32_t _LIBCPP_USING_IF_EXISTS;
-using ::int64_t _LIBCPP_USING_IF_EXISTS;
-
-using ::uint8_t _LIBCPP_USING_IF_EXISTS;
-using ::uint16_t _LIBCPP_USING_IF_EXISTS;
-using ::uint32_t _LIBCPP_USING_IF_EXISTS;
-using ::uint64_t _LIBCPP_USING_IF_EXISTS;
+using ::int8_t;
+using ::int16_t;
+using ::int32_t;
+using ::int64_t;
+
+using ::uint8_t;
+using ::uint16_t;
+using ::uint32_t;
+using ::uint64_t;
using ::int_least8_t _LIBCPP_USING_IF_EXISTS;
using ::int_least16_t _LIBCPP_USING_IF_EXISTS;
diff --git a/libcxx/include/cstdio b/libcxx/include/cstdio
index 7f94371081f8b1..633773e63e5de1 100644
--- a/libcxx/include/cstdio
+++ b/libcxx/include/cstdio
@@ -115,7 +115,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
using ::FILE _LIBCPP_USING_IF_EXISTS;
using ::fpos_t _LIBCPP_USING_IF_EXISTS;
-using ::size_t _LIBCPP_USING_IF_EXISTS;
+using ::size_t;
using ::fclose _LIBCPP_USING_IF_EXISTS;
using ::fflush _LIBCPP_USING_IF_EXISTS;
diff --git a/libcxx/include/cstdlib b/libcxx/include/cstdlib
index c817fd8f4accda..e57a54e38a97f8 100644
--- a/libcxx/include/cstdlib
+++ b/libcxx/include/cstdlib
@@ -99,7 +99,7 @@ void *aligned_alloc(size_t alignment, size_t size); // C11
_LIBCPP_BEGIN_NAMESPACE_STD
-using ::size_t _LIBCPP_USING_IF_EXISTS;
+using ::size_t;
using ::div_t _LIBCPP_USING_IF_EXISTS;
using ::ldiv_t _LIBCPP_USING_IF_EXISTS;
using ::lldiv_t _LIBCPP_USING_IF_EXISTS;
diff --git a/libcxx/include/cstring b/libcxx/include/cstring
index c2c92b02e73cc1..268ec1e8fabd8a 100644
--- a/libcxx/include/cstring
+++ b/libcxx/include/cstring
@@ -75,7 +75,7 @@ size_t strlen(const char* s);
_LIBCPP_BEGIN_NAMESPACE_STD
-using ::size_t _LIBCPP_USING_IF_EXISTS;
+using ::size_t;
using ::memcpy _LIBCPP_USING_IF_EXISTS;
using ::memmove _LIBCPP_USING_IF_EXISTS;
using ::strcpy _LIBCPP_USING_IF_EXISTS;
diff --git a/libcxx/include/ctime b/libcxx/include/ctime
index f47b49a43e23ef..b1124ad0eb489d 100644
--- a/libcxx/include/ctime
+++ b/libcxx/include/ctime
@@ -62,7 +62,7 @@ int timespec_get( struct timespec *ts, int base); // C++17
_LIBCPP_BEGIN_NAMESPACE_STD
using ::clock_t _LIBCPP_USING_IF_EXISTS;
-using ::size_t _LIBCPP_USING_IF_EXISTS;
+using ::size_t;
using ::time_t _LIBCPP_USING_IF_EXISTS;
using ::tm _LIBCPP_USING_IF_EXISTS;
#if _LIBCPP_STD_VER >= 17
diff --git a/libcxx/include/cuchar b/libcxx/include/cuchar
index f0015be275367d..9ffc5548c1c7f4 100644
--- a/libcxx/include/cuchar
+++ b/libcxx/include/cuchar
@@ -57,7 +57,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if !defined(_LIBCPP_CXX03_LANG)
using ::mbstate_t _LIBCPP_USING_IF_EXISTS;
-using ::size_t _LIBCPP_USING_IF_EXISTS;
+using ::size_t;
# if !defined(_LIBCPP_HAS_NO_C8RTOMB_MBRTOC8)
using ::mbrtoc8 _LIBCPP_USING_IF_EXISTS;
diff --git a/libcxx/include/cwchar b/libcxx/include/cwchar
index 08cfac58c846ac..9bbb19d5f00f35 100644
--- a/libcxx/include/cwchar
+++ b/libcxx/include/cwchar
@@ -127,7 +127,7 @@ size_t wcsrtombs(char* restrict dst, const wchar_t** restrict src, size_t len,
_LIBCPP_BEGIN_NAMESPACE_STD
using ::mbstate_t _LIBCPP_USING_IF_EXISTS;
-using ::size_t _LIBCPP_USING_IF_EXISTS;
+using ::size_t;
using ::tm _LIBCPP_USING_IF_EXISTS;
using ::wint_t _LIBCPP_USING_IF_EXISTS;
using ::FILE _LIBCPP_USING_IF_EXISTS;
|
✅ With the latest revision this PR passed the C/C++ code formatter. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes sense to me for ptrdiff_t
, size_t
and nullptr_t
, but not for the optional types like int8_t
. Also this should be rebased on top of the new __cstddef
headers.
4c1dc3f
to
29445fa
Compare
@philnik777 I rebased the patch and applied my comments, and I also dropped If you land, please remember to update the PR description first so it reflects what the new version of the patch does. |
This is superseded by #114788. |
There are a few types without which the library is hopelessly broken. Specifically, these are
size_t
,ptrdiff_t
and theintX_t
anduintX_t
types. This results in significantly better diagnostics if they are missing, since they are flagged at theusing
instead of the inevitable first use.