[libcxx-commits] [libcxx] b12ea06 - [libc++] Include C++ headers, not C headers, in <charconv>.
Arthur O'Dwyer via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Dec 10 19:03:55 PST 2020
Author: Arthur O'Dwyer
Date: 2020-12-10T22:03:12-05:00
New Revision: b12ea0652129da3b42642a0b76adbfab8833db53
URL: https://github.com/llvm/llvm-project/commit/b12ea0652129da3b42642a0b76adbfab8833db53
DIFF: https://github.com/llvm/llvm-project/commit/b12ea0652129da3b42642a0b76adbfab8833db53.diff
LOG: [libc++] Include C++ headers, not C headers, in <charconv>.
This matches how libc++ does it in all other C++ headers
(that is, headers not ending in ".h").
We need to include <cstring> if we want to use `_VSTD::memmove`
instead of unqualified ADL `memmove`. Even though ADL doesn't
physically matter in <charconv>'s specific case, I'm trying
to migrate libc++ to using `_VSTD::memmove` for all cases
(because some of them do matter, and this way it's easier to
grep for outliers).
Differential Revision: https://reviews.llvm.org/D92875
Added:
Modified:
libcxx/include/charconv
Removed:
################################################################################
diff --git a/libcxx/include/charconv b/libcxx/include/charconv
index 4664f5b1d034..4666c5c51db6 100644
--- a/libcxx/include/charconv
+++ b/libcxx/include/charconv
@@ -76,11 +76,11 @@ namespace std {
#include <__config>
#include <__availability>
#include <__errc>
-#include <type_traits>
+#include <cmath> // for log2f
+#include <cstdint>
+#include <cstring>
#include <limits>
-#include <stdint.h>
-#include <string.h>
-#include <math.h>
+#include <type_traits>
#include <__debug>
@@ -333,7 +333,7 @@ __to_chars_itoa(char* __first, char* __last, _Tp __value, false_type)
auto __len = __p - __buf;
if (__len <= __
diff )
{
- memcpy(__first, __buf, __len);
+ _VSTD::memcpy(__first, __buf, __len);
return {__first + __len, {}};
}
else
@@ -382,7 +382,7 @@ __to_chars_integral(char* __first, char* __last, _Tp __value, int __base,
return {__last, errc::value_too_large};
else
{
- memmove(__first, __p, __len);
+ _VSTD::memmove(__first, __p, __len);
return {__first + __len, {}};
}
}
@@ -429,7 +429,7 @@ __sign_combinator(_It __first, _It __last, _Tp& __value, _Fn __f, _Ts... __args)
if (__x <= __complement(__to_unsigned(__tl::min())))
{
__x = __complement(__x);
- memcpy(&__value, &__x, sizeof(__x));
+ _VSTD::memcpy(&__value, &__x, sizeof(__x));
return __r;
}
}
More information about the libcxx-commits
mailing list