Merge branch 'develop'

This commit is contained in:
Peter Dimov
2017-07-24 13:15:37 +03:00
4 changed files with 265 additions and 1 deletions

View File

@ -111,6 +111,15 @@ matrix:
sources:
- ubuntu-toolchain-r-test
- os: linux
env: TOOLSET=gcc COMPILER=g++-5 CXXSTD=c++1z
addons:
apt:
packages:
- g++-5
sources:
- ubuntu-toolchain-r-test
- os: linux
env: TOOLSET=gcc COMPILER=g++-6 CXXSTD=c++03
addons:
@ -147,6 +156,50 @@ matrix:
sources:
- ubuntu-toolchain-r-test
- os: linux
dist: trusty
compiler: g++-7
env: TOOLSET=gcc COMPILER=g++-7 CXXSTD=c++03
addons:
apt:
packages:
- g++-7
sources:
- ubuntu-toolchain-r-test
- os: linux
dist: trusty
compiler: g++-7
env: TOOLSET=gcc COMPILER=g++-7 CXXSTD=c++11
addons:
apt:
packages:
- g++-7
sources:
- ubuntu-toolchain-r-test
- os: linux
dist: trusty
compiler: g++-7
env: TOOLSET=gcc COMPILER=g++-7 CXXSTD=c++14
addons:
apt:
packages:
- g++-7
sources:
- ubuntu-toolchain-r-test
- os: linux
dist: trusty
compiler: g++-7
env: TOOLSET=gcc COMPILER=g++-7 CXXSTD=c++17
addons:
apt:
packages:
- g++-7
sources:
- ubuntu-toolchain-r-test
- os: linux
env: TOOLSET=clang COMPILER=clang++ CXXSTD=c++03
@ -273,6 +326,50 @@ matrix:
- ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.9
- os: linux
compiler: clang++-4.0
env: TOOLSET=clang COMPILER=clang++-4.0 CXXSTD=c++03
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=c++11
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=c++14
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=c++1z
addons:
apt:
packages:
- clang-4.0
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-trusty-4.0
- os: osx
env: TOOLSET=clang COMPILER=clang++ CXXSTD=c++03

View File

@ -262,6 +262,49 @@ namespace boost
return std_cat_;
}
#else
// to maintain ABI compatibility between 03 and 11,
// define a class with the same layout
private:
class std_category
{
private:
boost::system::error_category const * pc_;
public:
explicit std_category( boost::system::error_category const * pc ): pc_( pc )
{
}
virtual ~std_category() {}
virtual const char * name() const BOOST_NOEXCEPT
{
return pc_->name();
}
// we can't define message, because (1) it returns an std::string,
// which can be different between 03 and 11, and (2) on mingw, there
// are actually two `message` functions, not one, so it doesn't work
// even if we do
// neither can we define default_error_condition or equivalent
// if these functions are called, it will crash, but that's still
// better than the alternative of having the class layout change
};
std_category std_cat_;
public:
error_category() BOOST_SYSTEM_NOEXCEPT: std_cat_( this ) {}
#endif
public:

View File

@ -20,7 +20,42 @@ project
: <link>shared:<define>BOOST_SYSTEM_DYN_LINK=1
<link>static:<define>BOOST_SYSTEM_STATIC_LINK=1
;
rule cxx03 ( properties * )
{
local result ;
if <toolset>gcc in $(properties) || <toolset>clang in $(properties)
{
result = <cxxflags>-std=c++03 ;
}
else
{
result = <build>no ;
}
return $(result) ;
}
rule cxx11 ( properties * )
{
local result ;
if <toolset-gcc:version>4.6 in $(properties)
{
result = <cxxflags>-std=c++0x ;
}
else if <toolset>gcc in $(properties) || <toolset>clang in $(properties)
{
result = <cxxflags>-std=c++11 ;
}
else
{
result = <build>no ;
}
return $(result) ;
}
test-suite "system"
: [ run error_code_test.cpp
@ -32,6 +67,18 @@ project
[ run error_code_test.cpp
: : : <link>shared : error_code_test_shared
]
[ run error_code_test.cpp
: : : <link>static <conditional>@cxx03 : error_code_test_03
]
[ run error_code_test.cpp
: : : <link>shared <conditional>@cxx03 : error_code_test_shared_03
]
[ run error_code_test.cpp
: : : <link>static <conditional>@cxx11 : error_code_test_11
]
[ run error_code_test.cpp
: : : <link>shared <conditional>@cxx11 : error_code_test_shared_11
]
[ run error_code_user_test.cpp
: : : <link>static
]
@ -62,4 +109,16 @@ project
[ run std_interop_test.cpp
: : : <link>shared : std_interop_test_shared
]
[ run std_mismatch_test.cpp
: : : <link>static <conditional>@cxx03 : std_mismatch_test_03
]
[ run std_mismatch_test.cpp
: : : <link>shared <conditional>@cxx03 : std_mismatch_test_shared_03
]
[ run std_mismatch_test.cpp
: : : <link>static <conditional>@cxx11 : std_mismatch_test_11
]
[ run std_mismatch_test.cpp
: : : <link>shared <conditional>@cxx11 : std_mismatch_test_shared_11
]
;

View File

@ -0,0 +1,65 @@
// Copyright 2017 Peter Dimov.
//
// 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
// See library home page at http://www.boost.org/libs/system
// Avoid spurious VC++ warnings
# define _CRT_SECURE_NO_WARNINGS
#include <boost/config.hpp>
#include <iostream>
#if defined(BOOST_NO_CXX11_HDR_SYSTEM_ERROR)
int main()
{
std::cout
<< "The version of the C++ standard library being used does not"
" support header <system_error> so interoperation will not be tested.\n";
}
#else
#include <boost/system/error_code.hpp>
#include <boost/core/lightweight_test.hpp>
#include <system_error>
#include <cerrno>
#include <string>
#include <cstdio>
static void test_generic_category()
{
boost::system::error_category const & bt = boost::system::generic_category();
std::error_category const & st = bt;
BOOST_TEST_CSTR_EQ( bt.name(), st.name() );
BOOST_TEST_EQ( bt.name(), st.name() );
}
static void test_system_category()
{
boost::system::error_category const & bt = boost::system::system_category();
std::error_category const & st = bt;
BOOST_TEST_CSTR_EQ( bt.name(), st.name() );
BOOST_TEST_EQ( bt.name(), st.name() );
}
int main()
{
std::cout
<< "The version of the C++ standard library being used"
" supports header <system_error> so interoperation will be tested.\n";
test_generic_category();
test_system_category();
return boost::report_errors();
}
#endif