mirror of
https://github.com/boostorg/system.git
synced 2025-07-29 20:17:13 +02:00
Compare commits
26 Commits
boost-1.70
...
boost-1.72
Author | SHA1 | Date | |
---|---|---|---|
455946faac | |||
08370c9158 | |||
c556aba559 | |||
ecc4ddd87c | |||
f67827eee3 | |||
c08b8a94ea | |||
835e5de228 | |||
dc2ad73e30 | |||
32a6c13533 | |||
bfbc5ec42f | |||
9deadda4b4 | |||
3b6315e4a1 | |||
1d845408dd | |||
e08e4253d0 | |||
afc51937be | |||
907c867cd1 | |||
9f225112f1 | |||
48b8a6c41c | |||
9b8cb7f1f6 | |||
90b2356015 | |||
1c36a72b79 | |||
7947d0ed0d | |||
72d3e96c73 | |||
ca882f286c | |||
df78f08bd2 | |||
f878f41fe7 |
35
.travis.yml
35
.travis.yml
@ -6,6 +6,8 @@ language: cpp
|
||||
|
||||
sudo: false
|
||||
|
||||
dist: trusty
|
||||
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
@ -115,6 +117,16 @@ matrix:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
|
||||
- os: linux
|
||||
compiler: g++-9
|
||||
env: TOOLSET=gcc COMPILER=g++-9 CXXSTD=03,11,14,17,2a
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- g++-9
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
|
||||
- os: linux
|
||||
compiler: g++-8
|
||||
env: UBSAN=1 TOOLSET=gcc COMPILER=g++-8 CXXSTD=03,11,14,17 UBSAN_OPTIONS=print_stacktrace=1 LINKFLAGS=-fuse-ld=gold
|
||||
@ -306,18 +318,6 @@ matrix:
|
||||
- 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++-7
|
||||
env: TOOLSET=clang COMPILER=clang++-7 CXXSTD=03,11,14,17,2a
|
||||
@ -329,6 +329,17 @@ matrix:
|
||||
- ubuntu-toolchain-r-test
|
||||
- llvm-toolchain-trusty-7
|
||||
|
||||
- os: linux
|
||||
compiler: clang++-8
|
||||
env: TOOLSET=clang COMPILER=clang++-8 CXXSTD=03,11,14,17,2a
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- clang-8
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- llvm-toolchain-trusty-8
|
||||
|
||||
- os: linux
|
||||
compiler: clang++-6.0
|
||||
env: UBSAN=1 TOOLSET=clang COMPILER=clang++-6.0 CXXSTD=03,11,14,1z UBSAN_OPTIONS=print_stacktrace=1
|
||||
|
18
appveyor.yml
18
appveyor.yml
@ -1,4 +1,4 @@
|
||||
# Copyright 2016-2018 Peter Dimov
|
||||
# Copyright 2016-2019 Peter Dimov
|
||||
# Distributed under the Boost Software License, Version 1.0.
|
||||
# (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt)
|
||||
|
||||
@ -14,28 +14,28 @@ branches:
|
||||
|
||||
environment:
|
||||
matrix:
|
||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
|
||||
TOOLSET: msvc-9.0,msvc-10.0,msvc-11.0,msvc-12.0
|
||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
|
||||
TOOLSET: msvc-14.0
|
||||
TOOLSET: msvc-9.0,msvc-10.0,msvc-11.0
|
||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
|
||||
TOOLSET: msvc-12.0,msvc-14.0
|
||||
ADDRMD: 32,64
|
||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
|
||||
TOOLSET: msvc-14.1
|
||||
TOOLSET: msvc-14.1,clang-win
|
||||
CXXSTD: 14,17
|
||||
ADDRMD: 32,64
|
||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
|
||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
|
||||
ADDPATH: C:\cygwin\bin;
|
||||
TOOLSET: gcc
|
||||
CXXSTD: 03,11,14,1z
|
||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
|
||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
|
||||
ADDPATH: C:\cygwin64\bin;
|
||||
TOOLSET: gcc
|
||||
CXXSTD: 03,11,14,1z
|
||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
|
||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
|
||||
ADDPATH: C:\mingw\bin;
|
||||
TOOLSET: gcc
|
||||
CXXSTD: 03,11,14,1z
|
||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
|
||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
|
||||
ADDPATH: C:\mingw-w64\x86_64-6.3.0-posix-seh-rt_v5-rev1\mingw64\bin;
|
||||
TOOLSET: gcc
|
||||
CXXSTD: 03,11,14,1z
|
||||
|
@ -22,6 +22,11 @@
|
||||
# undef BOOST_SYSTEM_HAS_SYSTEM_ERROR
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_NO_CXX11_HDR_MUTEX)
|
||||
// Required for thread-safe map manipulation
|
||||
# undef BOOST_SYSTEM_HAS_SYSTEM_ERROR
|
||||
#endif
|
||||
|
||||
// BOOST_SYSTEM_NOEXCEPT
|
||||
// Retained for backward compatibility
|
||||
|
||||
@ -43,15 +48,4 @@
|
||||
# define BOOST_SYSTEM_CONSTEXPR
|
||||
#endif
|
||||
|
||||
// BOOST_SYSTEM_REQUIRE_CONST_INIT
|
||||
|
||||
#define BOOST_SYSTEM_REQUIRE_CONST_INIT
|
||||
|
||||
#if defined(__has_cpp_attribute)
|
||||
#if __has_cpp_attribute(clang::require_constant_initialization)
|
||||
# undef BOOST_SYSTEM_REQUIRE_CONST_INIT
|
||||
# define BOOST_SYSTEM_REQUIRE_CONST_INIT [[clang::require_constant_initialization]]
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif // BOOST_SYSTEM_DETAIL_CONFIG_HPP_INCLUDED
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include <system_error>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
|
||||
//
|
||||
|
||||
@ -30,8 +31,20 @@ private:
|
||||
|
||||
public:
|
||||
|
||||
explicit std_category( boost::system::error_category const * pc ): pc_( pc )
|
||||
explicit std_category( boost::system::error_category const * pc, unsigned id ): pc_( pc )
|
||||
{
|
||||
if( id != 0 )
|
||||
{
|
||||
#if defined(_MSC_VER) && defined(_CPPLIB_VER) && _MSC_VER >= 1900 && _MSC_VER < 2000
|
||||
|
||||
// Poking into the protected _Addr member of std::error_category
|
||||
// is not a particularly good programming practice, but what can
|
||||
// you do
|
||||
|
||||
_Addr = id;
|
||||
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
virtual const char * name() const BOOST_NOEXCEPT
|
||||
@ -53,24 +66,50 @@ public:
|
||||
virtual bool equivalent( const std::error_code & code, int condition ) const BOOST_NOEXCEPT;
|
||||
};
|
||||
|
||||
inline std::error_category const & to_std_category( boost::system::error_category const & cat ) BOOST_SYMBOL_VISIBLE;
|
||||
|
||||
struct cat_ptr_less
|
||||
{
|
||||
bool operator()( boost::system::error_category const * p1, boost::system::error_category const * p2 ) const BOOST_NOEXCEPT
|
||||
{
|
||||
return *p1 < *p2;
|
||||
}
|
||||
};
|
||||
|
||||
inline std::error_category const & to_std_category( boost::system::error_category const & cat )
|
||||
{
|
||||
typedef std::map< boost::system::error_category const *, std::unique_ptr<std_category> > map_type;
|
||||
|
||||
static map_type map_;
|
||||
|
||||
map_type::iterator i = map_.find( &cat );
|
||||
|
||||
if( i == map_.end() )
|
||||
if( cat == boost::system::system_category() )
|
||||
{
|
||||
std::unique_ptr<std_category> p( new std_category( &cat ) );
|
||||
|
||||
std::pair<map_type::iterator, bool> r = map_.insert( map_type::value_type( &cat, std::move( p ) ) );
|
||||
|
||||
i = r.first;
|
||||
static const std_category system_instance( &cat, 0x1F4D7 );
|
||||
return system_instance;
|
||||
}
|
||||
else if( cat == boost::system::generic_category() )
|
||||
{
|
||||
static const std_category generic_instance( &cat, 0x1F4D3 );
|
||||
return generic_instance;
|
||||
}
|
||||
else
|
||||
{
|
||||
typedef std::map< boost::system::error_category const *, std::unique_ptr<std_category>, cat_ptr_less > map_type;
|
||||
|
||||
return *i->second;
|
||||
static map_type map_;
|
||||
static std::mutex map_mx_;
|
||||
|
||||
std::lock_guard<std::mutex> guard( map_mx_ );
|
||||
|
||||
map_type::iterator i = map_.find( &cat );
|
||||
|
||||
if( i == map_.end() )
|
||||
{
|
||||
std::unique_ptr<std_category> p( new std_category( &cat, 0 ) );
|
||||
|
||||
std::pair<map_type::iterator, bool> r = map_.insert( map_type::value_type( &cat, std::move( p ) ) );
|
||||
|
||||
i = r.first;
|
||||
}
|
||||
|
||||
return *i->second;
|
||||
}
|
||||
}
|
||||
|
||||
inline bool std_category::equivalent( int code, const std::error_condition & condition ) const BOOST_NOEXCEPT
|
||||
|
@ -126,6 +126,7 @@ inline char const * system_category_message_win32( int ev, char * buffer, std::s
|
||||
{
|
||||
r = boost::winapi::WideCharToMultiByte( code_page, 0, lpMsgBuf, -1, buffer, static_cast<int>( len ), NULL, NULL );
|
||||
boost::winapi::LocalFree( lpMsgBuf );
|
||||
if ( r != 0 ) --r; // exclude null terminator
|
||||
}
|
||||
}
|
||||
|
||||
@ -134,8 +135,6 @@ inline char const * system_category_message_win32( int ev, char * buffer, std::s
|
||||
return unknown_message_win32( ev, buffer, len );
|
||||
}
|
||||
|
||||
--r; // exclude null terminator
|
||||
|
||||
while( r > 0 && ( buffer[ r-1 ] == '\n' || buffer[ r-1 ] == '\r' ) )
|
||||
{
|
||||
buffer[ --r ] = 0;
|
||||
@ -265,6 +264,7 @@ inline error_condition system_category_default_error_condition_win32( int ev ) B
|
||||
case ERROR_CANTOPEN_: return make_error_condition( io_error );
|
||||
case ERROR_CANTREAD_: return make_error_condition( io_error );
|
||||
case ERROR_CANTWRITE_: return make_error_condition( io_error );
|
||||
case ERROR_CONNECTION_ABORTED_: return make_error_condition( connection_aborted );
|
||||
case ERROR_CURRENT_DIRECTORY_: return make_error_condition( permission_denied );
|
||||
case ERROR_DEV_NOT_EXIST_: return make_error_condition( no_such_device );
|
||||
case ERROR_DEVICE_IN_USE_: return make_error_condition( device_or_resource_busy );
|
||||
|
@ -329,14 +329,17 @@ public:
|
||||
namespace detail
|
||||
{
|
||||
|
||||
template<class T> struct cat_holder
|
||||
template<class T> struct BOOST_SYMBOL_VISIBLE cat_holder
|
||||
{
|
||||
BOOST_SYSTEM_REQUIRE_CONST_INIT static constexpr system_error_category system_category_instance{};
|
||||
BOOST_SYSTEM_REQUIRE_CONST_INIT static constexpr generic_error_category generic_category_instance{};
|
||||
static constexpr system_error_category system_category_instance{};
|
||||
static constexpr generic_error_category generic_category_instance{};
|
||||
};
|
||||
|
||||
template<class T> BOOST_SYSTEM_REQUIRE_CONST_INIT constexpr system_error_category cat_holder<T>::system_category_instance;
|
||||
template<class T> BOOST_SYSTEM_REQUIRE_CONST_INIT constexpr generic_error_category cat_holder<T>::generic_category_instance;
|
||||
// Before C++17 it was mandatory to redeclare all static constexpr
|
||||
#if defined(BOOST_NO_CXX17_INLINE_VARIABLES)
|
||||
template<class T> constexpr system_error_category cat_holder<T>::system_category_instance;
|
||||
template<class T> constexpr generic_error_category cat_holder<T>::generic_category_instance;
|
||||
#endif
|
||||
|
||||
} // namespace detail
|
||||
|
||||
@ -352,12 +355,16 @@ constexpr error_category const & generic_category() BOOST_NOEXCEPT
|
||||
|
||||
#else // #if defined(BOOST_SYSTEM_HAS_CONSTEXPR)
|
||||
|
||||
inline error_category const & system_category() BOOST_NOEXCEPT BOOST_SYMBOL_VISIBLE;
|
||||
|
||||
inline error_category const & system_category() BOOST_NOEXCEPT
|
||||
{
|
||||
static const detail::system_error_category system_category_instance;
|
||||
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;
|
||||
@ -780,7 +787,7 @@ inline std::size_t hash_value( error_code const & ec )
|
||||
|
||||
if( id == 0 )
|
||||
{
|
||||
id = reinterpret_cast<boost::ulong_long_type>( &cat );
|
||||
id = reinterpret_cast<boost::uintptr_t>( &cat );
|
||||
}
|
||||
|
||||
boost::ulong_long_type hv = ( boost::ulong_long_type( 0xCBF29CE4 ) << 32 ) + 0x84222325;
|
||||
|
@ -10,11 +10,6 @@
|
||||
|
||||
import testing ;
|
||||
|
||||
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 ;
|
||||
|
||||
rule system-run ( sources + )
|
||||
{
|
||||
local result ;
|
||||
@ -32,6 +27,8 @@ system-run error_code_test.cpp ;
|
||||
system-run error_code_user_test.cpp ;
|
||||
system-run system_error_test.cpp ;
|
||||
|
||||
lib throw_test : throw_test.cpp : <link>shared:<define>THROW_DYN_LINK=1 ;
|
||||
|
||||
run dynamic_link_test.cpp throw_test : : : <link>shared : throw_test_shared ;
|
||||
|
||||
system-run initialization_test.cpp ;
|
||||
@ -42,6 +39,9 @@ run config_test.cpp : : : <test-info>always_show_run_output ;
|
||||
system-run std_interop_test.cpp ;
|
||||
system-run std_mismatch_test.cpp ;
|
||||
|
||||
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 ;
|
||||
|
||||
system-run single_instance_test.cpp single_instance_1.cpp single_instance_2.cpp ;
|
||||
run single_instance_test.cpp single_instance_lib1 single_instance_lib2 : : : <link>static : single_instance_lib_static ;
|
||||
run single_instance_test.cpp single_instance_lib1 single_instance_lib2 : : : <link>shared : single_instance_lib_shared ;
|
||||
@ -62,3 +62,10 @@ system-run failed_constexpr_test.cpp ;
|
||||
run quick.cpp ;
|
||||
|
||||
run warnings_test.cpp : : : <warnings>all <warnings-as-errors>on <toolset>gcc:<cxxflags>-Wnon-virtual-dtor <toolset>clang:<cxxflags>-Wnon-virtual-dtor ;
|
||||
|
||||
lib std_single_instance_lib1 : std_single_instance_1.cpp : <link>shared:<define>STD_SINGLE_INSTANCE_DYN_LINK ;
|
||||
lib std_single_instance_lib2 : std_single_instance_2.cpp : <link>shared:<define>STD_SINGLE_INSTANCE_DYN_LINK ;
|
||||
|
||||
system-run std_single_instance_test.cpp std_single_instance_1.cpp std_single_instance_2.cpp ;
|
||||
run std_single_instance_test.cpp std_single_instance_lib1 std_single_instance_lib2 : : : <link>static : std_single_instance_lib_static ;
|
||||
run std_single_instance_test.cpp std_single_instance_lib1 std_single_instance_lib2 : : : <link>shared <define>STD_SINGLE_INSTANCE_SHARED : std_single_instance_lib_shared ;
|
||||
|
@ -197,7 +197,8 @@ int main( int, char ** )
|
||||
#if defined(BOOST_WINDOWS_API)
|
||||
// Borland appends newline, so just check text
|
||||
BOOST_TEST( ec.message().substr(0,13) == "Unknown error" );
|
||||
BOOST_TEST( ec_0_system.message().substr(0,36) == "The operation completed successfully" );
|
||||
// Fails when the language isn't US English
|
||||
// BOOST_TEST( ec_0_system.message().substr(0,36) == "The operation completed successfully" );
|
||||
#elif defined(linux) || defined(__linux) || defined(__linux__)
|
||||
// Linux appends value to message as unsigned, so it varies with # of bits
|
||||
BOOST_TEST( ec.message().substr(0,13) == "Unknown error" );
|
||||
|
40
test/std_single_instance_1.cpp
Normal file
40
test/std_single_instance_1.cpp
Normal file
@ -0,0 +1,40 @@
|
||||
|
||||
// Copyright 2019 Peter Dimov.
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#if defined(STD_SINGLE_INSTANCE_DYN_LINK)
|
||||
# define EXPORT BOOST_SYMBOL_EXPORT
|
||||
#else
|
||||
# define EXPORT
|
||||
#endif
|
||||
|
||||
#include <boost/system/error_code.hpp>
|
||||
|
||||
#if defined(BOOST_SYSTEM_HAS_SYSTEM_ERROR)
|
||||
|
||||
#include <system_error>
|
||||
|
||||
namespace lib1
|
||||
{
|
||||
|
||||
EXPORT std::error_code get_system_code()
|
||||
{
|
||||
return boost::system::error_code( 0, boost::system::system_category() );
|
||||
}
|
||||
|
||||
EXPORT std::error_code get_generic_code()
|
||||
{
|
||||
return boost::system::error_code( 0, boost::system::generic_category() );
|
||||
}
|
||||
|
||||
} // namespace lib1
|
||||
|
||||
#else
|
||||
|
||||
EXPORT void lib1_f()
|
||||
{
|
||||
}
|
||||
|
||||
#endif
|
40
test/std_single_instance_2.cpp
Normal file
40
test/std_single_instance_2.cpp
Normal file
@ -0,0 +1,40 @@
|
||||
|
||||
// Copyright 2019 Peter Dimov.
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#if defined(STD_SINGLE_INSTANCE_DYN_LINK)
|
||||
# define EXPORT BOOST_SYMBOL_EXPORT
|
||||
#else
|
||||
# define EXPORT
|
||||
#endif
|
||||
|
||||
#include <boost/system/error_code.hpp>
|
||||
|
||||
#if defined(BOOST_SYSTEM_HAS_SYSTEM_ERROR)
|
||||
|
||||
#include <system_error>
|
||||
|
||||
namespace lib2
|
||||
{
|
||||
|
||||
EXPORT std::error_code get_system_code()
|
||||
{
|
||||
return boost::system::error_code( 0, boost::system::system_category() );
|
||||
}
|
||||
|
||||
EXPORT std::error_code get_generic_code()
|
||||
{
|
||||
return boost::system::error_code( 0, boost::system::generic_category() );
|
||||
}
|
||||
|
||||
} // namespace lib2
|
||||
|
||||
#else
|
||||
|
||||
EXPORT void lib2_f()
|
||||
{
|
||||
}
|
||||
|
||||
#endif
|
76
test/std_single_instance_test.cpp
Normal file
76
test/std_single_instance_test.cpp
Normal file
@ -0,0 +1,76 @@
|
||||
|
||||
// Copyright 2019 Peter Dimov.
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
|
||||
#include <boost/system/error_code.hpp>
|
||||
#include <boost/config/pragma_message.hpp>
|
||||
#include <boost/config/helper_macros.hpp>
|
||||
|
||||
#if !defined(BOOST_SYSTEM_HAS_SYSTEM_ERROR)
|
||||
|
||||
BOOST_PRAGMA_MESSAGE( "BOOST_SYSTEM_HAS_SYSTEM_ERROR not defined, test will be skipped" )
|
||||
int main() {}
|
||||
|
||||
#elif defined(STD_SINGLE_INSTANCE_SHARED) && defined(__CYGWIN__)
|
||||
|
||||
BOOST_PRAGMA_MESSAGE( "Skipping Windows/DLL test, __CYGWIN__" )
|
||||
int main() {}
|
||||
|
||||
#elif defined(STD_SINGLE_INSTANCE_SHARED) && defined(_WIN32) && !defined(_MSC_VER)
|
||||
|
||||
BOOST_PRAGMA_MESSAGE( "Skipping Windows/DLL test, no _MSC_VER" )
|
||||
int main() {}
|
||||
|
||||
#elif defined(STD_SINGLE_INSTANCE_SHARED) && defined(_WIN32) && !defined(_CPPLIB_VER)
|
||||
|
||||
BOOST_PRAGMA_MESSAGE( "Skipping Windows/DLL test, no _CPPLIB_VER" )
|
||||
int main() {}
|
||||
|
||||
#elif defined(STD_SINGLE_INSTANCE_SHARED) && defined(_WIN32) && (_MSC_VER < 1900 || _MSC_VER >= 2000)
|
||||
|
||||
BOOST_PRAGMA_MESSAGE( "Skipping Windows/DLL test, _MSC_VER is " BOOST_STRINGIZE(_MSC_VER) )
|
||||
int main() {}
|
||||
|
||||
#else
|
||||
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
#include <system_error>
|
||||
|
||||
using namespace boost::system;
|
||||
|
||||
namespace lib1
|
||||
{
|
||||
|
||||
std::error_code get_system_code();
|
||||
std::error_code get_generic_code();
|
||||
|
||||
} // namespace lib1
|
||||
|
||||
namespace lib2
|
||||
{
|
||||
|
||||
std::error_code get_system_code();
|
||||
std::error_code get_generic_code();
|
||||
|
||||
} // namespace lib2
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
std::error_code e1 = lib1::get_system_code();
|
||||
std::error_code e2 = lib2::get_system_code();
|
||||
|
||||
BOOST_TEST_EQ( e1, e2 );
|
||||
}
|
||||
|
||||
{
|
||||
std::error_code e1 = lib1::get_generic_code();
|
||||
std::error_code e2 = lib2::get_generic_code();
|
||||
|
||||
BOOST_TEST_EQ( e1, e2 );
|
||||
}
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
#endif
|
@ -18,6 +18,16 @@
|
||||
|
||||
//
|
||||
|
||||
#if defined(BOOST_WINDOWS_API) && defined(BOOST_SYSTEM_USE_UTF8)
|
||||
|
||||
#include <boost/config/pragma_message.hpp>
|
||||
|
||||
BOOST_PRAGMA_MESSAGE( "Skipping test due to BOOST_WINDOWS_API && BOOST_SYSTEM_USE_UTF8" )
|
||||
|
||||
int main() {}
|
||||
|
||||
#else
|
||||
|
||||
#if defined(BOOST_WINDOWS_API)
|
||||
|
||||
#include <windows.h>
|
||||
@ -90,7 +100,7 @@ static void test_message( sys::error_category const & cat, int ev )
|
||||
{
|
||||
BOOST_TEST_EQ( cat.message( ev ), sys_strerror( ev ) );
|
||||
|
||||
char buffer[ 2048 ]; // yes, really
|
||||
char buffer[ 4096 ]; // yes, really
|
||||
BOOST_TEST_CSTR_EQ( cat.message( ev, buffer, sizeof( buffer ) ), sys_strerror( ev ).c_str() );
|
||||
}
|
||||
|
||||
@ -100,17 +110,12 @@ int main()
|
||||
|
||||
// message
|
||||
|
||||
for( int i = -2; i < 1024; ++i )
|
||||
{
|
||||
test_message( cat, i );
|
||||
}
|
||||
|
||||
test_message( cat, 5810 );
|
||||
|
||||
for( int i = 10000; i < 11032; ++i )
|
||||
for( int i = -2; i < 16000; ++i )
|
||||
{
|
||||
test_message( cat, i );
|
||||
}
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
#endif // #if defined(BOOST_WINDOWS_API) && defined(BOOST_SYSTEM_USE_UTF8)
|
||||
|
@ -37,7 +37,7 @@ namespace
|
||||
BOOST_TEST( ex.code().category() == system_category() );
|
||||
# ifdef BOOST_WINDOWS_API
|
||||
LANGID language_id;
|
||||
# if !defined(__MINGW32__) && !defined(__CYGWIN__) && !BOOST_PLAT_WINDOWS_RUNTIME
|
||||
# if !BOOST_PLAT_WINDOWS_RUNTIME
|
||||
language_id = ::GetUserDefaultUILanguage();
|
||||
# else
|
||||
language_id = 0x0409; // Assume US English
|
||||
|
Reference in New Issue
Block a user