Skip to content

Commit

Permalink
Fixed demangle bug
Browse files Browse the repository at this point in the history
  • Loading branch information
zajo committed Jan 26, 2022
1 parent ae9aae2 commit a781140
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions include/boost/leaf/detail/demangle.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

// core::demangle
// This file is based on boost::core::demangle
//
// Copyright 2014 Peter Dimov
// Copyright 2014 Andrey Semashev
Expand Down Expand Up @@ -61,22 +61,26 @@ char const * t =

////////////////////////////////////////

#if defined(__has_include) && ((__GNUC__ + 0) >= 5)
// __has_include is currently supported by GCC and Clang. However GCC 4.9 may have issues and
// returns 1 for 'defined( __has_include )', while '__has_include' is actually not supported:
// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63662
#if defined(__has_include) && (!defined(__GNUC__) || defined(__clang__) || (__GNUC__ + 0) >= 5)
# if __has_include(<cxxabi.h>)
# define BOOST_LEAF_HAS_CXXABI_H
# endif
#elif defined(__GLIBCXX__) || defined(__GLIBCPP__)
#elif defined( __GLIBCXX__ ) || defined( __GLIBCPP__ )
# define BOOST_LEAF_HAS_CXXABI_H
#endif

#if defined( BOOST_LEAF_HAS_CXXABI_H )
# include <cxxabi.h>
// For some architectures (mips, mips64, x86, x86_64) cxxabi.h in Android NDK is implemented by gabi++ library
// (https://android.googlesource.com/platform/ndk/+/master/sources/cxx-stl/gabi++/), which does not implement
// abi::__cxa_demangle(). We detect this implementation by checking the include guard here.
// For some archtectures (mips, mips64, x86, x86_64) cxxabi.h in Android NDK is implemented by gabi++ library
// (https://android.googlesource.com/platform/ndk/+/master/sources/cxx-stl/gabi++/), which does not implement
// abi::__cxa_demangle(). We detect this implementation by checking the include guard here.
# if defined( __GABIXX_CXXABI_H__ )
# undef BOOST_LEAF_HAS_CXXABI_H
# else
# include <cstdlib>
# include <cstddef>
# endif
#endif
Expand Down

0 comments on commit a781140

Please sign in to comment.