[libcxx-commits] [libcxx] [libc++] Remove _LIBCPP_USING_IF_EXISTS from fundamental aliases (PR #107220)
via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Sep 4 04:06:55 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-libcxx
Author: Nikolas Klauser (philnik777)
<details>
<summary>Changes</summary>
There are a few types without which the library is hopelessly broken. Specifically, these are `size_t`, `ptrdiff_t` and the `intX_t` and `uintX_t` types. This results in significantly better diagnostics if they are missing, since they are flagged at the `using` instead of the inevitable first use.
---
Full diff: https://github.com/llvm/llvm-project/pull/107220.diff
8 Files Affected:
- (modified) libcxx/include/cstddef (+2-2)
- (modified) libcxx/include/cstdint (+9-9)
- (modified) libcxx/include/cstdio (+1-1)
- (modified) libcxx/include/cstdlib (+1-1)
- (modified) libcxx/include/cstring (+1-1)
- (modified) libcxx/include/ctime (+1-1)
- (modified) libcxx/include/cuchar (+1-1)
- (modified) libcxx/include/cwchar (+1-1)
``````````diff
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;
``````````
</details>
https://github.com/llvm/llvm-project/pull/107220
More information about the libcxx-commits
mailing list