Ticket #7278: 7278.patch

File 7278.patch, 21.9 KB (added by viboes, 10 years ago)

Multi-lib patch

  • boost/asio/impl/error.ipp

     
    3131class netdb_category : public boost::system::error_category
    3232{
    3333public:
    34   const char* name() const
     34  const char* name() const  BOOST_SYSTEM_NOEXCEPT
    3535  {
    3636    return "asio.netdb";
    3737  }
     
    6363class addrinfo_category : public boost::system::error_category
    6464{
    6565public:
    66   const char* name() const
     66  const char* name() const BOOST_SYSTEM_NOEXCEPT
    6767  {
    6868    return "asio.addrinfo";
    6969  }
     
    9393class misc_category : public boost::system::error_category
    9494{
    9595public:
    96   const char* name() const
     96  const char* name() const BOOST_SYSTEM_NOEXCEPT
    9797  {
    9898    return "asio.misc";
    9999  }
  • boost/thread/future.hpp

     
    113113  {
    114114    inline
    115115    error_code
    116     make_error_code(future_errc e) //BOOST_NOEXCEPT
     116    make_error_code(future_errc e) BOOST_SYSTEM_NOEXCEPT
    117117    {
    118118        return error_code(underlying_cast<int>(e), boost::future_category());
    119119    }
    120120
    121121    inline
    122122    error_condition
    123     make_error_condition(future_errc e) //BOOST_NOEXCEPT
     123    make_error_condition(future_errc e) BOOST_SYSTEM_NOEXCEPT
    124124    {
    125125        return error_condition(underlying_cast<int>(e), future_category());
    126126    }
  • libs/thread/src/future.cpp

     
    1919      public boost::system::error_category
    2020    {
    2121    public:
    22         virtual const char* name() const; //BOOST_NOEXCEPT;
     22        virtual const char* name() const BOOST_SYSTEM_NOEXCEPT;
    2323        virtual std::string message(int ev) const;
    2424    };
    2525
    2626    const char*
    27     future_error_category::name() const //BOOST_NOEXCEPT
     27    future_error_category::name() const BOOST_SYSTEM_NOEXCEPT
    2828    {
    2929        return "future";
    3030    }
  • libs/filesystem/src/codecvt_error_category.cpp

     
    3535  {
    3636  public:
    3737    codecvt_error_cat(){}
    38     const char*   name() const;
     38    const char*   name() const BOOST_SYSTEM_NOEXCEPT;
    3939    std::string    message(int ev) const;
    4040  };
    4141
    42   const char* codecvt_error_cat::name() const
     42  const char* codecvt_error_cat::name() const BOOST_SYSTEM_NOEXCEPT
    4343  {
    4444    return "codecvt";
    4545  }
  • boost/system/system_error.hpp

     
    2121
    2222    class BOOST_SYMBOL_VISIBLE system_error : public std::runtime_error
    2323    // BOOST_SYMBOL_VISIBLE is needed by GCC to ensure system_error thrown from a shared
    24     // library can be caught. See svn.boost.org/trac/boost/ticket/3697 
     24    // library can be caught. See svn.boost.org/trac/boost/ticket/3697
    2525    {
    2626    public:
    2727      system_error( error_code ec )
     
    6161    {
    6262      if ( m_what.empty() )
    6363      {
     64#ifndef BOOST_NO_EXCEPTIONS
    6465        try
     66#endif
    6567        {
    6668          m_what = this->std::runtime_error::what();
    6769          if ( !m_what.empty() ) m_what += ": ";
    6870          m_what += m_error_code.message();
    6971        }
     72#ifndef BOOST_NO_EXCEPTIONS
    7073        catch (...) { return std::runtime_error::what(); }
     74#endif
    7175      }
    7276      return m_what.c_str();
    7377    }
  • boost/system/error_code.hpp

     
    2323#include <functional>
    2424
    2525// TODO: undef these macros if not already defined
    26 #include <boost/cerrno.hpp> 
     26#include <boost/cerrno.hpp>
    2727
    2828#if !defined(BOOST_POSIX_API) && !defined(BOOST_WINDOWS_API)
    2929#  error BOOST_POSIX_API or BOOST_WINDOWS_API must be defined
     
    3131
    3232#include <boost/config/abi_prefix.hpp> // must be the last #include
    3333
     34#ifndef BOOST_SYSTEM_NOEXCEPT
     35#define BOOST_SYSTEM_NOEXCEPT BOOST_NOEXCEPT
     36#endif
     37
    3438namespace boost
    3539{
    3640  namespace system
     
    184188    public:
    185189      virtual ~error_category(){}
    186190
    187       virtual const char *     name() const = 0;
     191      virtual const char *     name() const BOOST_SYSTEM_NOEXCEPT = 0;
    188192      virtual std::string      message( int ev ) const = 0;
    189       virtual error_condition  default_error_condition( int ev ) const;
    190       virtual bool             equivalent( int code,
    191                                            const error_condition & condition ) const;
    192       virtual bool             equivalent( const error_code & code,
    193                                            int condition ) const;
     193      inline virtual error_condition  default_error_condition( int ev ) const  BOOST_SYSTEM_NOEXCEPT;
     194      inline virtual bool             equivalent( int code,
     195                                           const error_condition & condition ) const  BOOST_SYSTEM_NOEXCEPT;
     196      inline virtual bool             equivalent( const error_code & code,
     197                                           int condition ) const  BOOST_SYSTEM_NOEXCEPT;
    194198
    195       bool operator==(const error_category & rhs) const { return this == &rhs; }
    196       bool operator!=(const error_category & rhs) const { return this != &rhs; }
    197       bool operator<( const error_category & rhs ) const
     199      bool operator==(const error_category & rhs) const BOOST_SYSTEM_NOEXCEPT { return this == &rhs; }
     200      bool operator!=(const error_category & rhs) const BOOST_SYSTEM_NOEXCEPT { return this != &rhs; }
     201      bool operator<( const error_category & rhs ) const BOOST_SYSTEM_NOEXCEPT
    198202      {
    199203        return std::less<const error_category*>()( this, &rhs );
    200204      }
     
    202206
    203207    //  predefined error categories  -----------------------------------------//
    204208
    205     BOOST_SYSTEM_DECL const error_category &  system_category();
    206     BOOST_SYSTEM_DECL const error_category &  generic_category();
    207 
     209# ifdef BOOST_ERROR_CODE_HEADER_ONLY
     210    inline const error_category &  system_category() BOOST_SYSTEM_NOEXCEPT;
     211    inline const error_category &  generic_category() BOOST_SYSTEM_NOEXCEPT;
     212#else
     213    BOOST_SYSTEM_DECL const error_category &  system_category() BOOST_SYSTEM_NOEXCEPT;
     214    BOOST_SYSTEM_DECL const error_category &  generic_category() BOOST_SYSTEM_NOEXCEPT;
     215#endif
    208216    //  deprecated synonyms --------------------------------------------------//
    209217
    210218# ifndef BOOST_SYSTEM_NO_DEPRECATED
     
    225233    public:
    226234
    227235      // constructors:
    228       error_condition() : m_val(0), m_cat(&generic_category()) {}
    229       error_condition( int val, const error_category & cat ) : m_val(val), m_cat(&cat) {}
     236      error_condition() BOOST_SYSTEM_NOEXCEPT : m_val(0), m_cat(&generic_category()) {}
     237      error_condition( int val, const error_category & cat ) BOOST_SYSTEM_NOEXCEPT : m_val(val), m_cat(&cat) {}
    230238
    231239      template <class ErrorConditionEnum>
    232240        error_condition(ErrorConditionEnum e,
    233           typename boost::enable_if<is_error_condition_enum<ErrorConditionEnum> >::type* = 0)
     241          typename boost::enable_if<is_error_condition_enum<ErrorConditionEnum> >::type* = 0) BOOST_SYSTEM_NOEXCEPT
    234242      {
    235243        *this = make_error_condition(e);
    236244      }
    237245
    238246      // modifiers:
    239247
    240       void assign( int val, const error_category & cat )
    241       { 
     248      void assign( int val, const error_category & cat ) BOOST_SYSTEM_NOEXCEPT
     249      {
    242250        m_val = val;
    243251        m_cat = &cat;
    244252      }
    245                                              
     253
    246254      template<typename ErrorConditionEnum>
    247255        typename boost::enable_if<is_error_condition_enum<ErrorConditionEnum>, error_condition>::type &
    248           operator=( ErrorConditionEnum val )
    249       { 
     256          operator=( ErrorConditionEnum val ) BOOST_SYSTEM_NOEXCEPT
     257      {
    250258        *this = make_error_condition(val);
    251259        return *this;
    252260      }
    253261
    254       void clear()
     262      void clear() BOOST_SYSTEM_NOEXCEPT
    255263      {
    256264        m_val = 0;
    257265        m_cat = &generic_category();
    258266      }
    259267
    260268      // observers:
    261       int                     value() const    { return m_val; }
    262       const error_category &  category() const { return *m_cat; }
     269      int                     value() const BOOST_SYSTEM_NOEXCEPT    { return m_val; }
     270      const error_category &  category() const BOOST_SYSTEM_NOEXCEPT { return *m_cat; }
    263271      std::string             message() const  { return m_cat->message(value()); }
    264272
    265273      typedef void (*unspecified_bool_type)();
    266274      static void unspecified_bool_true() {}
    267275
    268       operator unspecified_bool_type() const // true if error
    269       { 
     276      operator unspecified_bool_type() const BOOST_SYSTEM_NOEXCEPT // true if error
     277      {
    270278        return m_val == 0 ? 0 : unspecified_bool_true;
    271279      }
    272280
    273       bool operator!() const // true if no error
     281      bool operator!() const BOOST_SYSTEM_NOEXCEPT // true if no error
    274282      {
    275283        return m_val == 0;
    276284      }
     
    279287      //  the more symmetrical non-member syntax allows enum
    280288      //  conversions work for both rhs and lhs.
    281289      inline friend bool operator==( const error_condition & lhs,
    282                                      const error_condition & rhs )
     290                                     const error_condition & rhs ) BOOST_SYSTEM_NOEXCEPT
    283291      {
    284292        return lhs.m_cat == rhs.m_cat && lhs.m_val == rhs.m_val;
    285       }                 
     293      }
    286294
    287295      inline friend bool operator<( const error_condition & lhs,
    288                                     const error_condition & rhs )
     296                                    const error_condition & rhs ) BOOST_SYSTEM_NOEXCEPT
    289297        //  the more symmetrical non-member syntax allows enum
    290298        //  conversions work for both rhs and lhs.
    291299      {
     
    312320    public:
    313321
    314322      // constructors:
    315       error_code() : m_val(0), m_cat(&system_category()) {}
    316       error_code( int val, const error_category & cat ) : m_val(val), m_cat(&cat) {}
     323      error_code() BOOST_SYSTEM_NOEXCEPT : m_val(0), m_cat(&system_category()) {}
     324      error_code( int val, const error_category & cat ) BOOST_SYSTEM_NOEXCEPT : m_val(val), m_cat(&cat) {}
    317325
    318326      template <class ErrorCodeEnum>
    319327        error_code(ErrorCodeEnum e,
    320           typename boost::enable_if<is_error_code_enum<ErrorCodeEnum> >::type* = 0)
     328          typename boost::enable_if<is_error_code_enum<ErrorCodeEnum> >::type* = 0) BOOST_SYSTEM_NOEXCEPT
    321329      {
    322330        *this = make_error_code(e);
    323331      }
    324332
    325333      // modifiers:
    326       void assign( int val, const error_category & cat )
    327       { 
     334      void assign( int val, const error_category & cat ) BOOST_SYSTEM_NOEXCEPT
     335      {
    328336        m_val = val;
    329337        m_cat = &cat;
    330338      }
    331                                              
     339
    332340      template<typename ErrorCodeEnum>
    333341        typename boost::enable_if<is_error_code_enum<ErrorCodeEnum>, error_code>::type &
    334           operator=( ErrorCodeEnum val )
    335       { 
     342          operator=( ErrorCodeEnum val ) BOOST_SYSTEM_NOEXCEPT
     343      {
    336344        *this = make_error_code(val);
    337345        return *this;
    338346      }
    339347
    340       void clear()
     348      void clear() BOOST_SYSTEM_NOEXCEPT
    341349      {
    342350        m_val = 0;
    343351        m_cat = &system_category();
    344352      }
    345353
    346354      // observers:
    347       int                     value() const    { return m_val; }
    348       const error_category &  category() const { return *m_cat; }
    349       error_condition         default_error_condition() const { return m_cat->default_error_condition(value()); }
     355      int                     value() const  BOOST_SYSTEM_NOEXCEPT   { return m_val; }
     356      const error_category &  category() const BOOST_SYSTEM_NOEXCEPT { return *m_cat; }
     357      error_condition         default_error_condition() const BOOST_SYSTEM_NOEXCEPT { return m_cat->default_error_condition(value()); }
    350358      std::string             message() const  { return m_cat->message(value()); }
    351359
    352360      typedef void (*unspecified_bool_type)();
    353361      static void unspecified_bool_true() {}
    354362
    355       operator unspecified_bool_type() const  // true if error
    356       { 
     363      operator unspecified_bool_type() const  BOOST_SYSTEM_NOEXCEPT // true if error
     364      {
    357365        return m_val == 0 ? 0 : unspecified_bool_true;
    358366      }
    359367
    360       bool operator!() const  // true if no error
     368      bool operator!() const  BOOST_SYSTEM_NOEXCEPT // true if no error
    361369      {
    362370        return m_val == 0;
    363371      }
    364372
    365373      // relationals:
    366374      inline friend bool operator==( const error_code & lhs,
    367                                      const error_code & rhs )
     375                                     const error_code & rhs ) BOOST_SYSTEM_NOEXCEPT
    368376        //  the more symmetrical non-member syntax allows enum
    369377        //  conversions work for both rhs and lhs.
    370378      {
     
    372380      }
    373381
    374382      inline friend bool operator<( const error_code & lhs,
    375                                     const error_code & rhs )
     383                                    const error_code & rhs ) BOOST_SYSTEM_NOEXCEPT
    376384        //  the more symmetrical non-member syntax allows enum
    377385        //  conversions work for both rhs and lhs.
    378386      {
    379387        return lhs.m_cat < rhs.m_cat
    380388          || (lhs.m_cat == rhs.m_cat && lhs.m_val < rhs.m_val);
    381389      }
    382                  
     390
    383391      private:
    384392      int                     m_val;
    385393      const error_category *  m_cat;
     
    426434    }
    427435
    428436    inline bool operator==( const error_code & code,
    429                             const error_condition & condition )
     437                            const error_condition & condition ) BOOST_SYSTEM_NOEXCEPT
    430438    {
    431439      return code.category().equivalent( code.value(), condition )
    432440        || condition.category().equivalent( code, condition.value() );
    433441    }
    434                
     442
    435443    inline bool operator!=( const error_code & lhs,
    436                             const error_condition & rhs )
     444                            const error_condition & rhs ) BOOST_SYSTEM_NOEXCEPT
    437445    {
    438446      return !(lhs == rhs);
    439447    }
    440                
     448
    441449    inline bool operator==( const error_condition & condition,
    442                             const error_code & code )
     450                            const error_code & code ) BOOST_SYSTEM_NOEXCEPT
    443451    {
    444452      return condition.category().equivalent( code, condition.value() )
    445453        || code.category().equivalent( code.value(), condition );
    446454    }
    447                
     455
    448456    inline bool operator!=( const error_condition & lhs,
    449                             const error_code & rhs )
     457                            const error_code & rhs ) BOOST_SYSTEM_NOEXCEPT
    450458    {
    451459      return !(lhs == rhs);
    452460    }
    453                  
     461
    454462    // TODO: both of these may move elsewhere, but the LWG hasn't spoken yet.
    455463
    456464    template <class charT, class traits>
     
    482490
    483491    //  error_category default implementation  -------------------------------//
    484492
    485     inline error_condition error_category::default_error_condition( int ev ) const
    486     { 
     493    error_condition error_category::default_error_condition( int ev ) const BOOST_SYSTEM_NOEXCEPT
     494    {
    487495      return error_condition( ev, *this );
    488496    }
    489497
    490     inline bool error_category::equivalent( int code,
    491       const error_condition & condition ) const
     498    bool error_category::equivalent( int code,
     499      const error_condition & condition ) const BOOST_SYSTEM_NOEXCEPT
    492500    {
    493501      return default_error_condition( code ) == condition;
    494502    }
    495503
    496     inline bool error_category::equivalent( const error_code & code,
    497       int condition ) const
     504    bool error_category::equivalent( const error_code & code,
     505      int condition ) const BOOST_SYSTEM_NOEXCEPT
    498506    {
    499507      return *this == code.category() && code.value() == condition;
    500508    }
  • libs/system/test/error_code_user_test.cpp

     
    7575  namespace lib3
    7676  {
    7777    // lib3 has its own error_category:
    78     const boost::system::error_category & get_lib3_error_category();
     78    const boost::system::error_category & get_lib3_error_category() BOOST_SYSTEM_NOEXCEPT;
    7979    const boost::system::error_category & lib3_error_category = get_lib3_error_category();
    8080   
    8181    enum error
     
    112112    public:
    113113      lib3_error_category_imp() : boost::system::error_category() { }
    114114
    115       const char * name() const
     115      const char * name() const BOOST_SYSTEM_NOEXCEPT
    116116      {
    117117        return "lib3";
    118118      }
    119119
    120       boost::system::error_condition default_error_condition( int ev ) const
     120      boost::system::error_condition default_error_condition( int ev ) const BOOST_SYSTEM_NOEXCEPT
    121121      {
    122122        return ev == boo_boo
    123123          ? boost::system::error_condition( boost::system::errc::io_error,
     
    135135
    136136    };
    137137
    138     const boost::system::error_category & get_lib3_error_category()
     138    const boost::system::error_category & get_lib3_error_category() BOOST_SYSTEM_NOEXCEPT
    139139    {
    140140      static const lib3_error_category_imp l3ecat;
    141141      return l3ecat;
     
    156156namespace lib4
    157157{
    158158  // lib4 has its own error_category:
    159   const boost::system::error_category & get_lib4_error_category();
     159  const boost::system::error_category & get_lib4_error_category() BOOST_SYSTEM_NOEXCEPT;
    160160  const boost::system::error_category & lib4_error_category = get_lib4_error_category();
    161161 
    162162  extern const boost::system::error_code boo_boo;
     
    174174  public:
    175175    lib4_error_category_imp() : boost::system::error_category() { }
    176176
    177     const char * name() const
     177    const char * name() const BOOST_SYSTEM_NOEXCEPT
    178178    {
    179179      return "lib4";
    180180    }
    181181
    182     boost::system::error_condition default_error_condition( int ev ) const
     182    boost::system::error_condition default_error_condition( int ev ) const  BOOST_SYSTEM_NOEXCEPT
    183183    {
    184184      return ev == boo_boo.value()
    185185        ? boost::system::error_condition( boost::system::errc::io_error,
     
    195195    }
    196196  };
    197197
    198   const boost::system::error_category & get_lib4_error_category()
     198  const boost::system::error_category & get_lib4_error_category() BOOST_SYSTEM_NOEXCEPT
    199199  {
    200200    static const lib4_error_category_imp l4ecat;
    201201    return l4ecat;
  • libs/system/src/error_code.cpp

     
    2222#include <cstdlib>
    2323#include <cassert>
    2424
    25 using namespace boost::system;
    26 using namespace boost::system::errc;
    27 
    2825#include <cstring> // for strerror/strerror_r
    2926
    3027# if defined( BOOST_WINDOWS_API )
     
    3633# endif
    3734
    3835//----------------------------------------------------------------------------//
     36namespace boost
     37{
     38    namespace system
     39    {
    3940
    4041namespace
    4142{
    42 #if defined(__PGI)
    43   using boost::system::errc::invalid_argument;
    44 #endif
     43   
    4544  //  standard error categories  ---------------------------------------------//
    4645
    4746  class generic_error_category : public error_category
    4847  {
    4948  public:
    5049    generic_error_category(){}
    51     const char *   name() const;
     50    const char *   name() const BOOST_SYSTEM_NOEXCEPT;
    5251    std::string    message( int ev ) const;
    5352  };
    5453
     
    5655  {
    5756  public:
    5857    system_error_category(){}
    59     const char *        name() const;
     58    const char *        name() const BOOST_SYSTEM_NOEXCEPT;
    6059    std::string         message( int ev ) const;
    61     error_condition     default_error_condition( int ev ) const;
     60    error_condition     default_error_condition( int ev ) const BOOST_SYSTEM_NOEXCEPT;
    6261  };
    6362
    6463  //  generic_error_category implementation  ---------------------------------//
    6564
    66   const char * generic_error_category::name() const
     65  const char * generic_error_category::name() const BOOST_SYSTEM_NOEXCEPT
    6766  {
    6867    return "generic";
    6968  }
    7069
    7170  std::string generic_error_category::message( int ev ) const
    7271  {
     72    using namespace boost::system::errc;
     73#if defined(__PGI)
     74      using boost::system::errc::invalid_argument;
     75#endif
     76     
    7377    static std::string unknown_err( "Unknown error" );
    7478  // strerror_r is preferred because it is always thread safe,
    7579  // however, we fallback to strerror in certain cases because:
     
    133137        }
    134138      }
    135139      std::string msg;
     140#   ifndef BOOST_NO_EXCEPTIONS
    136141      try
     142#   endif
    137143      {
    138144        msg = ( ( result == invalid_argument ) ? "Unknown error" : bp );
    139145      }
     
    154160  }
    155161  //  system_error_category implementation  --------------------------------//
    156162
    157   const char * system_error_category::name() const
     163  const char * system_error_category::name() const BOOST_SYSTEM_NOEXCEPT
    158164  {
    159165    return "system";
    160166  }
    161167
    162   error_condition system_error_category::default_error_condition( int ev ) const
     168  error_condition system_error_category::default_error_condition( int ev ) const BOOST_SYSTEM_NOEXCEPT
    163169  {
     170    using namespace boost::system::errc;
     171#if defined(__PGI)
     172      using boost::system::errc::invalid_argument;
     173#endif
     174
    164175    switch ( ev )
    165176    {
    166177    case 0: return make_error_condition( success );
     
    401412
    402413} // unnamed namespace
    403414
    404 namespace boost
    405 {
    406   namespace system
    407   {
    408415
    409416# ifndef BOOST_SYSTEM_NO_DEPRECATED
    410417    BOOST_SYSTEM_DECL error_code throws; // "throw on error" special error_code;
     
    414421                                         //  address for comparison purposes
    415422# endif
    416423
    417     BOOST_SYSTEM_DECL const error_category & system_category()
     424    BOOST_SYSTEM_DECL const error_category & system_category() BOOST_SYSTEM_NOEXCEPT
    418425    {
    419426      static const system_error_category  system_category_const;
    420427      return system_category_const;
    421428    }
    422429
    423     BOOST_SYSTEM_DECL const error_category & generic_category()
     430    BOOST_SYSTEM_DECL const error_category & generic_category() BOOST_SYSTEM_NOEXCEPT
    424431    {
    425432      static const generic_error_category generic_category_const;
    426433      return generic_category_const;