[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 08:03:39 PDT 2020


ldionne created this revision.
Herald added subscribers: libcxx-commits, dexonsmith, jkorous.
Herald added a project: libc++.
Herald added a reviewer: libc++.
ldionne added a reviewer: mclow.lists.
mclow.lists requested changes to this revision.
mclow.lists added a comment.
This revision now requires changes to proceed.

This is not sufficient; it just "moves the pain" from the callers code into the dylib.  All the functions in `charconv.cpp` need to be marked as `noexcept`.


The two functions don't throw, and the generated code is better when
we explicitly tell the compiler that the functions are noexcept. This
isn't an ABI break because the signatures of the functions stay the
same with or without noexcept.

https://llvm.org/PR46016


Repository:
  rG LLVM Github Monorepo

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
@@ -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.265505.patch
Type: text/x-patch
Size: 1142 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20200521/fe61b724/attachment.bin>


More information about the libcxx-commits mailing list