Merge branch 'develop'

This commit is contained in:
Andrey Semashev
2019-01-15 13:34:33 +03:00
3 changed files with 90 additions and 28 deletions

View File

@ -240,6 +240,7 @@ matrix:
apt: apt:
packages: packages:
- libc++-dev - libc++-dev
- libc++abi-dev
- os: linux - os: linux
compiler: clang++-libc++ compiler: clang++-libc++
@ -248,10 +249,36 @@ matrix:
apt: apt:
packages: packages:
- libc++-dev - libc++-dev
- libc++abi-dev
- os: osx - os: osx
compiler: clang++ compiler: clang++
env: TOOLSET=clang COMPILER=clang++ CXXSTD=03,11,14,1z env: TOOLSET=clang COMPILER=clang++ CXXSTD=03,11,14,1z
osx_image: xcode7.3
- os: osx
compiler: clang++
env: TOOLSET=clang COMPILER=clang++ CXXSTD=03,11,14,1z
osx_image: xcode8.3
- os: osx
compiler: clang++
env: TOOLSET=clang COMPILER=clang++ CXXSTD=03,11,14,1z
osx_image: xcode9.4
- os: osx
compiler: clang++
env: TOOLSET=clang COMPILER=clang++ CXXSTD=03,11,14,1z
osx_image: xcode10.1
- os: linux
compiler: g++
env: CMAKE_SUBDIR_TEST=1
script:
- cd libs/core/test/cmake_subdir_test && mkdir __build__ && cd __build__
- cmake ..
- cmake --build .
- cmake --build . --target check
- os: linux - os: linux
compiler: g++ compiler: g++
@ -263,7 +290,8 @@ matrix:
- cmake --build . --target check - cmake --build . --target check
install: install:
- BOOST_BRANCH=develop && [ "$TRAVIS_BRANCH" == "master" ] && BOOST_BRANCH=master || true - BOOST_BRANCH=develop
- if [ "$TRAVIS_BRANCH" = "master" ]; then BOOST_BRANCH=master; fi
- cd .. - cd ..
- git clone -b $BOOST_BRANCH https://github.com/boostorg/boost.git boost-root - git clone -b $BOOST_BRANCH https://github.com/boostorg/boost.git boost-root
- cd boost-root - cd boost-root
@ -283,7 +311,8 @@ install:
script: script:
- |- - |-
echo "using $TOOLSET : : $COMPILER ;" > ~/user-config.jam echo "using $TOOLSET : : $COMPILER ;" > ~/user-config.jam
- ./b2 -j 3 libs/core/test toolset=$TOOLSET cxxstd=$CXXSTD variant=debug,release ${UBSAN:+cxxflags=-fsanitize=undefined cxxflags=-fno-sanitize-recover=undefined linkflags=-fsanitize=undefined define=UBSAN=1 debug-symbols=on} ${LINKFLAGS:+linkflags=$LINKFLAGS} - BUILD_JOBS=`(nproc || sysctl -n hw.ncpu) 2> /dev/null`
- ./b2 -j $BUILD_JOBS libs/core/test toolset=$TOOLSET cxxstd=$CXXSTD variant=debug,release ${UBSAN:+cxxflags=-fsanitize=undefined cxxflags=-fno-sanitize-recover=undefined linkflags=-fsanitize=undefined define=UBSAN=1 debug-symbols=on} ${LINKFLAGS:+linkflags=$LINKFLAGS}
notifications: notifications:
email: email:

View File

@ -73,4 +73,4 @@ build: off
test_script: test_script:
- PATH=%ADDPATH%%PATH% - PATH=%ADDPATH%%PATH%
- if not "%CXXSTD%" == "" set CXXSTD=cxxstd=%CXXSTD% - if not "%CXXSTD%" == "" set CXXSTD=cxxstd=%CXXSTD%
- b2 -j 3 libs/core/test toolset=%TOOLSET% %CXXSTD% - b2 -j %NUMBER_OF_PROCESSORS% libs/core/test toolset=%TOOLSET% %CXXSTD%

View File

