[PATCH] D47987: Provide only one declaration of __throw_runtime_error

Dimitry Andric via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Jun 9 14:49:31 PDT 2018


dim created this revision.
dim added reviewers: hiraditya, mclow.lists, EricWF.
Herald added subscribers: christof, krytarowski, emaste.

In https://reviews.llvm.org/rL279903, @hiraditya added a second declaration of
`__throw_runtime_error` to `include/__locale`.  The original declaration
was in `__locale` too, but @mclow.lists moved it from there to
`stdexcept`.

In FreeBSD we compile most things with gcc's -Wredundant-decls, which
warns about such redundant redeclations, so I would like to remove the
one in `stdexcept`, as all the other callers of the function already
include `__locale` anyway.

While here, move the declaration in `__locale` to just above its first
invocation.


Repository:
  rCXX libc++

https://reviews.llvm.org/D47987

Files:
  include/__locale
  include/stdexcept


Index: include/stdexcept
===================================================================
--- include/stdexcept
+++ include/stdexcept
@@ -182,9 +182,6 @@
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
-// in the dylib
-_LIBCPP_NORETURN _LIBCPP_FUNC_VIS void __throw_runtime_error(const char*);
-
 _LIBCPP_NORETURN inline _LIBCPP_ALWAYS_INLINE
 void __throw_logic_error(const char*__msg)
 {
Index: include/__locale
===================================================================
--- include/__locale
+++ include/__locale
@@ -201,6 +201,8 @@
     friend class locale::__imp;
 };
 
+_LIBCPP_NORETURN _LIBCPP_FUNC_VIS void __throw_runtime_error(const char*);
+
 template <class _Facet>
 inline _LIBCPP_INLINE_VISIBILITY
 locale::locale(const locale& __other, _Facet* __f)
@@ -1229,8 +1231,6 @@
 _LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<wchar_t, char, mbstate_t>)
 _LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<char16_t, char, mbstate_t>)
 _LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<char32_t, char, mbstate_t>)
-
-_LIBCPP_NORETURN _LIBCPP_FUNC_VIS void __throw_runtime_error(const char*);
 
 template <size_t _Np>
 struct __narrow_to_utf8


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D47987.150639.patch
Type: text/x-patch
Size: 1234 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180609/a069682e/attachment.bin>


More information about the cfe-commits mailing list