Compare commits

...

19 Commits

Author SHA1 Message Date
Peter Dimov
bbd0a3766d Sprinkle more BOOST_SYMBOL_VISIBLE throughout 2018-09-16 13:53:11 +03:00
Peter Dimov
a9909bb82b Add BOOST_SYMBOL_VISIBLE to generic_error_category and system_error_category, to placate ubsan 2018-09-16 08:00:24 +03:00
Peter Dimov
3bdea5dfa3 Disable constexpr on msvc-14.1 2018-09-16 04:49:59 +03:00
Peter Dimov
02ea086173 Fix throw_test.cpp to not meddle with BOOST_SYSTEM_SOURCE as it needs to import from Boost.System while exporting throw_test() 2018-09-16 04:32:33 +03:00
Peter Dimov
4b7018de85 MSVC requires __declspec(dllimport) for variables 2018-09-16 04:23:37 +03:00
Peter Dimov
f92c0fc9b7 Use enable_if from type_traits 2018-09-15 01:50:41 +03:00
Peter Dimov
dc5a054d9e Remove unnecessary #include 2018-09-15 01:00:39 +03:00
Peter Dimov
13199e504c Reorder includes to avoid ::gets error under Clang 3.8, 3.9 2018-07-19 19:48:20 +03:00
Peter Dimov
3c59cea7ef Disable constexpr on Clang/libstdc++4.8 2018-07-19 19:04:53 +03:00
Peter Dimov
697c73ac57 Reorder Travis configurations 2018-07-19 19:00:14 +03:00
Peter Dimov
3afc9db9e6 Add Clang configurations using the default libstdc++ to Travis 2018-07-19 18:27:57 +03:00
Peter Dimov
e57cca107d Disable constexpr on Clang/Win 2018-07-09 13:50:27 +03:00
Peter Dimov
9e039cfaf9 Fix dllexport mismatch errors under clang++ 2018-06-29 05:39:42 +03:00
Peter Dimov
084d8e119e Update g++ workaround to exclude 7.4/8.1 2018-06-29 03:56:56 +03:00
Peter Dimov
0d2aeead38 Update workarounds to cover g++ 8.1 2018-06-29 02:29:23 +03:00
Peter Dimov
73b2805d63 Add g++ 8, clang++ 6 to Travis 2018-06-29 00:42:31 +03:00
Peter Dimov
6a71483984 Work around ld: unrecognized option '--push-state--no-as-needed' 2018-05-04 15:47:28 +03:00
Peter Dimov
2b1aa524d9 Merge pull request #23 from boostorg/feature/constexpr
Make error_code and error_condition constexpr, as proposed in https://cplusplus.github.io/LWG/issue2992
2018-05-04 15:06:41 +03:00
Peter Dimov
a9bb21507a Add Cygwin 64 to Appveyor 2018-03-09 05:12:03 +02:00
8 changed files with 169 additions and 46 deletions

View File

