[libcxx-commits] [PATCH] D58425: Fix the build with gcc 8.x

Ngie Cooper via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Feb 19 20:21:54 PST 2019


ngie created this revision.
ngie added reviewers: emaste, dim.
Herald added subscribers: libcxx-commits, jdoerfert, christof.
Herald added a project: libc++.

gcc 8.x fails claiming that `__throw_runtime_error`, defined in `__locale` and
`stdexcept`, are both defined in the std namespace.

Doing some closer inspection, it seems that it was declared in both
headers, but only implemented in `locale.cpp`. As such, the appropriate
location for the definition is further up in `__locale` [1].

1. Just removing the `stdexcept` definition didn't work; it needed to be moved up so earlier uses of the definition wouldn't cause the compiler to error out.

Signed-off-by: Enji Cooper <yaneurabeya at gmail.com>


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D58425

Files:
  libcxx/include/__locale
  libcxx/include/stdexcept


Index: libcxx/include/stdexcept
===================================================================
--- libcxx/include/stdexcept
+++ libcxx/include/stdexcept
@@ -181,9 +181,6 @@
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
-// in the dylib
-_LIBCPP_NORETURN _LIBCPP_FUNC_VIS void __throw_runtime_error(const char*);
-
 _LIBCPP_NORETURN inline _LIBCPP_INLINE_VISIBILITY
 void __throw_logic_error(const char*__msg)
 {
Index: libcxx/include/__locale
===================================================================
--- libcxx/include/__locale
+++ libcxx/include/__locale
@@ -44,6 +44,8 @@
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
+_LIBCPP_NORETURN _LIBCPP_FUNC_VIS void __throw_runtime_error(const char*);
+
 #if !defined(_LIBCPP_LOCALE__L_EXTENSIONS)
 struct __libcpp_locale_guard {
   _LIBCPP_INLINE_VISIBILITY
@@ -1229,8 +1231,6 @@
 _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: D58425.187508.patch
Type: text/x-patch
Size: 1162 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20190220/edbf2e65/attachment.bin>


More information about the libcxx-commits mailing list