forked from boostorg/system
Compare commits
9 Commits
feature/tr
...
feature/op
Author | SHA1 | Date | |
---|---|---|---|
00b30343b9 | |||
c91dbc8249 | |||
00d85d8d37 | |||
5d3365717e | |||
6942dc454b | |||
7ba160e443 | |||
d9bfbfc4d4 | |||
90cb8254df | |||
4d1486dec9 |
38
.travis.yml
38
.travis.yml
@ -312,14 +312,46 @@ matrix:
|
||||
env: UBSAN=1 TOOLSET=clang COMPILER=clang++ CXXSTD=03,11,14,1z UBSAN_OPTIONS=print_stacktrace=1
|
||||
|
||||
- os: linux
|
||||
compiler: g++
|
||||
env: CMAKE_SUBDIR_TEST=1
|
||||
env: CMAKE=1
|
||||
script:
|
||||
- cd libs/system/test/cmake_subdir_test && mkdir __build__ && cd __build__
|
||||
- mkdir __build__ && cd __build__
|
||||
- cmake -DBOOST_ENABLE_CMAKE=1 -DBoost_VERBOSE=1 -DBOOST_INCLUDE_LIBRARIES=system -DBUILD_TESTING=ON ..
|
||||
- ctest --output-on-failure -R boost_system
|
||||
|
||||
- os: linux
|
||||
env: CMAKE=1 BUILD_SHARED_LIBS=ON
|
||||
script:
|
||||
- mkdir __build__ && cd __build__
|
||||
- cmake -DBOOST_ENABLE_CMAKE=1 -DBoost_VERBOSE=1 -DBUILD_SHARED_LIBS=ON -DBOOST_INCLUDE_LIBRARIES=system -DBUILD_TESTING=ON ..
|
||||
- ctest --output-on-failure -R boost_system
|
||||
|
||||
- os: linux
|
||||
env: CMAKE_SUBDIR_TEST=1
|
||||
install:
|
||||
- BOOST_BRANCH=develop && [ "$TRAVIS_BRANCH" == "master" ] && BOOST_BRANCH=master || true
|
||||
- git clone -b $BOOST_BRANCH https://github.com/boostorg/assert.git ../assert
|
||||
- git clone -b $BOOST_BRANCH https://github.com/boostorg/config.git ../config
|
||||
- git clone -b $BOOST_BRANCH https://github.com/boostorg/core.git ../core
|
||||
- git clone -b $BOOST_BRANCH https://github.com/boostorg/predef.git ../predef
|
||||
- git clone -b $BOOST_BRANCH https://github.com/boostorg/winapi.git ../winapi
|
||||
script:
|
||||
- cd test/cmake_subdir_test && mkdir __build__ && cd __build__
|
||||
- cmake ..
|
||||
- cmake --build .
|
||||
- cmake --build . --target check
|
||||
|
||||
- os: linux
|
||||
env: CMAKE_INSTALL=1
|
||||
script:
|
||||
- pip install --user cmake
|
||||
- mkdir __build__ && cd __build__
|
||||
- cmake -DBOOST_ENABLE_CMAKE=1 -DBoost_VERBOSE=1 -DBOOST_INCLUDE_LIBRARIES="system;core" -DBUILD_TESTING=OFF -DCMAKE_INSTALL_PREFIX=~/.local ..
|
||||
- cmake --build . --target install
|
||||
- cd ../libs/system/test/cmake_install_test && mkdir __build__ && cd __build__
|
||||
- cmake -DCMAKE_INSTALL_PREFIX=~/.local ..
|
||||
- cmake --build .
|
||||
- cmake --build . --target check
|
||||
|
||||
install:
|
||||
- BOOST_BRANCH=develop && [ "$TRAVIS_BRANCH" == "master" ] && BOOST_BRANCH=master || true
|
||||
- cd ..
|
||||
|
@ -1,12 +1,10 @@
|
||||
# Copyright 2018 Mike Dev
|
||||
# Copyright 2018-2020 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
|
||||
|
||||
# Partial (add_subdirectory only) and experimental CMake support
|
||||
# Subject to change; please do not rely on the contents of this file yet
|
||||
cmake_minimum_required(VERSION 3.5...3.16)
|
||||
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
project(BoostSystem LANGUAGES CXX)
|
||||
project(boost_system VERSION "${BOOST_SUPERPROJECT_VERSION}" LANGUAGES CXX)
|
||||
|
||||
add_library(boost_system INTERFACE)
|
||||
add_library(Boost::system ALIAS boost_system)
|
||||
@ -14,7 +12,13 @@ add_library(Boost::system ALIAS boost_system)
|
||||
target_include_directories(boost_system INTERFACE include)
|
||||
|
||||
target_link_libraries(boost_system
|
||||
INTERFACE
|
||||
Boost::config
|
||||
Boost::winapi
|
||||
INTERFACE
|
||||
Boost::config
|
||||
Boost::winapi
|
||||
)
|
||||
|
||||
if(BUILD_TESTING)
|
||||
|
||||
add_subdirectory(test)
|
||||
|
||||
endif()
|
||||
|
@ -1,5 +1,6 @@
|
||||
<style>
|
||||
|
||||
*:not(pre)>code { background: none; color: #600000; }
|
||||
:not(pre):not([class^=L])>code { background: none; color: #600000; }
|
||||
|
||||
</style>
|
||||
|
@ -8,9 +8,13 @@ http://www.boost.org/LICENSE_1_0.txt
|
||||
////
|
||||
|
||||
[#changes]
|
||||
# Release History
|
||||
# Revision History
|
||||
:idprefix:
|
||||
|
||||
## Changes in Boost 1.74
|
||||
|
||||
* `operator bool()` now returns `failed()` instead of `value() != 0`.
|
||||
|
||||
## Changes in Boost 1.69
|
||||
|
||||
* Boost.System is now header-only. A stub library is still built for
|
||||
|
@ -568,7 +568,8 @@ constexpr void clear() noexcept;
|
||||
[none]
|
||||
* {blank}
|
||||
+
|
||||
Ensures: :: `val_ == 0`; `*cat_ == system_category()`.
|
||||
Ensures: ::
|
||||
`val_ == 0`; `*cat_ == system_category()`.
|
||||
|
||||
#### Observers
|
||||
|
||||
@ -626,7 +627,7 @@ constexpr explicit operator bool() const noexcept;
|
||||
[none]
|
||||
* {blank}
|
||||
+
|
||||
Returns: :: `val_ != 0`.
|
||||
Returns: :: `failed()`.
|
||||
|
||||
```
|
||||
operator std::error_code() const;
|
||||
@ -634,7 +635,8 @@ operator std::error_code() const;
|
||||
[none]
|
||||
* {blank}
|
||||
+
|
||||
Returns: :: `std::error_code( val_, *cat_ )`.
|
||||
Returns: ::
|
||||
`std::error_code( val_, *cat_ )`.
|
||||
|
||||
### Class error_condition
|
||||
|
||||
@ -711,7 +713,8 @@ template <class ErrorConditionEnum>
|
||||
* {blank}
|
||||
+
|
||||
Ensures: :: `*this == make_error_condition( e )`.
|
||||
Remarks: :: This constructor is only enabled when `is_error_condition_enum<ErrorConditionEnum>::value` is `true`.
|
||||
Remarks: ::
|
||||
This constructor is only enabled when `is_error_condition_enum<ErrorConditionEnum>::value` is `true`.
|
||||
|
||||
#### Modifiers
|
||||
|
||||
@ -739,7 +742,8 @@ constexpr void clear() noexcept;
|
||||
[none]
|
||||
* {blank}
|
||||
+
|
||||
Ensures: :: `val_ == 0`; `*cat_ == generic_category()`.
|
||||
Ensures: ::
|
||||
`val_ == 0`; `*cat_ == generic_category()`.
|
||||
|
||||
#### Observers
|
||||
|
||||
@ -789,7 +793,7 @@ constexpr explicit operator bool() const noexcept;
|
||||
[none]
|
||||
* {blank}
|
||||
+
|
||||
Returns: :: `val_ != 0`.
|
||||
Returns: :: `failed()`.
|
||||
|
||||
```
|
||||
operator std::error_condition() const;
|
||||
@ -797,7 +801,8 @@ operator std::error_condition() const;
|
||||
[none]
|
||||
* {blank}
|
||||
+
|
||||
Returns: :: `std::error_condition( val_, *cat_ )`.
|
||||
Returns: ::
|
||||
`std::error_condition( val_, *cat_ )`.
|
||||
|
||||
### Nonmember functions
|
||||
|
||||
@ -882,7 +887,8 @@ std::size_t hash_value( const error_code & ec );
|
||||
[none]
|
||||
* {blank}
|
||||
+
|
||||
Returns: :: A hash value representing `ec`.
|
||||
Returns: ::
|
||||
A hash value representing `ec`.
|
||||
|
||||
## <boost/system/system_error.hpp>
|
||||
|
||||
@ -941,7 +947,8 @@ system_error( int ev, const error_category & ecat );
|
||||
[none]
|
||||
* {blank}
|
||||
+
|
||||
Ensures: :: `code() == error_code( ev, ecat )`.
|
||||
Ensures: ::
|
||||
`code() == error_code( ev, ecat )`.
|
||||
|
||||
#### Observers
|
||||
|
||||
|
@ -66,7 +66,9 @@ public:
|
||||
virtual bool equivalent( const std::error_code & code, int condition ) const BOOST_NOEXCEPT;
|
||||
};
|
||||
|
||||
#if !defined(__SUNPRO_CC) // trailing __global is not supported
|
||||
inline std::error_category const & to_std_category( boost::system::error_category const & cat ) BOOST_SYMBOL_VISIBLE;
|
||||
#endif
|
||||
|
||||
struct cat_ptr_less
|
||||
{
|
||||
|
@ -355,7 +355,10 @@ constexpr error_category const & generic_category() BOOST_NOEXCEPT
|
||||
|
||||
#else // #if defined(BOOST_SYSTEM_HAS_CONSTEXPR)
|
||||
|
||||
#if !defined(__SUNPRO_CC) // trailing __global is not supported
|
||||
inline error_category const & system_category() BOOST_NOEXCEPT BOOST_SYMBOL_VISIBLE;
|
||||
inline error_category const & generic_category() BOOST_NOEXCEPT BOOST_SYMBOL_VISIBLE;
|
||||
#endif
|
||||
|
||||
inline error_category const & system_category() BOOST_NOEXCEPT
|
||||
{
|
||||
@ -363,8 +366,6 @@ inline error_category const & system_category() BOOST_NOEXCEPT
|
||||
return system_category_instance;
|
||||
}
|
||||
|
||||
inline error_category const & generic_category() BOOST_NOEXCEPT BOOST_SYMBOL_VISIBLE;
|
||||
|
||||
inline error_category const & generic_category() BOOST_NOEXCEPT
|
||||
{
|
||||
static const detail::generic_error_category generic_category_instance;
|
||||
@ -514,7 +515,7 @@ public:
|
||||
|
||||
BOOST_SYSTEM_CONSTEXPR explicit operator bool() const BOOST_NOEXCEPT // true if error
|
||||
{
|
||||
return val_ != 0;
|
||||
return failed_;
|
||||
}
|
||||
|
||||
#else
|
||||
@ -524,12 +525,12 @@ public:
|
||||
|
||||
BOOST_SYSTEM_CONSTEXPR operator unspecified_bool_type() const BOOST_NOEXCEPT // true if error
|
||||
{
|
||||
return val_ != 0? unspecified_bool_true: 0;
|
||||
return failed_? unspecified_bool_true: 0;
|
||||
}
|
||||
|
||||
BOOST_SYSTEM_CONSTEXPR bool operator!() const BOOST_NOEXCEPT // true if no error
|
||||
{
|
||||
return val_ == 0;
|
||||
return !failed_;
|
||||
}
|
||||
|
||||
#endif
|
||||
@ -655,7 +656,7 @@ public:
|
||||
|
||||
BOOST_SYSTEM_CONSTEXPR explicit operator bool() const BOOST_NOEXCEPT // true if error
|
||||
{
|
||||
return val_ != 0;
|
||||
return failed_;
|
||||
}
|
||||
|
||||
#else
|
||||
@ -665,12 +666,12 @@ public:
|
||||
|
||||
BOOST_SYSTEM_CONSTEXPR operator unspecified_bool_type() const BOOST_NOEXCEPT // true if error
|
||||
{
|
||||
return val_ != 0? unspecified_bool_true: 0;
|
||||
return failed_? unspecified_bool_true: 0;
|
||||
}
|
||||
|
||||
BOOST_SYSTEM_CONSTEXPR bool operator!() const BOOST_NOEXCEPT // true if no error
|
||||
{
|
||||
return val_ == 0;
|
||||
return !failed_;
|
||||
}
|
||||
|
||||
#endif
|
||||
@ -783,11 +784,11 @@ inline std::size_t hash_value( error_code const & ec )
|
||||
{
|
||||
error_category const & cat = ec.category();
|
||||
|
||||
boost::ulong_long_type id = cat.id_;
|
||||
boost::ulong_long_type id_ = cat.id_;
|
||||
|
||||
if( id == 0 )
|
||||
if( id_ == 0 )
|
||||
{
|
||||
id = reinterpret_cast<boost::uintptr_t>( &cat );
|
||||
id_ = reinterpret_cast<boost::uintptr_t>( &cat );
|
||||
}
|
||||
|
||||
boost::ulong_long_type hv = ( boost::ulong_long_type( 0xCBF29CE4 ) << 32 ) + 0x84222325;
|
||||
@ -795,7 +796,7 @@ inline std::size_t hash_value( error_code const & ec )
|
||||
|
||||
// id
|
||||
|
||||
hv ^= id;
|
||||
hv ^= id_;
|
||||
hv *= prime;
|
||||
|
||||
// value
|
||||
|
71
test/CMakeLists.txt
Normal file
71
test/CMakeLists.txt
Normal file
@ -0,0 +1,71 @@
|
||||
# Copyright 2018-2020 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
|
||||
|
||||
include(BoostTest OPTIONAL RESULT_VARIABLE HAVE_BOOST_TEST)
|
||||
|
||||
if(NOT HAVE_BOOST_TEST)
|
||||
return()
|
||||
endif()
|
||||
|
||||
macro(system_run s1)
|
||||
|
||||
string(MAKE_C_IDENTIFIER ${s1} n1)
|
||||
|
||||
boost_test(SOURCES ${s1} ${ARGN})
|
||||
boost_test(SOURCES ${s1} ${ARGN} COMPILE_DEFINITIONS BOOST_NO_ANSI_APIS NAME ${n1}_no_ansi)
|
||||
boost_test(SOURCES ${s1} ${ARGN} COMPILE_DEFINITIONS BOOST_SYSTEM_USE_UTF8 NAME ${n1}_utf8)
|
||||
|
||||
endmacro()
|
||||
|
||||
macro(lib name macro)
|
||||
|
||||
add_library(${name} EXCLUDE_FROM_ALL ${ARGN})
|
||||
target_compile_definitions(${name} PRIVATE $<$<BOOL:BUILD_SHARED_LIBS>:${macro}=1>)
|
||||
target_link_libraries(${name} PRIVATE Boost::system Boost::config)
|
||||
|
||||
endmacro()
|
||||
|
||||
set(BOOST_TEST_LINK_LIBRARIES Boost::system Boost::core Boost::static_assert)
|
||||
|
||||
boost_test(SOURCES quick.cpp)
|
||||
|
||||
system_run(error_code_test.cpp)
|
||||
system_run(error_code_user_test.cpp)
|
||||
system_run(system_error_test.cpp)
|
||||
|
||||
lib(boost_system_throw_test THROW_DYN_LINK throw_test.cpp)
|
||||
boost_test(SOURCES dynamic_link_test.cpp LINK_LIBRARIES boost_system_throw_test)
|
||||
|
||||
system_run(initialization_test.cpp)
|
||||
system_run(header_only_test.cpp)
|
||||
|
||||
boost_test(SOURCES config_test.cpp)
|
||||
|
||||
system_run(std_interop_test.cpp)
|
||||
system_run(std_mismatch_test.cpp)
|
||||
|
||||
lib(boost_system_single_instance_lib1 SINGLE_INSTANCE_DYN_LINK single_instance_1.cpp)
|
||||
lib(boost_system_single_instance_lib2 SINGLE_INSTANCE_DYN_LINK single_instance_2.cpp)
|
||||
|
||||
system_run(single_instance_test.cpp single_instance_1.cpp single_instance_2.cpp)
|
||||
boost_test(SOURCES single_instance_test.cpp NAME single_instance_test_lib LINK_LIBRARIES boost_system_single_instance_lib1 boost_system_single_instance_lib2)
|
||||
|
||||
system_run(before_main_test.cpp)
|
||||
system_run(constexpr_test.cpp)
|
||||
system_run(win32_hresult_test.cpp)
|
||||
|
||||
system_run(error_category_test.cpp)
|
||||
system_run(generic_category_test.cpp)
|
||||
system_run(system_category_test.cpp)
|
||||
system_run(after_main_test.cpp)
|
||||
system_run(failed_test.cpp)
|
||||
system_run(failed_constexpr_test.cpp)
|
||||
|
||||
boost_test(SOURCES warnings_test.cpp COMPILE_OPTIONS -Wall -Werror)
|
||||
|
||||
lib(boost_system_std_single_instance_lib1 STD_SINGLE_INSTANCE_DYN_LINK std_single_instance_1.cpp)
|
||||
lib(boost_system_std_single_instance_lib2 STD_SINGLE_INSTANCE_DYN_LINK std_single_instance_2.cpp)
|
||||
|
||||
system_run(std_single_instance_test.cpp std_single_instance_1.cpp std_single_instance_2.cpp)
|
||||
boost_test(SOURCES std_single_instance_test.cpp NAME std_single_instance_test_lib LINK_LIBRARIES boost_system_std_single_instance_lib1 boost_system_std_single_instance_lib2)
|
18
test/cmake_install_test/CMakeLists.txt
Normal file
18
test/cmake_install_test/CMakeLists.txt
Normal file
@ -0,0 +1,18 @@
|
||||
# Copyright 2018, 2019 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
|
||||
|
||||
cmake_minimum_required(VERSION 3.5...3.16)
|
||||
|
||||
project(cmake_install_test LANGUAGES CXX)
|
||||
|
||||
find_package(boost_system REQUIRED)
|
||||
find_package(boost_core REQUIRED)
|
||||
|
||||
add_executable(quick ../quick.cpp)
|
||||
target_link_libraries(quick Boost::system Boost::core)
|
||||
|
||||
enable_testing()
|
||||
add_test(quick quick)
|
||||
|
||||
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -C $<CONFIG>)
|
@ -2,7 +2,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
|
||||
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
cmake_minimum_required(VERSION 3.5...3.16)
|
||||
|
||||
project(cmake_subdir_test LANGUAGES CXX)
|
||||
|
||||
|
@ -123,13 +123,13 @@ template<class Ec> void test()
|
||||
|
||||
{
|
||||
Ec ec( 0, http_category() );
|
||||
BOOST_TEST( ec.failed() );
|
||||
TEST_FAILED( ec );
|
||||
|
||||
ec.assign( 200, http_category() );
|
||||
BOOST_TEST( !ec.failed() );
|
||||
TEST_NOT_FAILED( ec );
|
||||
|
||||
ec = Ec( 404, http_category() );
|
||||
BOOST_TEST( ec.failed() );
|
||||
TEST_FAILED( ec );
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user