mirror of
https://github.com/boostorg/system.git
synced 2025-07-29 12:07:13 +02:00
System: merge accumulated changes from trunk
[SVN r49292]
This commit is contained in:
@ -39,6 +39,7 @@
|
||||
<td width="100%" bgcolor="#E8F5FF">
|
||||
<a href="#Introduction">Introduction</a><br>
|
||||
<a href="#Macros">Macros</a><br>
|
||||
<a href="#Deprecated-names">Deprecated names</a><br>
|
||||
<a href="#Header-error_code">Header <boost/system/error_code.hpp></a><br>
|
||||
<a href="#Class-error_category">Class <code>error_category</code></a><br>
|
||||
<a href="#Class-error_category-synopsis">Class <code>error_category</code> synopsis</a><br>
|
||||
@ -57,6 +58,8 @@
|
||||
<a href="#Class-error_condition-constructors">Class <code>error_condition</code> constructors</a><br>
|
||||
<a href="#Class-error_condition-modifiers">Class <code>error_condition</code> modifiers</a><br>
|
||||
<a href="#Class-error_condition-observers">Class <code>error_condition</code> observers</a><br>
|
||||
<a href="#throws-object"><code>throws</code> object</a><br>
|
||||
<a href="#Semantics-of-throws">Semantics of <code>throws</code> object</a><br>
|
||||
<a href="#Non-member-functions">Non-member functions</a><br>
|
||||
<a href="#Header-system_error">Header <boost/system/system_error.hpp></a><br>
|
||||
<a href="#Class-system_error">Class <code>system_error</code></a><br>
|
||||
@ -114,6 +117,45 @@ provided, so users may ignore these macros if they prefer.</p>
|
||||
<td valign="top">Deprecated features are excluded.</td>
|
||||
</tr>
|
||||
</table>
|
||||
<h2><a name="Deprecated-names">Deprecated names</a></h2>
|
||||
<p>In the process of adding Boost.System to C++0x standard library, some of the
|
||||
names are being changed. To ease transition, Boost.System deprecates the old
|
||||
names, but continues to provide them unless macro <code>BOOST_SYSTEM_NO_DEPRECATED</code>
|
||||
is defined.</p>
|
||||
<table border="1" cellpadding="5" cellspacing="1" style="border-collapse: collapse" bordercolor="#111111">
|
||||
<tr>
|
||||
<td><b><i>Old name, now deprecated</i></b></td>
|
||||
<td><b><i>New name</i></b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>namespace posix</code></td>
|
||||
<td><code>namespace errc</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>namespace posix_error</code></td>
|
||||
<td><code>namespace errc</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>enum posix_errno</code></td>
|
||||
<td><code>enum errc_t</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>get_posix_category()</code></td>
|
||||
<td><code>get_generic_category()</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>posix_category</code></td>
|
||||
<td><code>generic_category</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>errno_ecat</code></td>
|
||||
<td><code>generic_category</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>native_ecat</code></td>
|
||||
<td><code>system_category</code></td>
|
||||
</tr>
|
||||
</table>
|
||||
<h2><a name="Header-error_code">Header <boost/system/error_code.hpp></a></h2>
|
||||
<h3><boost/system/error_code.hpp> synopsis</h3>
|
||||
<blockquote>
|
||||
@ -223,6 +265,11 @@ provided, so users may ignore these macros if they prefer.</p>
|
||||
template<> struct is_error_condition_enum<posix::posix_errno><errc::errc_t>
|
||||
{ static const bool value = true; };
|
||||
|
||||
// predefined error_code object used as "throw on error" tag
|
||||
extern error_code <a href="#throws-object">throws</a>;
|
||||
|
||||
// <a href="#Non-member-functions">non-member functions</a>
|
||||
|
||||
bool operator==( const error_code & lhs, const error_code & rhs );
|
||||
bool operator==( const error_code & code, const error_condition & condition );
|
||||
bool operator==( const error_condition & condition, const error_code & code );
|
||||
@ -279,7 +326,7 @@ types should create a single object of each such type. <i>
|
||||
virtual ~error_category();
|
||||
|
||||
virtual const char * name() const = 0;
|
||||
virtual string message( error_code::value_type ev ) const = 0;
|
||||
virtual string message( int ev ) const = 0;
|
||||
virtual error_condition default_error_condition( int ev ) const;
|
||||
virtual bool equivalent( int code, const error_condition & condition ) const;
|
||||
virtual bool equivalent( const error_code & code, int condition ) const;
|
||||
@ -305,7 +352,7 @@ this subclause.</p>
|
||||
<p><i>Returns: </i>a string naming the error category.</p>
|
||||
<p><i>Throws:</i> Nothing.</p>
|
||||
</blockquote>
|
||||
<pre>virtual string message( error_code::value_type ev ) const=0;</pre>
|
||||
<pre>virtual string message( int ev ) const=0;</pre>
|
||||
<blockquote>
|
||||
<p><i>Returns:</i> A string that describes the error denoted by
|
||||
<code>ev</code>.</p>
|
||||
@ -370,7 +417,7 @@ non-member functions</a></h3>
|
||||
<h3><a name="Class-error_category-predefined-objects">Class <code>error_category</code>
|
||||
predefined objects</a></h3>
|
||||
<p>Predefined objects <code>system_category</code>
|
||||
and <code>generic_category</code> identify operating system error codes and portable error conditions, respectively.</p>
|
||||
and <code>generic_category</code> identify system specific error codes and portable error conditions, respectively.</p>
|
||||
<h2><a name="Class-error_code">Class <code>
|
||||
error_code</code></a></h2>
|
||||
<p>The class <code>error_code</code> describes an object used to hold error code
|
||||
@ -392,7 +439,7 @@ error_code</code> synopsis</a></h3>
|
||||
error_code();
|
||||
error_code( val, const error_category & cat );
|
||||
template <class <code>ErrorCodeEnum</code>>
|
||||
error_code(<code> errorCodeEnum</code> e,
|
||||
error_code(<code> ErrorCodeEnum</code> e,
|
||||
typename enable_if<is_error_code_enum<<code>ErrorCodeEnum</code>> >::type* = 0);
|
||||
|
||||
// modifiers:
|
||||
@ -411,7 +458,7 @@ error_code</code> synopsis</a></h3>
|
||||
|
||||
private:
|
||||
int val_; // <i>exposition only</i>
|
||||
const error_category & cat_; // <i>exposition only</i>
|
||||
const error_category * cat_; // <i>exposition only</i>
|
||||
};
|
||||
}
|
||||
}</pre>
|
||||
@ -442,7 +489,7 @@ error_code</code> constructors</a></h3>
|
||||
error_code</code> modifiers</a></h3>
|
||||
<pre>void assign( int val, const error_category & cat );</pre>
|
||||
<blockquote>
|
||||
<p><i>Postconditions:</i> <code>val_ == val && cat_ == cat</code>.</p>
|
||||
<p><i>Postconditions:</i> <code>val_ == val && cat_ == &cat</code>.</p>
|
||||
<p><i>Throws:</i> Nothing.</p>
|
||||
</blockquote>
|
||||
<pre>template<typename <code>ErrorCodeEnum</code>>
|
||||
@ -463,9 +510,9 @@ error_code</code> observers</a></h3>
|
||||
<p><i>Returns:</i> <code>val_</code>.</p>
|
||||
<p><i>Throws:</i> Nothing.</p>
|
||||
</blockquote>
|
||||
<p><code>error_category category() const;</code></p>
|
||||
<p><code>const error_category & category() const;</code></p>
|
||||
<blockquote>
|
||||
<p><i>Returns:</i> <code>cat_</code>.</p>
|
||||
<p><i>Returns:</i> <code>*cat_</code>.</p>
|
||||
<p><i>Throws:</i> Nothing.</p>
|
||||
</blockquote>
|
||||
<pre>error_condition default_error_condition() const;</pre>
|
||||
@ -480,7 +527,7 @@ error_code</code> observers</a></h3>
|
||||
</blockquote>
|
||||
<p><code>operator <i>unspecified-bool-type</i>() const;</code></p>
|
||||
<blockquote>
|
||||
<p><i>Returns:</i> if <code>value() != value_type()</code>, returns a value that will evaluate
|
||||
<p><i>Returns:</i> if <code>value() != 0</code>, returns a value that will evaluate
|
||||
<code>true</code> in a boolean context; otherwise, returns a value that will
|
||||
evaluate <code>false</code> in a boolean context. The value type returned shall
|
||||
not be convertible to <code>int</code>.</p>
|
||||
@ -527,8 +574,8 @@ implementation specific. <i>--end note ]</i></p>
|
||||
operator unspecified-bool-type () const;
|
||||
|
||||
private:
|
||||
int val_; // <i>exposition only</i>
|
||||
const error_category & cat_; // <i>exposition only</i>
|
||||
int val_; // <i>exposition only</i>
|
||||
const error_category * cat_; // <i>exposition only</i>
|
||||
};
|
||||
}
|
||||
}</pre>
|
||||
@ -538,13 +585,13 @@ constructors</a></h3>
|
||||
<pre>error_condition(); </pre>
|
||||
<blockquote>
|
||||
<p><i>Effects:</i> Constructs an object of type <code>error_condition</code>.</p>
|
||||
<p><i>Postconditions:</i> <code>val_ == 0 and cat_ == generic_category</code>.</p>
|
||||
<p><i>Postconditions:</i> <code>val_ == 0 and cat_ == &generic_category</code>.</p>
|
||||
<p><i>Throws:</i> Nothing.</p>
|
||||
</blockquote>
|
||||
<pre>error_condition( value_type val, const error_category & cat );</pre>
|
||||
<pre>error_condition( int val, const error_category & cat );</pre>
|
||||
<blockquote>
|
||||
<p><i>Effects: </i>Constructs an object of type error_condition.</p>
|
||||
<p><i>Postconditions:</i> <code>val_ == val and cat_ == cat</code>.</p>
|
||||
<p><i>Postconditions:</i> <code>val_ == val and cat_ == &cat</code>.</p>
|
||||
<p><i>Throws:</i> Nothing.</p>
|
||||
</blockquote>
|
||||
<pre>template <class ErrorConditionEnum>
|
||||
@ -557,9 +604,9 @@ constructors</a></h3>
|
||||
</blockquote>
|
||||
<h3><a name="Class-error_condition-modifiers">Class <code>error_condition</code>
|
||||
modifiers</a></h3>
|
||||
<pre>void assign( value_type val, const error_category & cat ); </pre>
|
||||
<pre>void assign( int val, const error_category & cat ); </pre>
|
||||
<blockquote>
|
||||
<p><i>Postconditions:</i> <code>val_ == val and cat_ == cat</code>. </p>
|
||||
<p><i>Postconditions:</i> <code>val_ == val and cat_ == &cat</code>. </p>
|
||||
<p><i>Throws:</i> Nothing.</p>
|
||||
</blockquote>
|
||||
<pre>template<typename ErrorConditionEnum>
|
||||
@ -575,14 +622,14 @@ modifiers</a></h3>
|
||||
</blockquote>
|
||||
<h3><a name="Class-error_condition-observers">Class <code>error_condition</code>
|
||||
observers</a></h3>
|
||||
<pre>value_type value() const;</pre>
|
||||
<pre>int value() const;</pre>
|
||||
<blockquote>
|
||||
<p><i>Returns:</i> <code>val_</code>.</p>
|
||||
<p><i>Throws:</i> Nothing</p>
|
||||
</blockquote>
|
||||
<pre>const error_category & category() const;</pre>
|
||||
<blockquote>
|
||||
<p><i>Returns:</i> <code>cat_</code>.</p>
|
||||
<p><i>Returns:</i> <code>*cat_</code>.</p>
|
||||
<p>Throws: Nothing.</p>
|
||||
</blockquote>
|
||||
<pre>string message() const;</pre>
|
||||
@ -603,7 +650,37 @@ observers</a></h3>
|
||||
eliminating some sources of user error. One possible implementation choice for
|
||||
this type is pointer to member. <i>--end note</i> <i>]</i></p>
|
||||
</blockquote>
|
||||
<h2><a name="Non-member-functions">Non-member functions</a></h2>
|
||||
<h2><a name="throws-object"><code>throws</code> object</a></h2>
|
||||
<pre>extern error_code throws;</pre>
|
||||
<p>The predefined <code>error_code</code> object <code>throws</code> is supplied
|
||||
for use as a "throw on error" tag.</p>
|
||||
<h2><a name="Semantics-of-throws">Semantics of <code>throws</code></a> object</h2>
|
||||
<p>Functions that specify an argument in the form <code>error_code& ec=throws</code>,
|
||||
with appropriate namespace qualifiers, have the following error handling
|
||||
semantics:</p>
|
||||
<blockquote>
|
||||
<p><i>Postconditions:</i></p>
|
||||
<blockquote>
|
||||
<p>If <code>&ec != &throws</code> and an error occurred:</p>
|
||||
<ul>
|
||||
<li> <code>ec.value()</code> returns the implementation specific error
|
||||
number for the particular error that occurred.</li>
|
||||
<li><code>ec.category()</code> returns the <code>
|
||||
<a href="#Class-error_category">error_category</a></code> for <code>ec.value()</code>.</li>
|
||||
</ul>
|
||||
<p>if <code>&ec != &throws</code> and an error did not occur, <code>ec.clear()</code>.</p>
|
||||
</blockquote>
|
||||
<p><i>Throws:</i></p>
|
||||
<blockquote>
|
||||
<p>If an error occurs and <code>&ec == &throws</code>, throws an exception of type
|
||||
<code><a href="#Class-system_error">system_error</a></code> or of a type
|
||||
derived from <code><a href="#Class-system_error">system_error</a></code>. The
|
||||
exception's <code>code()</code> member function returns a reference to an
|
||||
<code>error_code</code> object with the behavior specified in <i>
|
||||
Postconditions</i>.</p>
|
||||
</blockquote>
|
||||
</blockquote>
|
||||
<h2><a name="Non-member-functions">Non-member functions</a></h2>
|
||||
<pre>bool operator==( const error_code & lhs, const error_code & rhs );</pre>
|
||||
<blockquote>
|
||||
<p><i>Returns:</i> <code>lhs.category() == rhs.category() && lhs.value() ==
|
||||
@ -657,7 +734,7 @@ bool operator!=( const error_condition & condition, const error_code & c
|
||||
</blockquote>
|
||||
<pre>error_condition make_error_condition( errc::errc_t e );</pre>
|
||||
<blockquote>
|
||||
<p><i>Returns:</i> <code>error_condition( e, generic_category)</code>.</p>
|
||||
<p><i>Returns:</i> <code>error_condition( static_cast<int>( e ), generic_category)</code>.</p>
|
||||
</blockquote>
|
||||
|
||||
<pre>template <class charT, class traits>
|
||||
@ -677,8 +754,7 @@ bool operator!=( const error_condition & condition, const error_code & c
|
||||
<h3><a name="Class-system_error">Class <code>
|
||||
system_error</code></a></h3>
|
||||
<p>The class <code>system_error</code> describes an exception object used to
|
||||
report error conditions that have an associated error code. Such error
|
||||
conditions typically originate from the operating system or other low-level
|
||||
report errors that have an associated <code><a href="#Class-error_code">error_code</a></code>. Such errors typically originate from operating system or other low-level
|
||||
application program interfaces.</p>
|
||||
<blockquote>
|
||||
<pre>namespace boost
|
||||
@ -691,11 +767,11 @@ application program interfaces.</p>
|
||||
system_error( error_code ec );
|
||||
system_error( error_code ec, const char * what_arg );
|
||||
system_error( error_code ec, const std::string & what_arg );
|
||||
system_error( error_code::value_type ev, const error_category & ecat,
|
||||
system_error( int ev, const error_category & ecat,
|
||||
const char * what_arg );
|
||||
system_error( error_code::value_type ev, const error_category & ecat,
|
||||
system_error( int ev, const error_category & ecat,
|
||||
const std::string & what_arg );
|
||||
system_error( error_code::value_type ev, const error_category & ecat);
|
||||
system_error( int ev, const error_category & ecat);
|
||||
|
||||
const error_code & code() const throw();
|
||||
const char * what() const throw();
|
||||
@ -721,21 +797,21 @@ application program interfaces.</p>
|
||||
<p><i>Postcondition:</i> <code>code() == ec <br>
|
||||
&& std::strcmp( this->runtime_error::what(), what_arg.c_str() ) == 0</code></p>
|
||||
</blockquote>
|
||||
<pre>system_error( error_code::value_type ev, const error_category & ecat,
|
||||
<pre>system_error( int ev, const error_category & ecat,
|
||||
const char * what_arg );</pre>
|
||||
<blockquote>
|
||||
<p><i>Effects:</i> Constructs an object of class <code>system_error</code>.</p>
|
||||
<p><i>Postcondition:</i> <code>code() == error_code( ev, ecat )<br>
|
||||
&& std::strcmp( this->runtime_error::what(), what_arg ) == 0</code></p>
|
||||
</blockquote>
|
||||
<pre>system_error( error_code::value_type ev, const error_category & ecat,
|
||||
<pre>system_error( int ev, const error_category & ecat,
|
||||
const std::string & what_arg );</pre>
|
||||
<blockquote>
|
||||
<p><i>Effects:</i> Constructs an object of class <code>system_error</code>.</p>
|
||||
<p><i>Postcondition:</i> <code>code() == error_code( ev, ecat )<br>
|
||||
&& std::strcmp( this->runtime_error::what(), what_arg.c_str() ) == 0</code></p>
|
||||
</blockquote>
|
||||
<pre>system_error( error_code::value_type ev, const error_category & ecat );</pre>
|
||||
<pre>system_error( int ev, const error_category & ecat );</pre>
|
||||
<blockquote>
|
||||
<p><i>Effects:</i> Constructs an object of class <code>system_error</code>.</p>
|
||||
<p><i>Postcondition:</i> <code>code() == error_code( ev, ecat )<br>
|
||||
@ -754,14 +830,15 @@ application program interfaces.</p>
|
||||
</blockquote>
|
||||
<hr>
|
||||
|
||||
<p><EFBFBD> Copyright Beman Dawes, 2006, 2007<br>
|
||||
Distributed under the Boost Software License, Version 1.0. See
|
||||
<a href="http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</a></p>
|
||||
|
||||
<p>Revised
|
||||
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%B %d, %Y" startspan -->June 25, 2008<!--webbot bot="Timestamp" endspan i-checksum="14296" --> </font>
|
||||
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%B %d, %Y" startspan -->October 11, 2008<!--webbot bot="Timestamp" endspan i-checksum="30976" --> </font>
|
||||
</p>
|
||||
|
||||
<p><EFBFBD> Copyright Beman Dawes, 2006, 2007, 2008</p>
|
||||
|
||||
<p>Distributed under the Boost Software License, Version 1.0. See
|
||||
<a href="http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</a></p>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
@ -224,9 +224,9 @@ namespace boost
|
||||
error_condition() : m_val(0), m_cat(&get_generic_category()) {}
|
||||
error_condition( int val, const error_category & cat ) : m_val(val), m_cat(&cat) {}
|
||||
|
||||
template <class ConditionEnum>
|
||||
error_condition(ConditionEnum e,
|
||||
typename boost::enable_if<is_error_condition_enum<ConditionEnum> >::type* = 0)
|
||||
template <class ErrorConditionEnum>
|
||||
error_condition(ErrorConditionEnum e,
|
||||
typename boost::enable_if<is_error_condition_enum<ErrorConditionEnum> >::type* = 0)
|
||||
{
|
||||
*this = make_error_condition(e);
|
||||
}
|
||||
@ -239,9 +239,9 @@ namespace boost
|
||||
m_cat = &cat;
|
||||
}
|
||||
|
||||
template<typename ConditionEnum>
|
||||
typename boost::enable_if<is_error_condition_enum<ConditionEnum>, error_condition>::type &
|
||||
operator=( ConditionEnum val )
|
||||
template<typename ErrorConditionEnum>
|
||||
typename boost::enable_if<is_error_condition_enum<ErrorConditionEnum>, error_condition>::type &
|
||||
operator=( ErrorConditionEnum val )
|
||||
{
|
||||
*this = make_error_condition(val);
|
||||
return *this;
|
||||
@ -311,9 +311,9 @@ namespace boost
|
||||
error_code() : m_val(0), m_cat(&get_system_category()) {}
|
||||
error_code( int val, const error_category & cat ) : m_val(val), m_cat(&cat) {}
|
||||
|
||||
template <class CodeEnum>
|
||||
error_code(CodeEnum e,
|
||||
typename boost::enable_if<is_error_code_enum<CodeEnum> >::type* = 0)
|
||||
template <class ErrorCodeEnum>
|
||||
error_code(ErrorCodeEnum e,
|
||||
typename boost::enable_if<is_error_code_enum<ErrorCodeEnum> >::type* = 0)
|
||||
{
|
||||
*this = make_error_code(e);
|
||||
}
|
||||
@ -325,9 +325,9 @@ namespace boost
|
||||
m_cat = &cat;
|
||||
}
|
||||
|
||||
template<typename CodeEnum>
|
||||
typename boost::enable_if<is_error_code_enum<CodeEnum>, error_code>::type &
|
||||
operator=( CodeEnum val )
|
||||
template<typename ErrorCodeEnum>
|
||||
typename boost::enable_if<is_error_code_enum<ErrorCodeEnum>, error_code>::type &
|
||||
operator=( ErrorCodeEnum val )
|
||||
{
|
||||
*this = make_error_code(val);
|
||||
return *this;
|
||||
@ -382,6 +382,9 @@ namespace boost
|
||||
|
||||
};
|
||||
|
||||
// predefined error_code object used as "throw on error" tag
|
||||
BOOST_SYSTEM_DECL extern error_code throws;
|
||||
|
||||
// non-member functions ------------------------------------------------//
|
||||
|
||||
inline bool operator!=( const error_code & lhs,
|
||||
|
@ -61,11 +61,12 @@ namespace
|
||||
|
||||
const char * generic_error_category::name() const
|
||||
{
|
||||
return "GENERIC";
|
||||
return "generic";
|
||||
}
|
||||
|
||||
std::string generic_error_category::message( int ev ) const
|
||||
{
|
||||
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:
|
||||
// -- Windows doesn't provide strerror_r.
|
||||
@ -81,15 +82,19 @@ namespace
|
||||
|| (defined(__osf__) && !defined(_REENTRANT))\
|
||||
|| (defined(__vms))
|
||||
const char * c_str = std::strerror( ev );
|
||||
return std::string( c_str ? c_str : "Unknown error" );
|
||||
# else
|
||||
return c_str
|
||||
? std::string( c_str )
|
||||
: unknown_err;
|
||||
# else // use strerror_r
|
||||
char buf[64];
|
||||
char * bp = buf;
|
||||
std::size_t sz = sizeof(buf);
|
||||
# if defined(__CYGWIN__) || defined(__USE_GNU)
|
||||
// Oddball version of strerror_r
|
||||
const char * c_str = strerror_r( ev, bp, sz );
|
||||
return std::string( c_str ? c_str : "Unknown error" );
|
||||
return c_str
|
||||
? std::string( c_str )
|
||||
: unknown_err;
|
||||
# else
|
||||
// POSIX version of strerror_r
|
||||
int result;
|
||||
@ -100,7 +105,9 @@ namespace
|
||||
# if defined (__sgi)
|
||||
const char * c_str = strerror( ev );
|
||||
result = 0;
|
||||
return std::string( c_str ? c_str : "Unknown error" );
|
||||
return c_str
|
||||
? std::string( c_str )
|
||||
: unknown_err;
|
||||
# else
|
||||
result = strerror_r( ev, bp, sz );
|
||||
# endif
|
||||
@ -113,26 +120,31 @@ namespace
|
||||
result = errno;
|
||||
# endif
|
||||
if ( result != ERANGE ) break;
|
||||
if ( sz > sizeof(buf) ) std::free( bp );
|
||||
sz *= 2;
|
||||
if ( (bp = static_cast<char*>(std::malloc( sz ))) == 0 )
|
||||
return std::string( "ENOMEM" );
|
||||
if ( sz > sizeof(buf) ) std::free( bp );
|
||||
sz *= 2;
|
||||
if ( (bp = static_cast<char*>(std::malloc( sz ))) == 0 )
|
||||
return std::string( "ENOMEM" );
|
||||
}
|
||||
}
|
||||
std::string msg;
|
||||
try
|
||||
{
|
||||
std::string msg( ( result == invalid_argument ) ? "Unknown error" : bp );
|
||||
if ( sz > sizeof(buf) ) std::free( bp );
|
||||
sz = 0;
|
||||
return msg;
|
||||
msg = ( ( result == invalid_argument ) ? "Unknown error" : bp );
|
||||
}
|
||||
|
||||
# ifndef BOOST_NO_EXCEPTIONS
|
||||
// See ticket #2098
|
||||
catch(...)
|
||||
{
|
||||
if ( sz > sizeof(buf) ) std::free( bp );
|
||||
throw;
|
||||
// just eat the exception
|
||||
}
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
|
||||
if ( sz > sizeof(buf) ) std::free( bp );
|
||||
sz = 0;
|
||||
return msg;
|
||||
# endif // else POSIX version of strerror_r
|
||||
# endif // else use strerror_r
|
||||
}
|
||||
// system_error_category implementation --------------------------------//
|
||||
|
||||
@ -154,7 +166,9 @@ namespace
|
||||
case EADDRNOTAVAIL: return make_error_condition( address_not_available );
|
||||
case EAFNOSUPPORT: return make_error_condition( address_family_not_supported );
|
||||
case EAGAIN: return make_error_condition( resource_unavailable_try_again );
|
||||
# if EALREADY != EBUSY // EALREADY and EBUSY are the same on QNX Neutrino
|
||||
case EALREADY: return make_error_condition( connection_already_in_progress );
|
||||
# endif
|
||||
case EBADF: return make_error_condition( bad_file_descriptor );
|
||||
case EBADMSG: return make_error_condition( bad_message );
|
||||
case EBUSY: return make_error_condition( device_or_resource_busy );
|
||||
@ -396,6 +410,12 @@ namespace boost
|
||||
namespace system
|
||||
{
|
||||
|
||||
BOOST_SYSTEM_DECL error_code throws; // "throw on error" special error_code;
|
||||
// note that it doesn't matter if this
|
||||
// isn't initialized before use since
|
||||
// the only use is to take its
|
||||
// address for comparison purposes
|
||||
|
||||
BOOST_SYSTEM_DECL const error_category & get_system_category()
|
||||
{
|
||||
static const system_error_category system_category_const;
|
||||
|
@ -10,7 +10,6 @@
|
||||
project
|
||||
: requirements
|
||||
<library>/boost/system//boost_system
|
||||
<define>BOOST_ALL_NO_LIB
|
||||
<toolset>msvc:<asynch-exceptions>on
|
||||
;
|
||||
|
||||
|
18
test/msvc_system/common.vsprops
Normal file
18
test/msvc_system/common.vsprops
Normal file
@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioPropertySheet
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="common"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories="../../../../.."
|
||||
PreprocessorDefinitions="BOOST_ALL_NO_LIB"
|
||||
ExceptionHandling="2"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
Description="Executing test $(TargetName).exe..."
|
||||
CommandLine=""$(TargetDir)\$(TargetName).exe" --result_code=no --report_level=no"
|
||||
/>
|
||||
</VisualStudioPropertySheet>
|
199
test/msvc_system/error_code_test/error_code_test.vcproj
Normal file
199
test/msvc_system/error_code_test/error_code_test.vcproj
Normal file
@ -0,0 +1,199 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="9.00"
|
||||
Name="error_code_test"
|
||||
ProjectGUID="{81960557-E9A9-4E81-AC96-9E11C33CB058}"
|
||||
RootNamespace="error_code_test"
|
||||
Keyword="Win32Proj"
|
||||
TargetFrameworkVersion="196613"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="1"
|
||||
InheritedPropertySheets="..\common.vsprops"
|
||||
CharacterSet="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
DebugInformationFormat="4"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
LinkIncremental="2"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="1"
|
||||
InheritedPropertySheets="..\common.vsprops"
|
||||
CharacterSet="1"
|
||||
WholeProgramOptimization="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
EnableIntrinsicFunctions="true"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
|
||||
RuntimeLibrary="2"
|
||||
EnableFunctionLevelLinking="true"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="1"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\..\src\error_code.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\error_code_test.cpp"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
||||
>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Resource Files"
|
||||
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
|
||||
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
|
||||
>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
20
test/msvc_system/msvc_system.sln
Normal file
20
test/msvc_system/msvc_system.sln
Normal file
@ -0,0 +1,20 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 10.00
|
||||
# Visual C++ Express 2008
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "error_code_test", "error_code_test\error_code_test.vcproj", "{81960557-E9A9-4E81-AC96-9E11C33CB058}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Release|Win32 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{81960557-E9A9-4E81-AC96-9E11C33CB058}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{81960557-E9A9-4E81-AC96-9E11C33CB058}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{81960557-E9A9-4E81-AC96-9E11C33CB058}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{81960557-E9A9-4E81-AC96-9E11C33CB058}.Release|Win32.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
Reference in New Issue
Block a user