This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
[v3] Implement DR 804, other small tweaks to <system_error>
- From: Paolo Carlini <paolo dot carlini at oracle dot com>
- To: Gcc Patch List <gcc-patches at gcc dot gnu dot org>
- Cc: libstdc++ <libstdc++ at gcc dot gnu dot org>
- Date: Fri, 10 Oct 2008 14:40:06 +0200
- Subject: [v3] Implement DR 804, other small tweaks to <system_error>
Hi,
tested x86_64-linux, committed to mainline.
Paolo.
///////////////////
2008-10-10 Paolo Carlini <paolo.carlini@oracle.com>
* include/std/system_error (native_category): Remove.
(posix_category): Add.
(error_code::error_code(_ErrorCodeEnum, typename enable_if<>:type*):
Fix _M_cat initialization.
(error_code::operator=(_ErrorCodeEnum)): Assign _M_cat too.
(error_condition::_M_cat, error_condtion::operator=
(_ErrorConditionEnum)): Implement resolution of DR 804.
(error_condition::error_condition(_ErrorConditionEnum, typename
enable_if<>:type*): Fix.
(error_condition::clear, error_condition::assign): Implement.
(operator==, operator!=): Fix uglification of parameters.
(make_error_code, make_error_condition): Define in namespace
posix_error.
(operator<<(basic_ostream<>&, const error_code&)): Define here.
* include/std/ostream (operator<<(basic_ostream<>&,
const error_code&)): Do not define here.
* testsuite/19_diagnostics/error_condition/cons/1.cc: New.
* testsuite/19_diagnostics/error_condition/operators/bool.cc: Likewise.
* testsuite/19_diagnostics/error_condition/operators/bool_neg.cc:
Likewise.
* testsuite/19_diagnostics/error_condition/operators/equal.cc:
Likewise.
* testsuite/19_diagnostics/error_condition/operators/not_equal.cc:
Likewise.
* testsuite/19_diagnostics/error_code/cons/1.cc: Tweak.
* testsuite/19_diagnostics/error_category/cons/copy_neg.cc: Adjust
dg-error line numbers.
* testsuite/30_threads/unique_lock/locking/2.cc: Tweak.
* testsuite/util/testsuite_error.h: Minor tweaks.
* testsuite/util/testsuite_hooks.cc: Avoid uninitialized warning.
Index: include/std/system_error
===================================================================
*** include/std/system_error (revision 141028)
--- include/std/system_error (working copy)
*************** _GLIBCXX_BEGIN_NAMESPACE(std)
*** 111,118 ****
const error_category& get_posix_category();
const error_category& get_system_category();
static const error_category& system_category = get_system_category();
- static const error_category& native_category = get_posix_category();
/// error_code
// Implementation-specific error identification
--- 111,118 ----
const error_category& get_posix_category();
const error_category& get_system_category();
+ static const error_category& posix_category = get_posix_category();
static const error_category& system_category = get_system_category();
/// error_code
// Implementation-specific error identification
*************** _GLIBCXX_BEGIN_NAMESPACE(std)
*** 127,133 ****
template<typename _ErrorCodeEnum>
error_code(_ErrorCodeEnum __e,
typename enable_if<is_error_code_enum<_ErrorCodeEnum>::value>::type* = 0)
! : _M_value(__e), _M_cat(&system_category)
{ }
void
--- 127,133 ----
template<typename _ErrorCodeEnum>
error_code(_ErrorCodeEnum __e,
typename enable_if<is_error_code_enum<_ErrorCodeEnum>::value>::type* = 0)
! : _M_value(__e), _M_cat(&posix_category)
{ }
void
*************** _GLIBCXX_BEGIN_NAMESPACE(std)
*** 144,153 ****
_M_cat = &system_category;
}
template<typename _ErrorCodeEnum>
! typename enable_if<is_error_code_enum<_ErrorCodeEnum>::value>::type&
operator=(_ErrorCodeEnum __e)
! { _M_value = __e; }
int
value() const { return _M_value; }
--- 144,159 ----
_M_cat = &system_category;
}
+ // DR 804.
template<typename _ErrorCodeEnum>
! typename enable_if<is_error_code_enum<_ErrorCodeEnum>::value,
! error_code&>::type
operator=(_ErrorCodeEnum __e)
! {
! _M_value = __e;
! _M_cat = &posix_category;
! return *this;
! }
int
value() const { return _M_value; }
*************** _GLIBCXX_BEGIN_NAMESPACE(std)
*** 172,226 ****
operator __bool_type() const
{ return _M_value != 0 ? &__not_bool_type : false; }
private:
int _M_value;
const error_category* _M_cat;
};
- error_code
- make_error_code(posix_error::posix_errno);
-
// 19.4.2.5 non-member functions
! bool operator<(const error_code& lhs, const error_code& rhs);
! template<typename charT, typename traits>
! basic_ostream<charT,traits>&
! operator<<(basic_ostream<charT, traits>& os, const error_code& __code);
/// error_condition
// Portable error identification
struct error_condition
{
! error_condition() : _M_value(0), _M_cat(system_category) { }
error_condition(int __v, const error_category& __cat)
! : _M_value(__v), _M_cat(__cat) { }
! template<typename _ErrorEnum>
! error_condition(typename enable_if<
! is_error_condition_enum<_ErrorEnum>::value,
! _ErrorEnum>::type __v)
! : _M_value(__v), _M_cat(system_category) { }
! void
! assign(int val, const error_category& cat);
! template<typename _ErrorEnum>
! error_condition&
! operator=(typename enable_if<is_error_condition_enum<_ErrorEnum>::value,
! _ErrorEnum>::type __v)
! { _M_value = __v; }
void
! clear();
// 19.4.3.4 observers
int
value() const { return _M_value; }
! const error_category&
! category() const { return _M_cat; }
string
message() const
--- 178,250 ----
operator __bool_type() const
{ return _M_value != 0 ? &__not_bool_type : false; }
+ // DR 804.
private:
int _M_value;
const error_category* _M_cat;
};
// 19.4.2.5 non-member functions
! inline bool
! operator<(const error_code& __lhs, const error_code& __rhs)
! {
! return (__lhs.category() < __rhs.category()
! || (__lhs.category() == __rhs.category()
! && __lhs.value() < __rhs.value()));
! }
! template<typename _CharT, typename _Traits>
! basic_ostream<_CharT, _Traits>&
! operator<<(basic_ostream<_CharT, _Traits>& __os, const error_code& __e)
! { return (__os << __e.category().name() << ':' << __e.value()); }
/// error_condition
// Portable error identification
struct error_condition
{
! error_condition() : _M_value(0), _M_cat(&posix_category) { }
error_condition(int __v, const error_category& __cat)
! : _M_value(__v), _M_cat(&__cat) { }
! template<typename _ErrorConditionEnum>
! error_condition(_ErrorConditionEnum __e,
! typename enable_if<is_error_condition_enum
! <_ErrorConditionEnum>::value>::type* = 0)
! : _M_value(__e), _M_cat(&posix_category) { }
! void
! assign(int __v, const error_category& __cat)
! {
! _M_value = __v;
! _M_cat = &__cat;
! }
! // DR 804.
! template<typename _ErrorConditionEnum>
! typename enable_if<is_error_condition_enum
! <_ErrorConditionEnum>::value, error_condition&>::type
! operator=(_ErrorConditionEnum __e)
! {
! _M_value = __e;
! _M_cat = &posix_category;
! return *this;
! }
void
! clear()
! {
! _M_value = 0;
! _M_cat = &posix_category;
! }
// 19.4.3.4 observers
int
value() const { return _M_value; }
! const error_category&
! category() const { return *_M_cat; }
string
message() const
*************** _GLIBCXX_BEGIN_NAMESPACE(std)
*** 236,298 ****
operator __bool_type() const
{ return _M_value != 0 ? &__not_bool_type : false; }
private:
int _M_value;
! const error_category& _M_cat;
};
- error_condition
- make_error_condition(posix_error::posix_errno);
-
// 19.4.3.5 non-member functions
inline bool
! operator<(const error_condition& lhs, const error_condition& rhs)
! {
! bool __t1 = lhs.category() < rhs.category();
! bool __t2 = lhs.category() == rhs.category() && lhs.value() < rhs.value();
! return __t1 || __t2;
}
// 19.4.4 Comparison operators
! inline bool
! operator==(const error_code& lhs, const error_code& rhs)
! { return lhs.category() == rhs.category() && lhs.value() == rhs.value(); }
! inline bool
! operator==(const error_code& lhs, const error_condition& rhs)
{
! bool __t1 = lhs.category().equivalent(lhs.value(), rhs);
! bool __t2 = rhs.category().equivalent(lhs, rhs.value());
! return __t1 || __t2;
}
! inline bool
! operator==(const error_condition& lhs, const error_code& rhs)
{
! bool __t1 = rhs.category().equivalent(rhs.value(), lhs);
! bool __t2 = lhs.category().equivalent(rhs, lhs.value());
! return __t1 || __t2;
}
! inline bool
! operator==(const error_condition& lhs, const error_condition& rhs)
! { return lhs.category() == rhs.category() && lhs.value() == rhs.value(); }
!
! inline bool
! operator!=(const error_code& lhs, const error_code& rhs)
! { return !(lhs == rhs); }
!
! inline bool
! operator!=(const error_code& lhs, const error_condition& rhs)
! { return !(lhs == rhs); }
! inline bool
! operator!=(const error_condition& lhs, const error_code& rhs)
! { return !(lhs == rhs); }
- inline bool
- operator!=(const error_condition& lhs, const error_condition& rhs)
- { return !(lhs == rhs); }
/// Thrown to indicate error code of underlying system.
class system_error : public std::runtime_error
--- 260,334 ----
operator __bool_type() const
{ return _M_value != 0 ? &__not_bool_type : false; }
+ // DR 804.
private:
int _M_value;
! const error_category* _M_cat;
};
// 19.4.3.5 non-member functions
inline bool
! operator<(const error_condition& __lhs, const error_condition& __rhs)
! {
! return (__lhs.category() < __rhs.category()
! || (__lhs.category() == __rhs.category()
! && __lhs.value() < __rhs.value()));
! }
!
! namespace posix_error
! {
! inline error_code
! make_error_code(posix_errno __e)
! { return error_code(__e, posix_category); }
!
! inline error_condition
! make_error_condition(posix_errno __e)
! { return error_condition(__e, posix_category); }
}
// 19.4.4 Comparison operators
! inline bool
! operator==(const error_code& __lhs, const error_code& __rhs)
! { return (__lhs.category() == __rhs.category()
! && __lhs.value() == __rhs.value()); }
! inline bool
! operator==(const error_code& __lhs, const error_condition& __rhs)
{
! return (__lhs.category().equivalent(__lhs.value(), __rhs)
! || __rhs.category().equivalent(__lhs, __rhs.value()));
}
! inline bool
! operator==(const error_condition& __lhs, const error_code& __rhs)
{
! return (__rhs.category().equivalent(__rhs.value(), __lhs)
! || __lhs.category().equivalent(__rhs, __lhs.value()));
}
! inline bool
! operator==(const error_condition& __lhs, const error_condition& __rhs)
! {
! return (__lhs.category() == __rhs.category()
! && __lhs.value() == __rhs.value());
! }
! inline bool
! operator!=(const error_code& __lhs, const error_code& __rhs)
! { return !(__lhs == __rhs); }
!
! inline bool
! operator!=(const error_code& __lhs, const error_condition& __rhs)
! { return !(__lhs == __rhs); }
!
! inline bool
! operator!=(const error_condition& __lhs, const error_code& __rhs)
! { return !(__lhs == __rhs); }
!
! inline bool
! operator!=(const error_condition& __lhs, const error_condition& __rhs)
! { return !(__lhs == __rhs); }
/// Thrown to indicate error code of underlying system.
class system_error : public std::runtime_error
Index: include/std/ostream
===================================================================
*** include/std/ostream (revision 141028)
--- include/std/ostream (working copy)
***************
*** 45,54 ****
#include <ios>
#include <bits/ostream_insert.h>
- #ifdef __GXX_EXPERIMENTAL_CXX0X__
- # include <system_error>
- #endif
-
_GLIBCXX_BEGIN_NAMESPACE(std)
// [27.6.2.1] Template class basic_ostream
--- 45,50 ----
*************** _GLIBCXX_BEGIN_NAMESPACE(std)
*** 535,547 ****
{ return (__out << reinterpret_cast<const char*>(__s)); }
//@}
- #ifdef __GXX_EXPERIMENTAL_CXX0X__
- template<typename _CharT, typename _Traits>
- inline basic_ostream<_CharT, _Traits>&
- operator<<(basic_ostream<_CharT, _Traits>& __out, const error_code& __e)
- { return (__out << __e.category().name() << ':' << __e.value()); }
- #endif
-
// [27.6.2.7] standard basic_ostream manipulators
/**
* @brief Write a newline and flush the stream.
--- 531,536 ----
Index: testsuite/19_diagnostics/error_condition/cons/1.cc
===================================================================
*** testsuite/19_diagnostics/error_condition/cons/1.cc (revision 0)
--- testsuite/19_diagnostics/error_condition/cons/1.cc (revision 0)
***************
*** 0 ****
--- 1,49 ----
+ // { dg-options "-std=gnu++0x" }
+
+ // Copyright (C) 2008 Free Software Foundation, Inc.
+ //
+ // This file is part of the GNU ISO C++ Library. This library is free
+ // software; you can redistribute it and/or modify it under the
+ // terms of the GNU General Public License as published by the
+ // Free Software Foundation; either version 2, or (at your option)
+ // any later version.
+
+ // This library is distributed in the hope that it will be useful,
+ // but WITHOUT ANY WARRANTY; without even the implied warranty of
+ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ // GNU General Public License for more details.
+
+ // You should have received a copy of the GNU General Public License along
+ // with this library; see the file COPYING. If not, write to the Free
+ // Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+ // USA.
+
+ #include <system_error>
+ #include <testsuite_error.h>
+
+ void test01()
+ {
+ bool test __attribute__((unused)) = true;
+
+ // 1
+ std::error_condition e1;
+ VERIFY( e1.value() == 0 );
+ VERIFY( e1.category() == std::posix_category );
+
+ // 2
+ const __gnu_test::test_category cat;
+ std::error_condition e2(e1.value(), cat);
+ VERIFY( e2.value() == e1.value() );
+ VERIFY( e2.category() == cat );
+
+ // 3
+ std::error_condition e3(std::posix_error::operation_not_supported);
+ VERIFY( e3.value() == int(std::posix_error::operation_not_supported) );
+ VERIFY( e3.category() == std::posix_category );
+ }
+
+ int main()
+ {
+ test01();
+ return 0;
+ }
Index: testsuite/19_diagnostics/error_condition/operators/bool.cc
===================================================================
*** testsuite/19_diagnostics/error_condition/operators/bool.cc (revision 0)
--- testsuite/19_diagnostics/error_condition/operators/bool.cc (revision 0)
***************
*** 0 ****
--- 1,48 ----
+ // { dg-options "-std=gnu++0x" }
+
+ // Copyright (C) 2008 Free Software Foundation, Inc.
+ //
+ // This file is part of the GNU ISO C++ Library. This library is free
+ // software; you can redistribute it and/or modify it under the
+ // terms of the GNU General Public License as published by the
+ // Free Software Foundation; either version 2, or (at your option)
+ // any later version.
+
+ // This library is distributed in the hope that it will be useful,
+ // but WITHOUT ANY WARRANTY; without even the implied warranty of
+ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ // GNU General Public License for more details.
+
+ // You should have received a copy of the GNU General Public License along
+ // with this library; see the file COPYING. If not, write to the Free
+ // Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+ // USA.
+
+ #include <system_error>
+ #include <testsuite_hooks.h>
+
+ // unspecified bool operator positive tests
+ void test01()
+ {
+ bool test __attribute__((unused)) = true;
+
+ // 1
+ std::error_condition e1;
+ if (e1)
+ {
+ VERIFY( false );
+ }
+
+ // 2
+ std::error_condition e2(std::posix_error::operation_not_supported);
+ if (e2)
+ {
+ VERIFY( true );
+ }
+ }
+
+ int main()
+ {
+ test01();
+ return 0;
+ }
Index: testsuite/19_diagnostics/error_condition/operators/bool_neg.cc
===================================================================
*** testsuite/19_diagnostics/error_condition/operators/bool_neg.cc (revision 0)
--- testsuite/19_diagnostics/error_condition/operators/bool_neg.cc (revision 0)
***************
*** 0 ****
--- 1,33 ----
+ // { dg-options "-std=gnu++0x" }
+ // { dg-do compile }
+
+ // Copyright (C) 2008 Free Software Foundation, Inc.
+ //
+ // This file is part of the GNU ISO C++ Library. This library is free
+ // software; you can redistribute it and/or modify it under the
+ // terms of the GNU General Public License as published by the
+ // Free Software Foundation; either version 2, or (at your option)
+ // any later version.
+
+ // This library is distributed in the hope that it will be useful,
+ // but WITHOUT ANY WARRANTY; without even the implied warranty of
+ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ // GNU General Public License for more details.
+
+ // You should have received a copy of the GNU General Public License along
+ // with this library; see the file COPYING. If not, write to the Free
+ // Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+ // USA.
+
+ #include <system_error>
+ #include <testsuite_hooks.h>
+
+ int test01()
+ {
+ std::error_condition e;
+ int i = e;
+
+ return i;
+ }
+
+ // { dg-error "invalid conversion" "" { target *-*-* } 28 }
Index: testsuite/19_diagnostics/error_condition/operators/equal.cc
===================================================================
*** testsuite/19_diagnostics/error_condition/operators/equal.cc (revision 0)
--- testsuite/19_diagnostics/error_condition/operators/equal.cc (revision 0)
***************
*** 0 ****
--- 1,44 ----
+ // { dg-options "-std=gnu++0x" }
+
+ // Copyright (C) 2008 Free Software Foundation, Inc.
+ //
+ // This file is part of the GNU ISO C++ Library. This library is free
+ // software; you can redistribute it and/or modify it under the
+ // terms of the GNU General Public License as published by the
+ // Free Software Foundation; either version 2, or (at your option)
+ // any later version.
+
+ // This library is distributed in the hope that it will be useful,
+ // but WITHOUT ANY WARRANTY; without even the implied warranty of
+ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ // GNU General Public License for more details.
+
+ // You should have received a copy of the GNU General Public License along
+ // with this library; see the file COPYING. If not, write to the Free
+ // Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+ // USA.
+
+ #include <system_error>
+ #include <testsuite_error.h>
+
+ // unspecified bool operator positive tests
+ void test01()
+ {
+ bool test __attribute__((unused)) = true;
+
+ std::error_condition e1;
+ std::error_condition e2(std::posix_error::operation_not_supported);
+
+ VERIFY( e1 == e1 );
+ VERIFY( !(e1 == e2) );
+
+ const __gnu_test::test_category cat;
+ std::error_condition e3(e2.value(), cat);
+ VERIFY( !(e2 == e3) );
+ }
+
+ int main()
+ {
+ test01();
+ return 0;
+ }
Index: testsuite/19_diagnostics/error_condition/operators/not_equal.cc
===================================================================
*** testsuite/19_diagnostics/error_condition/operators/not_equal.cc (revision 0)
--- testsuite/19_diagnostics/error_condition/operators/not_equal.cc (revision 0)
***************
*** 0 ****
--- 1,44 ----
+ // { dg-options "-std=gnu++0x" }
+
+ // Copyright (C) 2008 Free Software Foundation, Inc.
+ //
+ // This file is part of the GNU ISO C++ Library. This library is free
+ // software; you can redistribute it and/or modify it under the
+ // terms of the GNU General Public License as published by the
+ // Free Software Foundation; either version 2, or (at your option)
+ // any later version.
+
+ // This library is distributed in the hope that it will be useful,
+ // but WITHOUT ANY WARRANTY; without even the implied warranty of
+ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ // GNU General Public License for more details.
+
+ // You should have received a copy of the GNU General Public License along
+ // with this library; see the file COPYING. If not, write to the Free
+ // Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+ // USA.
+
+ #include <system_error>
+ #include <testsuite_error.h>
+
+ // unspecified bool operator positive tests
+ void test01()
+ {
+ bool test __attribute__((unused)) = true;
+
+ std::error_condition e1;
+ std::error_condition e2(std::posix_error::operation_not_supported);
+
+ VERIFY( !(e1 != e1) );
+ VERIFY( e1 != e2 );
+
+ const __gnu_test::test_category cat;
+ std::error_condition e3(e2.value(), cat);
+ VERIFY( e2 != e3 );
+ }
+
+ int main()
+ {
+ test01();
+ return 0;
+ }
Index: testsuite/19_diagnostics/error_code/cons/1.cc
===================================================================
*** testsuite/19_diagnostics/error_code/cons/1.cc (revision 141028)
--- testsuite/19_diagnostics/error_code/cons/1.cc (working copy)
*************** int main()
*** 40,46 ****
// 3
std::error_code e3(std::posix_error::operation_not_supported);
VERIFY( e3.value() == int(std::posix_error::operation_not_supported) );
! VERIFY( e3.category() == std::system_category );
return 0;
}
--- 40,46 ----
// 3
std::error_code e3(std::posix_error::operation_not_supported);
VERIFY( e3.value() == int(std::posix_error::operation_not_supported) );
! VERIFY( e3.category() == std::posix_category );
return 0;
}
Index: testsuite/19_diagnostics/error_category/cons/copy_neg.cc
===================================================================
*** testsuite/19_diagnostics/error_category/cons/copy_neg.cc (revision 141028)
--- testsuite/19_diagnostics/error_category/cons/copy_neg.cc (working copy)
*************** int main()
*** 34,39 ****
}
// { dg-error "is private" "" { target *-*-* } 105 }
! // { dg-error "within this context" "" { target *-*-* } 41 }
// { dg-error "first required here" "" { target *-*-* } 31 }
// { dg-excess-errors "copy constructor" }
--- 34,39 ----
}
// { dg-error "is private" "" { target *-*-* } 105 }
! // { dg-error "within this context" "" { target *-*-* } 40 }
// { dg-error "first required here" "" { target *-*-* } 31 }
// { dg-excess-errors "copy constructor" }
Index: testsuite/30_threads/unique_lock/locking/2.cc
===================================================================
*** testsuite/30_threads/unique_lock/locking/2.cc (revision 141028)
--- testsuite/30_threads/unique_lock/locking/2.cc (working copy)
*************** void test01()
*** 51,59 ****
{
l.lock();
}
! catch (std::system_error const& ex)
{
! VERIFY( ex.code() == std::posix_error::operation_not_permitted );
}
catch (...)
{
--- 51,60 ----
{
l.lock();
}
! catch (const std::system_error& ex)
{
! VERIFY( ex.code() == std::error_code(
! std::posix_error::operation_not_permitted) );
}
catch (...)
{
*************** void test02()
*** 89,95 ****
}
catch (const std::system_error& ex)
{
! VERIFY( ex.code() == std::posix_error::resource_deadlock_would_occur );
}
catch (...)
{
--- 90,97 ----
}
catch (const std::system_error& ex)
{
! VERIFY( ex.code() == std::error_code(
! std::posix_error::resource_deadlock_would_occur) );
}
catch (...)
{
Index: testsuite/util/testsuite_hooks.cc
===================================================================
*** testsuite/util/testsuite_hooks.cc (revision 141028)
--- testsuite/util/testsuite_hooks.cc (working copy)
***************
*** 2,8 ****
// Utility subroutines for the C++ library testsuite.
//
! // Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
--- 2,8 ----
// Utility subroutines for the C++ library testsuite.
//
! // Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
*************** namespace __gnu_test
*** 283,288 ****
--- 283,289 ----
{
#ifdef _GLIBCXX_SYSV_SEM
union semun val;
+ val.val = 0; // Avoid uninitialized variable warning.
// Destroy the semaphore set only in the process that created it.
if (pid_ == getpid())
semctl(sem_set_, 0, IPC_RMID, val);
Index: testsuite/util/testsuite_error.h
===================================================================
*** testsuite/util/testsuite_error.h (revision 141028)
--- testsuite/util/testsuite_error.h (working copy)
***************
*** 28,33 ****
--- 28,34 ----
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
+ #include <string>
#include <testsuite_hooks.h>
#ifndef _TESTSUITE_ERROR_H
***************
*** 35,42 ****
namespace __gnu_test
{
- using std::string;
-
struct test_category : public std::error_category
{
virtual const char*
--- 36,41 ----
*************** namespace __gnu_test
*** 46,55 ****
return s;
}
! virtual string
message(int) const
! { return string("message to be determined"); }
!
};
struct test_derived_category : public test_category
--- 45,53 ----
return s;
}
! virtual std::string
message(int) const
! { return std::string("message to be determined"); }
};
struct test_derived_category : public test_category