mirror of
https://github.com/boostorg/system.git
synced 2026-01-26 00:52:26 +01:00
System/FileSystem/Asio/Thread: ref #7278 Added noexcept to Boost.System to conform with C++11
[SVN r81808]
This commit is contained in:
@@ -22,9 +22,6 @@
|
||||
#include <cstdlib>
|
||||
#include <cassert>
|
||||
|
||||
using namespace boost::system;
|
||||
using namespace boost::system::errc;
|
||||
|
||||
#include <cstring> // for strerror/strerror_r
|
||||
|
||||
# if defined( BOOST_WINDOWS_API )
|
||||
@@ -36,19 +33,21 @@ using namespace boost::system::errc;
|
||||
# endif
|
||||
|
||||
//----------------------------------------------------------------------------//
|
||||
namespace boost
|
||||
{
|
||||
namespace system
|
||||
{
|
||||
|
||||
namespace
|
||||
{
|
||||
#if defined(__PGI)
|
||||
using boost::system::errc::invalid_argument;
|
||||
#endif
|
||||
|
||||
// standard error categories ---------------------------------------------//
|
||||
|
||||
class generic_error_category : public error_category
|
||||
{
|
||||
public:
|
||||
generic_error_category(){}
|
||||
const char * name() const;
|
||||
const char * name() const BOOST_SYSTEM_NOEXCEPT;
|
||||
std::string message( int ev ) const;
|
||||
};
|
||||
|
||||
@@ -56,20 +55,25 @@ namespace
|
||||
{
|
||||
public:
|
||||
system_error_category(){}
|
||||
const char * name() const;
|
||||
const char * name() const BOOST_SYSTEM_NOEXCEPT;
|
||||
std::string message( int ev ) const;
|
||||
error_condition default_error_condition( int ev ) const;
|
||||
error_condition default_error_condition( int ev ) const BOOST_SYSTEM_NOEXCEPT;
|
||||
};
|
||||
|
||||
// generic_error_category implementation ---------------------------------//
|
||||
|
||||
const char * generic_error_category::name() const
|
||||
const char * generic_error_category::name() const BOOST_SYSTEM_NOEXCEPT
|
||||
{
|
||||
return "generic";
|
||||
}
|
||||
|
||||
std::string generic_error_category::message( int ev ) const
|
||||
{
|
||||
using namespace boost::system::errc;
|
||||
#if defined(__PGI)
|
||||
using boost::system::errc::invalid_argument;
|
||||
#endif
|
||||
|
||||
static std::string unknown_err( "Unknown error" );
|
||||
// strerror_r is preferred because it is always thread safe,
|
||||
// however, we fallback to strerror in certain cases because:
|
||||
@@ -133,7 +137,9 @@ namespace
|
||||
}
|
||||
}
|
||||
std::string msg;
|
||||
# ifndef BOOST_NO_EXCEPTIONS
|
||||
try
|
||||
# endif
|
||||
{
|
||||
msg = ( ( result == invalid_argument ) ? "Unknown error" : bp );
|
||||
}
|
||||
@@ -154,13 +160,18 @@ namespace
|
||||
}
|
||||
// system_error_category implementation --------------------------------//
|
||||
|
||||
const char * system_error_category::name() const
|
||||
const char * system_error_category::name() const BOOST_SYSTEM_NOEXCEPT
|
||||
{
|
||||
return "system";
|
||||
}
|
||||
|
||||
error_condition system_error_category::default_error_condition( int ev ) const
|
||||
error_condition system_error_category::default_error_condition( int ev ) const BOOST_SYSTEM_NOEXCEPT
|
||||
{
|
||||
using namespace boost::system::errc;
|
||||
#if defined(__PGI)
|
||||
using boost::system::errc::invalid_argument;
|
||||
#endif
|
||||
|
||||
switch ( ev )
|
||||
{
|
||||
case 0: return make_error_condition( success );
|
||||
@@ -401,10 +412,6 @@ namespace
|
||||
|
||||
} // unnamed namespace
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace system
|
||||
{
|
||||
|
||||
# ifndef BOOST_SYSTEM_NO_DEPRECATED
|
||||
BOOST_SYSTEM_DECL error_code throws; // "throw on error" special error_code;
|
||||
@@ -414,13 +421,13 @@ namespace boost
|
||||
// address for comparison purposes
|
||||
# endif
|
||||
|
||||
BOOST_SYSTEM_DECL const error_category & system_category()
|
||||
BOOST_SYSTEM_DECL const error_category & system_category() BOOST_SYSTEM_NOEXCEPT
|
||||
{
|
||||
static const system_error_category system_category_const;
|
||||
return system_category_const;
|
||||
}
|
||||
|
||||
BOOST_SYSTEM_DECL const error_category & generic_category()
|
||||
BOOST_SYSTEM_DECL const error_category & generic_category() BOOST_SYSTEM_NOEXCEPT
|
||||
{
|
||||
static const generic_error_category generic_category_const;
|
||||
return generic_category_const;
|
||||
|
||||
Reference in New Issue
Block a user