Ticket #6442: system_header_only_libs.patch

File system_header_only_libs.patch, 10.4 KB (added by viboes, 11 years ago)

libs part

  • build/Jamfile.v2

     
    1212    : usage-requirements  # pass these requirement to dependents (i.e. users)
    1313      <link>shared:<define>BOOST_SYSTEM_DYN_LINK=1
    1414      <link>static:<define>BOOST_SYSTEM_STATIC_LINK=1
     15      <define>BOOST_USE_WINDOWS_H
    1516    ;
    1617
    1718SOURCES = error_code ;
     
    2021   : $(SOURCES).cpp
    2122   : <link>shared:<define>BOOST_SYSTEM_DYN_LINK=1
    2223     <link>static:<define>BOOST_SYSTEM_STATIC_LINK=1
     24     <define>BOOST_USE_WINDOWS_H
    2325   ;
    2426
    25 boost-install boost_system ;
    26  No newline at end of file
     27boost-install boost_system ;
  • src/error_code.cpp

     
    88//  See library home page at http://www.boost.org/libs/system
    99
    1010//----------------------------------------------------------------------------//
     11#if 1
     12#define BOOST_SYSTEM_SOURCE
     13#include <boost/system/detail/inlined/error_code.hpp>
    1114
     15#else
    1216#include <boost/config/warning_disable.hpp>
    1317
    1418// define BOOST_SYSTEM_SOURCE so that <boost/system/config.hpp> knows
     
    3943
    4044namespace
    4145{
    42 #if defined(__PGI)
    43   using boost::system::errc::invalid_argument;
    44 #endif
    4546  //  standard error categories  ---------------------------------------------//
    4647
    4748  class generic_error_category : public error_category
     
    7475  // strerror_r is preferred because it is always thread safe,
    7576  // however, we fallback to strerror in certain cases because:
    7677  //   -- Windows doesn't provide strerror_r.
    77   //   -- HP and Sun do provide strerror_r on newer systems, but there is
     78  //   -- HP and Sundo provide strerror_r on newer systems, but there is
    7879  //      no way to tell if is available at runtime and in any case their
    7980  //      versions of strerror are thread safe anyhow.
    8081  //   -- Linux only sometimes provides strerror_r.
    8182  //   -- Tru64 provides strerror_r only when compiled -pthread.
    8283  //   -- VMS doesn't provide strerror_r, but on this platform, strerror is
    8384  //      thread safe.
    84   # if defined(BOOST_WINDOWS_API) || defined(__hpux) || defined(__sun)\
     85  # if defined(BOOST_SYSTEM_WINDOWS_API) || defined(__hpux) || defined(__sun)\
    8586     || (defined(__linux) && (!defined(__USE_XOPEN2K) || defined(BOOST_SYSTEM_USE_STRERROR)))\
    8687     || (defined(__osf__) && !defined(_REENTRANT))\
    87      || (defined(__INTEGRITY))\
    8888     || (defined(__vms))\
    8989     || (defined(__QNXNTO__))
    9090      const char * c_str = std::strerror( ev );
     
    428428
    429429  } // namespace system
    430430} // namespace boost
     431
     432#endif
     433 No newline at end of file
  • test/dynamic_link_test.cpp

     
    2626{
    2727  namespace system
    2828  {
    29     BOOST_SYSTEM_DECL void throw_test();
     29  BOOST_SYMBOL_EXPORT void throw_test();
    3030  }
    3131}
    3232
     
    5252
    5353  std::cout << "  error: failed to catch boost::system::system_error\n";
    5454  return 1;
    55 }
    56  No newline at end of file
     55}
  • test/error_code_test.cpp

     
    3030//  with a boost::system using directive increases use scenario coverage.
    3131using namespace boost::system;
    3232
    33 # if defined( BOOST_WINDOWS_API )
     33# if defined( BOOST_SYSTEM_WINDOWS_API )
    3434#   include "winerror.h"
    3535#   define BOOST_ACCESS_ERROR_MACRO ERROR_ACCESS_DENIED
    36 # elif defined( BOOST_POSIX_API )
     36# elif defined( BOOST_SYSTEM_POSIX_API )
    3737#   define BOOST_ACCESS_ERROR_MACRO EACCES
    3838# else
    3939#   error "Only supported for POSIX and Windows"
     
    154154  ec = error_code( -1, system_category() );
    155155  std::cout << "error_code message for -1 is \"" << ec.message() << "\"\n";
    156156  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)
    158158  // Borland appends newline, so just check text
    159159  BOOST_TEST( ec.message().substr(0,13) == "Unknown error" );
    160160  BOOST_TEST( ec_0_system.message().substr(0,36) == "The operation completed successfully" );
     
    177177  error_condition econd_ok;
    178178  std::cout << "error_condition message for -1 is \"" << econd.message() << "\"\n";
    179179  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)
    181181  // Borland appends newline, so just check text
    182182  BOOST_TEST( econd.message().substr(0,13) == "Unknown error" );
    183183  BOOST_TEST( econd_ok.message().substr(0,8) == "No error" );
     
    196196  BOOST_TEST( econd.message() != "" );
    197197  BOOST_TEST( econd.message().substr( 0, 13) != "Unknown error" );
    198198
    199 #ifdef BOOST_WINDOWS_API
     199#ifdef BOOST_SYSTEM_WINDOWS_API
    200200  std::cout << "Windows tests...\n";
    201201  // these tests probe the Windows errc decoder
    202202  //   test the first entry in the decoder table:
  • test/error_code_user_test.cpp

     
    2222#include <cstdio>
    2323#include <boost/detail/lightweight_test.hpp>
    2424
    25 #ifdef BOOST_POSIX_API
     25#ifdef BOOST_SYSTEM_POSIX_API
    2626# include <sys/stat.h>
    2727#else
    2828# include <windows.h>
     
    3737boost::system::error_code my_mkdir( const std::string & path )
    3838{
    3939  return boost::system::error_code(
    40 #   ifdef BOOST_POSIX_API
     40#   ifdef BOOST_SYSTEM_POSIX_API
    4141      ::mkdir( path.c_str(), S_IRWXU|S_IRWXG|S_IROTH|S_IXOTH ) == 0 ? 0 : errno,
    4242#   else
    4343      ::CreateDirectoryA( path.c_str(), 0 ) != 0 ? 0 : ::GetLastError(),
     
    318318//    check_out_of_memory(user_permission_denied, false);
    319319//    check_out_of_memory(user_out_of_memory, true);
    320320//
    321 //# ifdef BOOST_WINDOWS_API
     321//# ifdef BOOST_SYSTEM_WINDOWS_API
    322322//    check_success(boost::system::windows::success, true);
    323323//    check_success(boost::system::windows::access_denied, false);
    324324//    check_success(boost::system::windows::not_enough_memory, false);
  • test/initialization_test.cpp

     
    1818  foo()
    1919  {
    2020    boost::system::error_code ec;
    21     ec == boost::system::posix::permission_denied;
     21    ec == boost::system::errc::permission_denied;
    2222  }
    2323} f;
    2424
  • test/Jamfile.v2

     
    99
    1010project
    1111    : requirements
    12       <library>/boost/system//boost_system
     12      #<library>/boost/system//boost_system
    1313      <toolset>msvc:<asynch-exceptions>on
     14      <define>BOOST_SYSTEM_INLINED
     15      #<define>BOOST_SYSTEM_NO_DEPRECATED
     16      #<define>BOOST_USE_WINDOWS_H
    1417    ;
    15    
     18
    1619   lib throw_test
    1720     : throw_test.cpp
    1821     : <link>shared:<define>BOOST_SYSTEM_DYN_LINK=1
    1922     ;
    20    
    2123
     24
    2225   test-suite "system"
    2326       : [ run error_code_test.cpp
    2427           : # command line
  • test/system_error_test.cpp

     
    77
    88//  See library home page at http://www.boost.org/libs/system
    99
    10 //----------------------------------------------------------------------------// 
     10//----------------------------------------------------------------------------//
    1111
    1212//  test without deprecated features
     13#ifndef BOOST_SYSTEM_NO_DEPRECATED
    1314#define BOOST_SYSTEM_NO_DEPRECATED
     15#endif
    1416
    1517#include <boost/config/warning_disable.hpp>
    1618
     
    1921#include <iostream>
    2022#include <string>
    2123
    22 #ifdef BOOST_WINDOWS_API
     24#ifdef BOOST_SYSTEM_WINDOWS_API
    2325#include <windows.h>
    2426#endif
    2527
     
    3840    std::cout << "test " << desc << "\n what() returns \"" << ex.what() << "\"\n";
    3941    BOOST_TEST( ex.code().value() == v );
    4042    BOOST_TEST( ex.code().category() == system_category() );
    41 # ifdef BOOST_WINDOWS_API
     43# ifdef BOOST_SYSTEM_WINDOWS_API
    4244    LANGID language_id;
    4345#   if !defined(__MINGW32__) && !defined(__CYGWIN__)
    4446      language_id = ::GetUserDefaultUILanguage();
     
    6365{
    6466  // all constructors, in the same order as they appear in the header:
    6567
    66   system_error c1_0( error_code(0, system_category()) ); 
     68  system_error c1_0( error_code(0, system_category()) );
    6769  system_error c1_1( error_code(1, system_category()) );
    6870  system_error c1_2u( error_code(uvalue, system_category()) );
    6971
    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") );
    7173  system_error c2_1( error_code(1, system_category()), string("c2_1") );
    7274
    73   system_error c3_0( error_code(0, system_category()), "c3_0" ); 
     75  system_error c3_0( error_code(0, system_category()), "c3_0" );
    7476  system_error c3_1( error_code(1, system_category()), "c3_1" );
    7577
    76   system_error c4_0( 0, system_category() ); 
     78  system_error c4_0( 0, system_category() );
    7779  system_error c4_1( 1, system_category() );
    7880  system_error c4_2u( uvalue, system_category() );
    7981
    80   system_error c5_0( 0, system_category(), string("c5_0") ); 
     82  system_error c5_0( 0, system_category(), string("c5_0") );
    8183  system_error c5_1( 1, system_category(), string("c5_1") );
    8284
    83   system_error c6_0( 0, system_category(), "c6_0" ); 
     85  system_error c6_0( 0, system_category(), "c6_0" );
    8486  system_error c6_1( 1, system_category(), "c6_1" );
    8587
    8688  TEST( c1_0, 0, "The operation completed successfully" );
  • test/throw_test.cpp

     
    1515
    1616// define BOOST_SYSTEM_SOURCE so that <boost/system/config.hpp> knows
    1717// the library is being built (possibly exporting rather than importing code)
    18 #define BOOST_SYSTEM_SOURCE
    1918
    2019#include <boost/system/system_error.hpp>
    21 
    2220namespace boost
    2321{
    2422  namespace system
    2523  {
    26     BOOST_SYSTEM_DECL void throw_test()
     24  BOOST_SYMBOL_EXPORT void throw_test()
    2725    {
    2826      throw system_error(9999, system_category(), "boo boo");
    2927    }