@ -26,14 +26,16 @@
#pragma once #pragma once
#endif #endif
namespace boost { // Visual Studio 14 supports N4152 std::uncaught_exceptions()
#if (defined(__cpp_lib_uncaught_exceptions) && __cpp_lib_uncaught_exceptions >= 201411) || \
(defined(_MSC_VER) && _MSC_VER >= 1900)
#define BOOST_CORE_HAS_UNCAUGHT_EXCEPTIONS
#endif
namespace core { #if !defined(BOOST_CORE_HAS_UNCAUGHT_EXCEPTIONS)
namespace detail {
// cxxabi.h availability macro // cxxabi.h availability macro
#if defined(__has_include) && (!defined(BOOST_GCC) || (__GNUC__ + 0) >= 5) #if defined(__has_include) && (!defined(BOOST_GCC) || (__GNUC__ >= 5))
# if __has_include(<cxxabi.h>) # if __has_include(<cxxabi.h>)
# define BOOST_CORE_HAS_CXXABI_H # define BOOST_CORE_HAS_CXXABI_H
# endif # endif
@ -41,33 +43,60 @@ namespace detail {
# define BOOST_CORE_HAS_CXXABI_H # define BOOST_CORE_HAS_CXXABI_H
#endif #endif
#if defined(__cpp_lib_uncaught_exceptions) && __cpp_lib_uncaught_exceptions >= 201411 #if defined(BOOST_CORE_HAS_CXXABI_H)
#define BOOST_CORE_HAS_UNCAUGHT_EXCEPTIONS
#elif defined(BOOST_CORE_HAS_CXXABI_H)
// MinGW GCC 4.4 seem to not work the same way the newer GCC versions do. As a result, __cxa_get_globals based implementation will always return 0. // MinGW GCC 4.4 seem to not work the same way the newer GCC versions do. As a result, __cxa_get_globals based implementation will always return 0.
// Just disable it for now and fall back to std::uncaught_exception(). // Just disable it for now and fall back to std::uncaught_exception().
#if !defined(__MINGW32__) || (defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5))) #if !(defined(__MINGW32__) && (defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) < 405))
// Only GCC 4.7 declares __cxa_get_globals() in cxxabi.h, older compilers do not expose this function but it's there #include <cxxabi.h>
#include <cstring>
#define BOOST_CORE_HAS_CXA_GET_GLOBALS #define BOOST_CORE_HAS_CXA_GET_GLOBALS
extern "C" void* __cxa_get_globals(); // At least on MinGW and Linux, only GCC since 4.7 declares __cxa_get_globals() in cxxabi.h. Older versions of GCC do not expose this function but it's there.
#endif // On OpenBSD, it seems, the declaration is also missing.
#elif defined(_MSC_VER) // Note that at least on FreeBSD 11, cxxabi.h declares __cxa_get_globals with a different exception specification, so we can't declare the function unconditionally.
#if _MSC_VER >= 1900 // On Linux with clang and libc++ and on OS X, there is a version of cxxabi.h from libc++abi that doesn't declare __cxa_get_globals, but provides __cxa_uncaught_exceptions.
// Visual Studio 14 supports N4152 std::uncaught_exceptions() // The function only appeared in version _LIBCPPABI_VERSION >= 1002 of the library. Unfortunately, there are linking errors about undefined reference to __cxa_uncaught_exceptions
#define BOOST_CORE_HAS_UNCAUGHT_EXCEPTIONS // on Ubuntu Trusty and OS X, so we avoid using it and forward-declare __cxa_get_globals instead.
#elif _MSC_VER >= 1400 #if !defined(__FreeBSD__) && \
#define BOOST_CORE_HAS_GETPTD ( \
extern "C" void* _getptd(); (defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) < 407) || \
defined(__OpenBSD__) || \
defined(_LIBCPPABI_VERSION) \
)
namespace __cxxabiv1 {
struct __cxa_eh_globals;
#if defined(__OpenBSD__)
extern "C" __cxa_eh_globals* __cxa_get_globals();
#else
extern "C" __cxa_eh_globals* __cxa_get_globals() BOOST_NOEXCEPT_OR_NOTHROW __attribute__((__const__));
#endif #endif
} // namespace __cxxabiv1
#endif #endif
#endif // !(defined(__MINGW32__) && (defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) < 405))
#endif // defined(BOOST_CORE_HAS_CXXABI_H)
#if defined(_MSC_VER) && _MSC_VER >= 1400
#include <cstring>
#define BOOST_CORE_HAS_GETPTD
namespace boost {
namespace core {
namespace detail {
extern "C" void* _getptd();
} // namespace detail } // namespace detail
} // namespace core
} // namespace boost
#endif // defined(_MSC_VER) && _MSC_VER >= 1400
#endif // !defined(BOOST_CORE_HAS_UNCAUGHT_EXCEPTIONS)
#if !defined(BOOST_CORE_HAS_UNCAUGHT_EXCEPTIONS) && !defined(BOOST_CORE_HAS_CXA_GET_GLOBALS) && !defined(BOOST_CORE_HAS_GETPTD) #if !defined(BOOST_CORE_HAS_UNCAUGHT_EXCEPTIONS) && !defined(BOOST_CORE_HAS_CXA_GET_GLOBALS) && !defined(BOOST_CORE_HAS_GETPTD)
//! This macro is defined when `uncaught_exceptions` is not guaranteed to return values greater than 1 if multiple exceptions are pending //! This macro is defined when `uncaught_exceptions` is not guaranteed to return values greater than 1 if multiple exceptions are pending
#define BOOST_CORE_UNCAUGHT_EXCEPTIONS_EMULATED #define BOOST_CORE_UNCAUGHT_EXCEPTIONS_EMULATED
#endif #endif
namespace boost {
namespace core {
//! Returns the number of currently pending exceptions //! Returns the number of currently pending exceptions
inline unsigned int uncaught_exceptions() BOOST_NOEXCEPT inline unsigned int uncaught_exceptions() BOOST_NOEXCEPT
{ {
@ -76,23 +105,27 @@ inline unsigned int uncaught_exceptions() BOOST_NOEXCEPT
return static_cast< unsigned int >(std::uncaught_exceptions()); return static_cast< unsigned int >(std::uncaught_exceptions());
#elif defined(BOOST_CORE_HAS_CXA_GET_GLOBALS) #elif defined(BOOST_CORE_HAS_CXA_GET_GLOBALS)
// Tested on {clang 3.2,GCC 3.5.6,GCC 4.1.2,GCC 4.4.6,GCC 4.4.7}x{x32,x64} // Tested on {clang 3.2,GCC 3.5.6,GCC 4.1.2,GCC 4.4.6,GCC 4.4.7}x{x32,x64}
return *(reinterpret_cast< const unsigned int* >(static_cast< const char* >(boost::core::detail::__cxa_get_globals()) + sizeof(void*))); // __cxa_eh_globals::uncaughtExceptions, x32 offset - 0x4, x64 - 0x8 unsigned int count;
std::memcpy(&count, reinterpret_cast< const unsigned char* >(::abi::__cxa_get_globals()) + sizeof(void*), sizeof(count)); // __cxa_eh_globals::uncaughtExceptions, x32 offset - 0x4, x64 - 0x8
return count;
#elif defined(BOOST_CORE_HAS_GETPTD) #elif defined(BOOST_CORE_HAS_GETPTD)
// MSVC specific. Tested on {MSVC2005SP1,MSVC2008SP1,MSVC2010SP1,MSVC2012}x{x32,x64}. // MSVC specific. Tested on {MSVC2005SP1,MSVC2008SP1,MSVC2010SP1,MSVC2012}x{x32,x64}.
return *(reinterpret_cast< const unsigned int* >(static_cast< const char* >(boost::core::detail::_getptd()) + (sizeof(void*) == 8 ? 0x100 : 0x90))); // _tiddata::_ProcessingThrow, x32 offset - 0x90, x64 - 0x100 unsigned int count;
std::memcpy(&count, static_cast< const unsigned char* >(boost::core::detail::_getptd()) + (sizeof(void*) == 8u ? 0x100 : 0x90), sizeof(count)); // _tiddata::_ProcessingThrow, x32 offset - 0x90, x64 - 0x100
return count;
#else #else
// Portable C++03 implementation. Does not allow to detect multiple nested exceptions. // Portable C++03 implementation. Does not allow to detect multiple nested exceptions.
return static_cast< unsigned int >(std::uncaught_exception()); return static_cast< unsigned int >(std::uncaught_exception());
#endif #endif
} }
} // namespace core
} // namespace boost
#undef BOOST_CORE_HAS_CXXABI_H #undef BOOST_CORE_HAS_CXXABI_H
#undef BOOST_CORE_HAS_CXA_GET_GLOBALS #undef BOOST_CORE_HAS_CXA_GET_GLOBALS
#undef BOOST_CORE_HAS_UNCAUGHT_EXCEPTIONS #undef BOOST_CORE_HAS_UNCAUGHT_EXCEPTIONS
#undef BOOST_CORE_HAS_GETPTD #undef BOOST_CORE_HAS_GETPTD
} // namespace core
} // namespace boost
#endif // BOOST_CORE_UNCAUGHT_EXCEPTIONS_HPP_INCLUDED_ #endif // BOOST_CORE_UNCAUGHT_EXCEPTIONS_HPP_INCLUDED_