diff --git a/include/boost/system/cygwin_error.hpp b/include/boost/system/cygwin_error.hpp index 4f91cf3..c67d361 100644 --- a/include/boost/system/cygwin_error.hpp +++ b/include/boost/system/cygwin_error.hpp @@ -10,6 +10,13 @@ #ifndef BOOST_SYSTEM_CYGWIN_ERROR_HPP #define BOOST_SYSTEM_CYGWIN_ERROR_HPP +#include + +#if !defined(BOOST_ALLOW_DEPRECATED_HEADERS) + BOOST_PRAGMA_MESSAGE("This header is deprecated and is slated for removal." + " If you want it retained, please open an issue in github.com/boostorg/system.") +#endif + // This header is effectively empty for compiles on operating systems where // it is not applicable. diff --git a/include/boost/system/linux_error.hpp b/include/boost/system/linux_error.hpp index d02ce29..14fe57b 100644 --- a/include/boost/system/linux_error.hpp +++ b/include/boost/system/linux_error.hpp @@ -10,6 +10,13 @@ #ifndef BOOST_SYSTEM_LINUX_ERROR_HPP #define BOOST_SYSTEM_LINUX_ERROR_HPP +#include + +#if !defined(BOOST_ALLOW_DEPRECATED_HEADERS) + BOOST_PRAGMA_MESSAGE("This header is deprecated and is slated for removal." + " If you want it retained, please open an issue in github.com/boostorg/system.") +#endif + // This header is effectively empty for compiles on operating systems where // it is not applicable. diff --git a/include/boost/system/windows_error.hpp b/include/boost/system/windows_error.hpp index 983436f..cbbda87 100644 --- a/include/boost/system/windows_error.hpp +++ b/include/boost/system/windows_error.hpp @@ -10,6 +10,13 @@ #ifndef BOOST_SYSTEM_WINDOWS_ERROR_HPP #define BOOST_SYSTEM_WINDOWS_ERROR_HPP +#include + +#if !defined(BOOST_ALLOW_DEPRECATED_HEADERS) + BOOST_PRAGMA_MESSAGE("This header is deprecated and is slated for removal." + " If you want it retained, please open an issue in github.com/boostorg/system.") +#endif + // This header is effectively empty for compiles on operating systems where // it is not applicable. diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index 996813a..5ae8090 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -85,3 +85,7 @@ run generic_category_test2.cpp ; run generic_category_test3.cpp ; run system_category_test2.cpp ; run system_category_test3.cpp ; + +run windows_error_test.cpp ; +run cygwin_error_test.cpp ; +run linux_error_test.cpp ; diff --git a/test/cygwin_error_test.cpp b/test/cygwin_error_test.cpp new file mode 100644 index 0000000..db40444 --- /dev/null +++ b/test/cygwin_error_test.cpp @@ -0,0 +1,29 @@ +// Copyright 2020 Peter Dimov +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + +#include +#include + +#if !defined(__CYGWIN__) + +BOOST_PRAGMA_MESSAGE( "Skipping test, __CYGWIN__ is not defined" ) +int main() {} + +#else + +#include + +int main() +{ + namespace sys = boost::system; + + sys::error_code ec = sys::cygwin_error::no_package; + + BOOST_TEST_EQ( ec, sys::cygwin_error::no_package ); + BOOST_TEST_EQ( ec, sys::error_code( ENOPKG, sys::system_category() ) ); + + return boost::report_errors(); +} + +#endif diff --git a/test/error_code_test.cpp b/test/error_code_test.cpp index e77e8ce..1db2e61 100644 --- a/test/error_code_test.cpp +++ b/test/error_code_test.cpp @@ -11,11 +11,8 @@ #include -#include #include -#include -#include -#include +#include #include #include #include @@ -294,29 +291,7 @@ int main( int, char ** ) BOOST_TEST( ec.default_error_condition().value() == errc::permission_denied ); BOOST_TEST( ec.default_error_condition().category() == generic_category() ); -# ifdef __CYGWIN__ - - std::cout << "Cygwin tests...\n"; - ec = cygwin_error::no_package; - BOOST_TEST( ec == cygwin_error::no_package ); - BOOST_TEST( ec == error_code( ENOPKG, system_category() ) ); - BOOST_TEST( ec == error_code( cygwin_error::no_package, system_category() ) ); - BOOST_TEST( ec.default_error_condition().category() == system_category() ); - -# elif defined(linux) || defined(__linux) || defined(__linux__) - - std::cout << "Linux tests...\n"; - ec = linux_error::dot_dot_error; - BOOST_TEST( ec == linux_error::dot_dot_error ); - BOOST_TEST( ec == error_code( EDOTDOT, system_category() ) ); - BOOST_TEST( ec == error_code( linux_error::dot_dot_error, system_category() ) ); - BOOST_TEST( ec.default_error_condition().category() == system_category() ); - -# endif - #endif return ::boost::report_errors(); } - - diff --git a/test/linux_error_test.cpp b/test/linux_error_test.cpp new file mode 100644 index 0000000..3b3dd36 --- /dev/null +++ b/test/linux_error_test.cpp @@ -0,0 +1,29 @@ +// Copyright 2020 Peter Dimov +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + +#include +#include + +#if !defined(__linux__) + +BOOST_PRAGMA_MESSAGE( "Skipping test, __linux__ is not defined" ) +int main() {} + +#else + +#include + +int main() +{ + namespace sys = boost::system; + + sys::error_code ec = sys::linux_error::dot_dot_error; + + BOOST_TEST_EQ( ec, sys::linux_error::dot_dot_error ); + BOOST_TEST_EQ( ec, sys::error_code( EDOTDOT, sys::system_category() ) ); + + return boost::report_errors(); +} + +#endif diff --git a/test/windows_error_test.cpp b/test/windows_error_test.cpp new file mode 100644 index 0000000..37e4a42 --- /dev/null +++ b/test/windows_error_test.cpp @@ -0,0 +1,31 @@ +// Copyright 2020 Peter Dimov +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + +#include +#include + +#if !defined(BOOST_WINDOWS_API) + +BOOST_PRAGMA_MESSAGE( "Skipping test, BOOST_WINDOWS_API is not defined" ) +int main() {} + +#else + +#include +#include + +int main() +{ + namespace sys = boost::system; + + sys::error_code ec = sys::windows_error::invalid_function; + + BOOST_TEST_EQ( ec, sys::windows_error::invalid_function ); + BOOST_TEST_EQ( ec, sys::error_code( ERROR_INVALID_FUNCTION, sys::system_category() ) ); + BOOST_TEST( ec == make_error_condition( sys::errc::function_not_supported ) ); + + return boost::report_errors(); +} + +#endif