@@ -109,7 +109,7 @@ matrix:
- os: linux
compiler: g++-7
env: UBSAN=1 TOOLSET=gcc COMPILER=g++-7 CXXSTD=03,11,14,17 UBSAN_OPTIONS=print_stacktrace=1
env: UBSAN=1 TOOLSET=gcc COMPILER=g++-7 CXXSTD=03,11,14,17 UBSAN_OPTIONS=print_stacktrace=1 LINKFLAGS=-fuse-ld=gold
addons:
apt:
packages:
@@ -117,6 +117,16 @@ matrix:
sources:
- ubuntu-toolchain-r-test
- os: linux
compiler: g++-8
env: TOOLSET=gcc COMPILER=g++-8 CXXSTD=03,11,14,17
addons:
apt:
packages:
- g++-8
sources:
- ubuntu-toolchain-r-test
- os: linux
compiler: clang++
env: TOOLSET=clang COMPILER=clang++ CXXSTD=03,11
@@ -160,6 +170,18 @@ matrix:
- ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.6
- os: linux
compiler: clang++-3.6
env: TOOLSET=clang COMPILER=clang++-3.6 CXXSTD=03,11,14,1z
addons:
apt:
packages:
- clang-3.6
- libstdc++-4.9-dev
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.6
- os: linux
compiler: clang++-3.7
env: TOOLSET=clang COMPILER=clang++-3.7 CXXSTD=03,11,14,1z
@@ -171,6 +193,29 @@ matrix:
- ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.7
- os: linux
compiler: clang++-3.7
env: TOOLSET=clang COMPILER=clang++-3.7 CXXSTD=03,11,14,1z
addons:
apt:
packages:
- clang-3.7
- libstdc++-4.9-dev
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.7
- os: linux
compiler: clang++-3.8
env: TOOLSET=clang COMPILER=clang++-3.8 CXXSTD=03,11,14,1z
addons:
apt:
packages:
- clang-3.8
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.8
- os: linux
compiler: clang++-3.8
env: TOOLSET=clang COMPILER=clang++-3.8 CXXSTD=03,11,14,1z
@@ -183,6 +228,17 @@ matrix:
- ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.8
- os: linux
compiler: clang++-3.9
env: TOOLSET=clang COMPILER=clang++-3.9 CXXSTD=03,11,14,1z
addons:
apt:
packages:
- clang-3.9
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.9
- os: linux
compiler: clang++-3.9
env: TOOLSET=clang COMPILER=clang++-3.9 CXXSTD=03,11,14,1z
@@ -195,6 +251,17 @@ matrix:
- ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.9
- os: linux
compiler: clang++-4.0
env: TOOLSET=clang COMPILER=clang++-4.0 CXXSTD=03,11,14,1z
addons:
apt:
packages:
- clang-4.0
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-trusty-4.0
- os: linux
compiler: clang++-4.0
env: TOOLSET=clang COMPILER=clang++-4.0 CXXSTD=03,11,14,1z
@@ -207,6 +274,17 @@ matrix:
- ubuntu-toolchain-r-test
- llvm-toolchain-trusty-4.0
- os: linux
compiler: clang++-5.0
env: TOOLSET=clang COMPILER=clang++-5.0 CXXSTD=03,11,14,1z
addons:
apt:
packages:
- clang-5.0
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-trusty-5.0
- os: linux
compiler: clang++-5.0
env: TOOLSET=clang COMPILER=clang++-5.0 CXXSTD=03,11,14,1z
@@ -231,6 +309,29 @@ matrix:
- ubuntu-toolchain-r-test
- llvm-toolchain-trusty-5.0
- os: linux
compiler: clang++-6.0
env: TOOLSET=clang COMPILER=clang++-6.0 CXXSTD=03,11,14,17
addons:
apt:
packages:
- clang-6.0
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-trusty-6.0
- os: linux
compiler: clang++-6.0
env: TOOLSET=clang COMPILER=clang++-6.0 CXXSTD=03,11,14,17
addons:
apt:
packages:
- clang-6.0
- libstdc++-4.9-dev
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-trusty-6.0
- os: linux
compiler: clang++-libc++
env: TOOLSET=clang COMPILER=clang++-libc++ CXXSTD=03,11,14,1z
@@ -267,7 +368,7 @@ install:
script:
- |-
echo "using $TOOLSET : : $COMPILER ;" > ~/user-config.jam
- ./b2 -j3 libs/system/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}
- ./b2 -j3 libs/system/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:
email:

View File

@@ -36,6 +36,13 @@ environment:
ADDPATH: C:\cygwin\bin;
TOOLSET: gcc
CXXSTD: 03,11
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
ADDPATH: C:\cygwin64\bin;
TOOLSET: gcc
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
ADDPATH: C:\cygwin64\bin;
TOOLSET: gcc
CXXSTD: 03,11
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
ADDPATH: C:\mingw\bin;
TOOLSET: gcc

View File

