[libcxx-commits] [PATCH] D80379: [libc++] Mark __u64toa and __u32toa as noexcept

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu May 21 09:09:11 PDT 2020


ldionne updated this revision to Diff 265516.
ldionne added a comment.

Mark all functions in charconv.cpp as noexcept


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D80379/new/

https://reviews.llvm.org/D80379

Files:
  libcxx/include/charconv
  libcxx/src/charconv.cpp


Index: libcxx/src/charconv.cpp
===================================================================
--- libcxx/src/charconv.cpp
+++ libcxx/src/charconv.cpp
@@ -32,7 +32,7 @@
 
 template <typename T>
 inline _LIBCPP_INLINE_VISIBILITY char*
-append1(char* buffer, T i)
+append1(char* buffer, T i) noexcept
 {
     *buffer = '0' + static_cast<char>(i);
     return buffer + 1;
@@ -40,7 +40,7 @@
 
 template <typename T>
 inline _LIBCPP_INLINE_VISIBILITY char*
-append2(char* buffer, T i)
+append2(char* buffer, T i) noexcept
 {
     memcpy(buffer, &cDigitsLut[(i)*2], 2);
     return buffer + 2;
@@ -48,21 +48,21 @@
 
 template <typename T>
 inline _LIBCPP_INLINE_VISIBILITY char*
-append3(char* buffer, T i)
+append3(char* buffer, T i) noexcept
 {
     return append2(append1(buffer, (i) / 100), (i) % 100);
 }
 
 template <typename T>
 inline _LIBCPP_INLINE_VISIBILITY char*
-append4(char* buffer, T i)
+append4(char* buffer, T i) noexcept
 {
     return append2(append2(buffer, (i) / 100), (i) % 100);
 }
 
 template <typename T>
 inline _LIBCPP_INLINE_VISIBILITY char*
-append2_no_zeros(char* buffer, T v)
+append2_no_zeros(char* buffer, T v) noexcept
 {
     if (v < 10)
         return append1(buffer, v);
@@ -72,7 +72,7 @@
 
 template <typename T>
 inline _LIBCPP_INLINE_VISIBILITY char*
-append4_no_zeros(char* buffer, T v)
+append4_no_zeros(char* buffer, T v) noexcept
 {
     if (v < 100)
         return append2_no_zeros(buffer, v);
@@ -84,7 +84,7 @@
 
 template <typename T>
 inline _LIBCPP_INLINE_VISIBILITY char*
-append8_no_zeros(char* buffer, T v)
+append8_no_zeros(char* buffer, T v) noexcept
 {
     if (v < 10000)
     {
@@ -99,7 +99,7 @@
 }
 
 char*
-__u32toa(uint32_t value, char* buffer)
+__u32toa(uint32_t value, char* buffer) _NOEXCEPT
 {
     if (value < 100000000)
     {
@@ -120,7 +120,7 @@
 }
 
 char*
-__u64toa(uint64_t value, char* buffer)
+__u64toa(uint64_t value, char* buffer) _NOEXCEPT
 {
     if (value < 100000000)
     {
Index: libcxx/include/charconv
===================================================================
--- libcxx/include/charconv
+++ libcxx/include/charconv
@@ -93,8 +93,8 @@
 _LIBCPP_BEGIN_NAMESPACE_STD
 
 namespace __itoa {
-_LIBCPP_AVAILABILITY_TO_CHARS _LIBCPP_FUNC_VIS char* __u64toa(uint64_t __value, char* __buffer);
-_LIBCPP_AVAILABILITY_TO_CHARS _LIBCPP_FUNC_VIS char* __u32toa(uint32_t __value, char* __buffer);
+_LIBCPP_AVAILABILITY_TO_CHARS _LIBCPP_FUNC_VIS char* __u64toa(uint64_t __value, char* __buffer) _NOEXCEPT;
+_LIBCPP_AVAILABILITY_TO_CHARS _LIBCPP_FUNC_VIS char* __u32toa(uint32_t __value, char* __buffer) _NOEXCEPT;
 }
 
 #ifndef _LIBCPP_CXX03_LANG


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D80379.265516.patch
Type: text/x-patch
Size: 2623 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20200521/4be1c386/attachment.bin>


More information about the libcxx-commits mailing list