Ticket #6442: system_header_only_libs.patch
File system_header_only_libs.patch, 10.4 KB (added by , 11 years ago) |
---|
-
build/Jamfile.v2
12 12 : usage-requirements # pass these requirement to dependents (i.e. users) 13 13 <link>shared:<define>BOOST_SYSTEM_DYN_LINK=1 14 14 <link>static:<define>BOOST_SYSTEM_STATIC_LINK=1 15 <define>BOOST_USE_WINDOWS_H 15 16 ; 16 17 17 18 SOURCES = error_code ; … … 20 21 : $(SOURCES).cpp 21 22 : <link>shared:<define>BOOST_SYSTEM_DYN_LINK=1 22 23 <link>static:<define>BOOST_SYSTEM_STATIC_LINK=1 24 <define>BOOST_USE_WINDOWS_H 23 25 ; 24 26 25 boost-install boost_system ; 26 No newline at end of file 27 boost-install boost_system ; -
src/error_code.cpp
8 8 // See library home page at http://www.boost.org/libs/system 9 9 10 10 //----------------------------------------------------------------------------// 11 #if 1 12 #define BOOST_SYSTEM_SOURCE 13 #include <boost/system/detail/inlined/error_code.hpp> 11 14 15 #else 12 16 #include <boost/config/warning_disable.hpp> 13 17 14 18 // define BOOST_SYSTEM_SOURCE so that <boost/system/config.hpp> knows … … 39 43 40 44 namespace 41 45 { 42 #if defined(__PGI)43 using boost::system::errc::invalid_argument;44 #endif45 46 // standard error categories ---------------------------------------------// 46 47 47 48 class generic_error_category : public error_category … … 74 75 // strerror_r is preferred because it is always thread safe, 75 76 // however, we fallback to strerror in certain cases because: 76 77 // -- Windows doesn't provide strerror_r. 77 // -- HP and Sun 78 // -- HP and Sundo provide strerror_r on newer systems, but there is 78 79 // no way to tell if is available at runtime and in any case their 79 80 // versions of strerror are thread safe anyhow. 80 81 // -- Linux only sometimes provides strerror_r. 81 82 // -- Tru64 provides strerror_r only when compiled -pthread. 82 83 // -- VMS doesn't provide strerror_r, but on this platform, strerror is 83 84 // thread safe. 84 # if defined(BOOST_ WINDOWS_API) || defined(__hpux) || defined(__sun)\85 # if defined(BOOST_SYSTEM_WINDOWS_API) || defined(__hpux) || defined(__sun)\ 85 86 || (defined(__linux) && (!defined(__USE_XOPEN2K) || defined(BOOST_SYSTEM_USE_STRERROR)))\ 86 87 || (defined(__osf__) && !defined(_REENTRANT))\ 87 || (defined(__INTEGRITY))\88 88 || (defined(__vms))\ 89 89 || (defined(__QNXNTO__)) 90 90 const char * c_str = std::strerror( ev ); … … 428 428 429 429 } // namespace system 430 430 } // namespace boost 431 432 #endif 433 No newline at end of file -
test/dynamic_link_test.cpp
26 26 { 27 27 namespace system 28 28 { 29 BOOST_SYSTEM_DECLvoid throw_test();29 BOOST_SYMBOL_EXPORT void throw_test(); 30 30 } 31 31 } 32 32 … … 52 52 53 53 std::cout << " error: failed to catch boost::system::system_error\n"; 54 54 return 1; 55 } 56 No newline at end of file 55 } -
test/error_code_test.cpp
30 30 // with a boost::system using directive increases use scenario coverage. 31 31 using namespace boost::system; 32 32 33 # if defined( BOOST_ WINDOWS_API )33 # if defined( BOOST_SYSTEM_WINDOWS_API ) 34 34 # include "winerror.h" 35 35 # define BOOST_ACCESS_ERROR_MACRO ERROR_ACCESS_DENIED 36 # elif defined( BOOST_ POSIX_API )36 # elif defined( BOOST_SYSTEM_POSIX_API ) 37 37 # define BOOST_ACCESS_ERROR_MACRO EACCES 38 38 # else 39 39 # error "Only supported for POSIX and Windows" … … 154 154 ec = error_code( -1, system_category() ); 155 155 std::cout << "error_code message for -1 is \"" << ec.message() << "\"\n"; 156 156 std::cout << "error_code message for 0 is \"" << ec_0_system.message() << "\"\n"; 157 #if defined(BOOST_ WINDOWS_API)157 #if defined(BOOST_SYSTEM_WINDOWS_API) 158 158 // Borland appends newline, so just check text 159 159 BOOST_TEST( ec.message().substr(0,13) == "Unknown error" ); 160 160 BOOST_TEST( ec_0_system.message().substr(0,36) == "The operation completed successfully" ); … … 177 177 error_condition econd_ok; 178 178 std::cout << "error_condition message for -1 is \"" << econd.message() << "\"\n"; 179 179 std::cout << "error_condition message for 0 is \"" << econd_ok.message() << "\"\n"; 180 #if defined(BOOST_ WINDOWS_API)180 #if defined(BOOST_SYSTEM_WINDOWS_API) 181 181 // Borland appends newline, so just check text 182 182 BOOST_TEST( econd.message().substr(0,13) == "Unknown error" ); 183 183 BOOST_TEST( econd_ok.message().substr(0,8) == "No error" ); … … 196 196 BOOST_TEST( econd.message() != "" ); 197 197 BOOST_TEST( econd.message().substr( 0, 13) != "Unknown error" ); 198 198 199 #ifdef BOOST_ WINDOWS_API199 #ifdef BOOST_SYSTEM_WINDOWS_API 200 200 std::cout << "Windows tests...\n"; 201 201 // these tests probe the Windows errc decoder 202 202 // test the first entry in the decoder table: -
test/error_code_user_test.cpp
22 22 #include <cstdio> 23 23 #include <boost/detail/lightweight_test.hpp> 24 24 25 #ifdef BOOST_ POSIX_API25 #ifdef BOOST_SYSTEM_POSIX_API 26 26 # include <sys/stat.h> 27 27 #else 28 28 # include <windows.h> … … 37 37 boost::system::error_code my_mkdir( const std::string & path ) 38 38 { 39 39 return boost::system::error_code( 40 # ifdef BOOST_ POSIX_API40 # ifdef BOOST_SYSTEM_POSIX_API 41 41 ::mkdir( path.c_str(), S_IRWXU|S_IRWXG|S_IROTH|S_IXOTH ) == 0 ? 0 : errno, 42 42 # else 43 43 ::CreateDirectoryA( path.c_str(), 0 ) != 0 ? 0 : ::GetLastError(), … … 318 318 // check_out_of_memory(user_permission_denied, false); 319 319 // check_out_of_memory(user_out_of_memory, true); 320 320 // 321 //# ifdef BOOST_ WINDOWS_API321 //# ifdef BOOST_SYSTEM_WINDOWS_API 322 322 // check_success(boost::system::windows::success, true); 323 323 // check_success(boost::system::windows::access_denied, false); 324 324 // check_success(boost::system::windows::not_enough_memory, false); -
test/initialization_test.cpp
18 18 foo() 19 19 { 20 20 boost::system::error_code ec; 21 ec == boost::system:: posix::permission_denied;21 ec == boost::system::errc::permission_denied; 22 22 } 23 23 } f; 24 24 -
test/Jamfile.v2
9 9 10 10 project 11 11 : requirements 12 <library>/boost/system//boost_system12 #<library>/boost/system//boost_system 13 13 <toolset>msvc:<asynch-exceptions>on 14 <define>BOOST_SYSTEM_INLINED 15 #<define>BOOST_SYSTEM_NO_DEPRECATED 16 #<define>BOOST_USE_WINDOWS_H 14 17 ; 15 18 16 19 lib throw_test 17 20 : throw_test.cpp 18 21 : <link>shared:<define>BOOST_SYSTEM_DYN_LINK=1 19 22 ; 20 21 23 24 22 25 test-suite "system" 23 26 : [ run error_code_test.cpp 24 27 : # command line -
test/system_error_test.cpp
7 7 8 8 // See library home page at http://www.boost.org/libs/system 9 9 10 //----------------------------------------------------------------------------// 10 //----------------------------------------------------------------------------// 11 11 12 12 // test without deprecated features 13 #ifndef BOOST_SYSTEM_NO_DEPRECATED 13 14 #define BOOST_SYSTEM_NO_DEPRECATED 15 #endif 14 16 15 17 #include <boost/config/warning_disable.hpp> 16 18 … … 19 21 #include <iostream> 20 22 #include <string> 21 23 22 #ifdef BOOST_ WINDOWS_API24 #ifdef BOOST_SYSTEM_WINDOWS_API 23 25 #include <windows.h> 24 26 #endif 25 27 … … 38 40 std::cout << "test " << desc << "\n what() returns \"" << ex.what() << "\"\n"; 39 41 BOOST_TEST( ex.code().value() == v ); 40 42 BOOST_TEST( ex.code().category() == system_category() ); 41 # ifdef BOOST_ WINDOWS_API43 # ifdef BOOST_SYSTEM_WINDOWS_API 42 44 LANGID language_id; 43 45 # if !defined(__MINGW32__) && !defined(__CYGWIN__) 44 46 language_id = ::GetUserDefaultUILanguage(); … … 63 65 { 64 66 // all constructors, in the same order as they appear in the header: 65 67 66 system_error c1_0( error_code(0, system_category()) ); 68 system_error c1_0( error_code(0, system_category()) ); 67 69 system_error c1_1( error_code(1, system_category()) ); 68 70 system_error c1_2u( error_code(uvalue, system_category()) ); 69 71 70 system_error c2_0( error_code(0, system_category()), string("c2_0") ); 72 system_error c2_0( error_code(0, system_category()), string("c2_0") ); 71 73 system_error c2_1( error_code(1, system_category()), string("c2_1") ); 72 74 73 system_error c3_0( error_code(0, system_category()), "c3_0" ); 75 system_error c3_0( error_code(0, system_category()), "c3_0" ); 74 76 system_error c3_1( error_code(1, system_category()), "c3_1" ); 75 77 76 system_error c4_0( 0, system_category() ); 78 system_error c4_0( 0, system_category() ); 77 79 system_error c4_1( 1, system_category() ); 78 80 system_error c4_2u( uvalue, system_category() ); 79 81 80 system_error c5_0( 0, system_category(), string("c5_0") ); 82 system_error c5_0( 0, system_category(), string("c5_0") ); 81 83 system_error c5_1( 1, system_category(), string("c5_1") ); 82 84 83 system_error c6_0( 0, system_category(), "c6_0" ); 85 system_error c6_0( 0, system_category(), "c6_0" ); 84 86 system_error c6_1( 1, system_category(), "c6_1" ); 85 87 86 88 TEST( c1_0, 0, "The operation completed successfully" ); -
test/throw_test.cpp
15 15 16 16 // define BOOST_SYSTEM_SOURCE so that <boost/system/config.hpp> knows 17 17 // the library is being built (possibly exporting rather than importing code) 18 #define BOOST_SYSTEM_SOURCE19 18 20 19 #include <boost/system/system_error.hpp> 21 22 20 namespace boost 23 21 { 24 22 namespace system 25 23 { 26 BOOST_SYSTEM_DECLvoid throw_test()24 BOOST_SYMBOL_EXPORT void throw_test() 27 25 { 28 26 throw system_error(9999, system_category(), "boo boo"); 29 27 }