@@ -14,9 +14,8 @@
#include <boost/system/config.hpp>
#include <boost/cstdint.hpp>
#include <boost/assert.hpp>
#include <boost/noncopyable.hpp>
#include <boost/utility/enable_if.hpp>
#include <boost/type_traits/enable_if.hpp>
#include <ostream>
#include <string>
#include <stdexcept>
@@ -43,11 +42,28 @@
# define BOOST_SYSTEM_HAS_CONSTEXPR
#endif
#if defined(__GNUC__) && (__GNUC__ == 7 || __GNUC__ == 8) && __cplusplus >= 201700L
#if defined(__GNUC__) && (__GNUC__ == 7 && __GNUC_MINOR__ < 4) && __cplusplus >= 201700L
// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83835
# undef BOOST_SYSTEM_HAS_CONSTEXPR
#endif
#if defined(__clang__) && defined(_MSC_VER) && defined(_CPPLIB_VER)
// Clang on Windows with MSVC headers, the constructor of std::error_category
// is not constexpr at least up to VS2017 15.7.x (_MSVC_STL_UPDATE 201803)
# undef BOOST_SYSTEM_HAS_CONSTEXPR
#endif
#if defined(__clang__) && defined(BOOST_LIBSTDCXX_VERSION) && BOOST_LIBSTDCXX_VERSION < 40900
// The constructor of std::error_category is not constexpr in libstdc++ 4.8
# undef BOOST_SYSTEM_HAS_CONSTEXPR
#endif
#if defined(BOOST_MSVC) && BOOST_MSVC < 1920
// msvc-14.1 does not implement correct static initialization for
// classes with constexpr constructors
# undef BOOST_SYSTEM_HAS_CONSTEXPR
#endif
#if defined(BOOST_SYSTEM_HAS_CONSTEXPR)
# define BOOST_SYSTEM_CONSTEXPR constexpr
#else
@@ -209,13 +225,13 @@ namespace boost
// class error_category ------------------------------------------------//
class error_category : public noncopyable
class BOOST_SYMBOL_VISIBLE error_category : public noncopyable
{
#ifndef BOOST_NO_CXX11_HDR_SYSTEM_ERROR
private:
class std_category: public std::error_category
class BOOST_SYMBOL_VISIBLE std_category: public std::error_category
{
private:
@@ -266,7 +282,7 @@ namespace boost
private:
class std_category
class BOOST_SYMBOL_VISIBLE std_category
{
private:
@@ -345,7 +361,7 @@ namespace detail
# define BOOST_SYSTEM_DECL_ BOOST_SYSTEM_DECL
#endif
class generic_error_category: public error_category
class BOOST_SYMBOL_VISIBLE generic_error_category: public error_category
{
public:
@@ -363,7 +379,7 @@ public:
BOOST_SYSTEM_DECL_ std::string message( int ev ) const;
};
class system_error_category: public error_category
class BOOST_SYMBOL_VISIBLE system_error_category: public error_category
{
public:
@@ -442,9 +458,23 @@ inline const error_category & generic_category() BOOST_SYSTEM_NOEXCEPT
namespace detail
{
#if defined(BOOST_SYSTEM_SOURCE) || defined(_MSC_VER)
// clang++ requires a strictly matching declaration
// MSVC requires __declspec(dllimport)
BOOST_SYSTEM_DECL extern system_error_category system_category_instance;
BOOST_SYSTEM_DECL extern generic_error_category generic_category_instance;
#else
// g++ constexpr requires absence of __declspec(dllimport)
extern system_error_category system_category_instance;
extern generic_error_category generic_category_instance;
#endif
} // namespace detail
constexpr const error_category & system_category() BOOST_SYSTEM_NOEXCEPT
@@ -508,7 +538,7 @@ inline const error_category & generic_category() BOOST_SYSTEM_NOEXCEPT
template <class ErrorConditionEnum>
error_condition(ErrorConditionEnum e,
typename boost::enable_if<is_error_condition_enum<ErrorConditionEnum> >::type*
typename boost::enable_if_<is_error_condition_enum<ErrorConditionEnum>::value>::type*
= 0) BOOST_SYSTEM_NOEXCEPT
{
*this = make_error_condition(e);
@@ -523,7 +553,7 @@ inline const error_category & generic_category() BOOST_SYSTEM_NOEXCEPT
}
template<typename ErrorConditionEnum>
typename boost::enable_if<is_error_condition_enum<ErrorConditionEnum>,
typename boost::enable_if_<is_error_condition_enum<ErrorConditionEnum>::value,
error_condition>::type &
operator=( ErrorConditionEnum val ) BOOST_SYSTEM_NOEXCEPT
{
@@ -618,7 +648,7 @@ inline const error_category & generic_category() BOOST_SYSTEM_NOEXCEPT
template <class ErrorCodeEnum>
error_code(ErrorCodeEnum e,
typename boost::enable_if<is_error_code_enum<ErrorCodeEnum> >::type* = 0)
typename boost::enable_if_<is_error_code_enum<ErrorCodeEnum>::value>::type* = 0)
BOOST_SYSTEM_NOEXCEPT
{
*this = make_error_code(e);
@@ -632,7 +662,7 @@ inline const error_category & generic_category() BOOST_SYSTEM_NOEXCEPT
}
template<typename ErrorCodeEnum>
typename boost::enable_if<is_error_code_enum<ErrorCodeEnum>, error_code>::type &
typename boost::enable_if_<is_error_code_enum<ErrorCodeEnum>::value, error_code>::type &
operator=( ErrorCodeEnum val ) BOOST_SYSTEM_NOEXCEPT
{
*this = make_error_code(val);

View File

@@ -8,10 +8,10 @@
#ifndef BOOST_SYSTEM_SYSTEM_ERROR_HPP
#define BOOST_SYSTEM_SYSTEM_ERROR_HPP
#include <boost/system/error_code.hpp>
#include <string>
#include <stdexcept>
#include <cassert>
#include <boost/system/error_code.hpp>
namespace boost
{

View File

@@ -15,12 +15,8 @@ project
<library>/boost/system//boost_system
<toolset>msvc:<asynch-exceptions>on
;
lib throw_test
: throw_test.cpp
: <link>shared:<define>BOOST_SYSTEM_DYN_LINK=1
<link>static:<define>BOOST_SYSTEM_STATIC_LINK=1
;
lib throw_test : throw_test.cpp : <link>shared:<define>THROW_DYN_LINK=1 ;
lib single_instance_lib1 : single_instance_1.cpp : <link>shared:<define>SINGLE_INSTANCE_DYN_LINK ;
lib single_instance_lib2 : single_instance_2.cpp : <link>shared:<define>SINGLE_INSTANCE_DYN_LINK ;

View File

@@ -32,7 +32,7 @@ BOOST_STATIC_ASSERT( e2.category() == generic_category() );
BOOST_STATIC_ASSERT( e2 );
BOOST_STATIC_ASSERT( e2 == e2 );
#if !BOOST_WORKAROUND(BOOST_GCC, < 80000)
#if !BOOST_WORKAROUND(BOOST_GCC, < 80200)
BOOST_STATIC_ASSERT( e1 != e2 );
@@ -45,7 +45,7 @@ BOOST_STATIC_ASSERT( e3.category() == system_category() );
BOOST_STATIC_ASSERT( !e3 );
BOOST_STATIC_ASSERT( e3 == e3 );
#if !BOOST_WORKAROUND(BOOST_GCC, < 80000)
#if !BOOST_WORKAROUND(BOOST_GCC, < 80200)
BOOST_STATIC_ASSERT( e1 != e3 );

View File

@@ -19,22 +19,15 @@
//--------------------------------------------------------------------------------------//
#include <boost/system/system_error.hpp>
#include <iostream>
namespace boost
{
namespace system
{
BOOST_SYSTEM_DECL void throw_test();
}
}
void throw_test();
int main()
{
try
{
boost::system::throw_test();
throw_test();
}
catch (const boost::system::system_error& ex)
{
@@ -42,7 +35,6 @@ int main()
std::cout << " what() reports " << ex.what() << '\n';
return 0;
}
catch (const std::runtime_error& ex)
{
std::cout << " error: caught std::runtime_error instead of boost::system::system_error\n";
@@ -52,4 +44,4 @@ int main()
std::cout << " error: failed to catch boost::system::system_error\n";
return 1;
}
}

View File

@@ -13,19 +13,16 @@
//--------------------------------------------------------------------------------------//
// define BOOST_SYSTEM_SOURCE so that <boost/system/config.hpp> knows
// the library is being built (possibly exporting rather than importing code)
#define BOOST_SYSTEM_SOURCE
#include <boost/system/system_error.hpp>
#include <boost/config.hpp>
namespace boost
#if defined(THROW_DYN_LINK)
# define EXPORT BOOST_SYMBOL_EXPORT
#else
# define EXPORT
#endif
EXPORT void throw_test()
{
namespace system
{
BOOST_SYSTEM_DECL void throw_test()
{
throw system_error(9999, system_category(), "boo boo");
}
}
throw boost::system::system_error( 9999, boost::system::system_category(), "boo boo" );
}