diff options
author | bkoz <bkoz@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-05-16 21:55:00 +0000 |
---|---|---|
committer | bkoz <bkoz@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-05-16 21:55:00 +0000 |
commit | 9539daa08a73c37498c5b5f06389dddd0fb86946 (patch) | |
tree | db696e79edd0beb18fbe3903b5746d4243fb7897 /libstdc++-v3/testsuite/19_diagnostics | |
parent | 35415f9d4790d901be97ce576966fc54bfa0220a (diff) | |
download | ppe42-gcc-9539daa08a73c37498c5b5f06389dddd0fb86946.tar.gz ppe42-gcc-9539daa08a73c37498c5b5f06389dddd0fb86946.zip |
2008-05-16 Benjamin Kosnik <bkoz@redhat.com>
* include/std/system_error: Align to current draft specifications.
* src/system_error.cc: Same.
* src/functexcept.cc: Adjust for corrected system_error construction.
* include/std/ostream: Adjust error_code inserter.
* acinclude.m4 (GLIBCXX_CHECK_SYSTEM_ERROR): Remove sys_nerr test.
* config/abi/pre/gnu.ver: Add new exports.
* testsuite/util/testsuite_error.h: Consolidate error testing
utilities here.
* testsuite/19_diagnostics/error_code/cons/1.cc: Use
testsuite_error, adjust line numbers and constructor calls.
* testsuite/19_diagnostics/error_code/operators/equal.cc: Same.
* testsuite/19_diagnostics/error_code/operators/not_equal.cc: Same.
* testsuite/19_diagnostics/error_category/cons/copy_neg.cc: Same.
* testsuite/19_diagnostics/error_category/cons/default.cc: Same.
* testsuite/19_diagnostics/error_category/operators/equal.cc: Same.
* testsuite/19_diagnostics/error_category/operators/not_equal.cc: Same.
* testsuite/19_diagnostics/system_error/cons_virtual_derivation.cc:
Same.
* testsuite/19_diagnostics/system_error/cons-1.cc: Same.
* testsuite/19_diagnostics/system_error/what-1.cc: Same.
* testsuite/19_diagnostics/system_error/what-2.cc: Same.
* testsuite/19_diagnostics/system_error/what-big.cc: Same.
* testsuite/19_diagnostics/system_error/what-3.cc: Same.
* testsuite/19_diagnostics/system_error/what-4.cc: Same.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@135446 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/testsuite/19_diagnostics')
14 files changed, 41 insertions, 188 deletions
diff --git a/libstdc++-v3/testsuite/19_diagnostics/error_category/cons/copy_neg.cc b/libstdc++-v3/testsuite/19_diagnostics/error_category/cons/copy_neg.cc index 5a8ec640fef..b7635fee4c0 100644 --- a/libstdc++-v3/testsuite/19_diagnostics/error_category/cons/copy_neg.cc +++ b/libstdc++-v3/testsuite/19_diagnostics/error_category/cons/copy_neg.cc @@ -2,7 +2,7 @@ // { dg-do compile } // 2007-08-22 Benjamin Kosnik <bkoz@redhat.com> -// Copyright (C) 2007 Free Software Foundation, Inc. +// Copyright (C) 2007, 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 @@ -21,24 +21,7 @@ // USA. #include <system_error> -#include <testsuite_hooks.h> - -namespace __gnu_test -{ - struct test_category : public std::error_category - { - virtual std::posix_error::posix_errno - posix(int __v) const - { return std::posix_error::posix_errno(__v); } - - virtual const std::string& - name() const - { - static std::string s("__gnu_test::test_category"); - return s; - } - }; -} +#include <testsuite_error.h> int main() { @@ -50,7 +33,7 @@ int main() return 0; } -// { dg-error "is private" "" { target *-*-* } 76 } -// { dg-error "within this context" "" { target *-*-* } 29 } -// { dg-error "first required here" "" { target *-*-* } 48 } +// { 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" } diff --git a/libstdc++-v3/testsuite/19_diagnostics/error_category/cons/default.cc b/libstdc++-v3/testsuite/19_diagnostics/error_category/cons/default.cc index 1072cc63c67..50c46516131 100644 --- a/libstdc++-v3/testsuite/19_diagnostics/error_category/cons/default.cc +++ b/libstdc++-v3/testsuite/19_diagnostics/error_category/cons/default.cc @@ -1,7 +1,7 @@ // { dg-options "-std=gnu++0x" } // 2007-08-22 Benjamin Kosnik <bkoz@redhat.com> -// Copyright (C) 2007 Free Software Foundation, Inc. +// Copyright (C) 2007, 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 @@ -20,34 +20,7 @@ // USA. #include <system_error> -#include <testsuite_hooks.h> - -namespace __gnu_test -{ - struct test_category : public std::error_category - { - virtual std::posix_error::posix_errno - posix(int __v) const - { return std::posix_error::posix_errno(__v); } - - virtual const std::string& - name() const - { - static std::string s("__gnu_test::test_category"); - return s; - } - }; - - struct test_derived_category : public test_category - { - virtual const std::string& - name() const - { - static std::string s("__gnu_test::test_derived_category"); - return s; - } - }; -} +#include <testsuite_error.h> int main() { diff --git a/libstdc++-v3/testsuite/19_diagnostics/error_category/operators/equal.cc b/libstdc++-v3/testsuite/19_diagnostics/error_category/operators/equal.cc index 7b8a19cd7e3..b900521cb21 100644 --- a/libstdc++-v3/testsuite/19_diagnostics/error_category/operators/equal.cc +++ b/libstdc++-v3/testsuite/19_diagnostics/error_category/operators/equal.cc @@ -1,7 +1,7 @@ // { dg-options "-std=gnu++0x" } // 2007-08-22 Benjamin Kosnik <bkoz@redhat.com> -// Copyright (C) 2007 Free Software Foundation, Inc. +// Copyright (C) 2007, 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 @@ -20,34 +20,7 @@ // USA. #include <system_error> -#include <testsuite_hooks.h> - -namespace __gnu_test -{ - struct test_category : public std::error_category - { - virtual std::posix_error::posix_errno - posix(int __v) const - { return std::posix_error::posix_errno(__v); } - - virtual const std::string& - name() const - { - static std::string s("__gnu_test::test_category"); - return s; - } - }; - - struct test_derived_category : public test_category - { - virtual const std::string& - name() const - { - static std::string s("__gnu_test::test_derived_category"); - return s; - } - }; -} +#include <testsuite_error.h> int main() { diff --git a/libstdc++-v3/testsuite/19_diagnostics/error_category/operators/not_equal.cc b/libstdc++-v3/testsuite/19_diagnostics/error_category/operators/not_equal.cc index 043c8a207a3..eab9940d056 100644 --- a/libstdc++-v3/testsuite/19_diagnostics/error_category/operators/not_equal.cc +++ b/libstdc++-v3/testsuite/19_diagnostics/error_category/operators/not_equal.cc @@ -1,7 +1,7 @@ // { dg-options "-std=gnu++0x" } // 2007-08-22 Benjamin Kosnik <bkoz@redhat.com> -// Copyright (C) 2007 Free Software Foundation, Inc. +// Copyright (C) 2007, 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 @@ -20,34 +20,7 @@ // USA. #include <system_error> -#include <testsuite_hooks.h> - -namespace __gnu_test -{ - struct test_category : public std::error_category - { - virtual std::posix_error::posix_errno - posix(int __v) const - { return std::posix_error::posix_errno(__v); } - - virtual const std::string& - name() const - { - static std::string s("__gnu_test::test_category"); - return s; - } - }; - - struct test_derived_category : public test_category - { - virtual const std::string& - name() const - { - static std::string s("__gnu_test::test_derived_category"); - return s; - } - }; -} +#include <testsuite_error.h> int main() { diff --git a/libstdc++-v3/testsuite/19_diagnostics/error_code/cons/1.cc b/libstdc++-v3/testsuite/19_diagnostics/error_code/cons/1.cc index ea1316d067a..8ba68d645e1 100644 --- a/libstdc++-v3/testsuite/19_diagnostics/error_code/cons/1.cc +++ b/libstdc++-v3/testsuite/19_diagnostics/error_code/cons/1.cc @@ -1,7 +1,7 @@ // { dg-options "-std=gnu++0x" } // 2007-08-22 Benjamin Kosnik <bkoz@redhat.com> -// Copyright (C) 2007 Free Software Foundation, Inc. +// Copyright (C) 2007, 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 @@ -20,24 +20,7 @@ // USA. #include <system_error> -#include <testsuite_hooks.h> - -namespace __gnu_test -{ - struct test_category : public std::error_category - { - virtual std::posix_error::posix_errno - posix(int __v) const - { return std::posix_error::posix_errno(__v); } - - virtual const std::string& - name() const - { - static std::string s("__gnu_test::test_category"); - return s; - } - }; -} +#include <testsuite_error.h> int main() { diff --git a/libstdc++-v3/testsuite/19_diagnostics/error_code/operators/equal.cc b/libstdc++-v3/testsuite/19_diagnostics/error_code/operators/equal.cc index a98ed9023a0..a8fc65c4c31 100644 --- a/libstdc++-v3/testsuite/19_diagnostics/error_code/operators/equal.cc +++ b/libstdc++-v3/testsuite/19_diagnostics/error_code/operators/equal.cc @@ -1,7 +1,7 @@ // { dg-options "-std=gnu++0x" } // 2007-08-22 Benjamin Kosnik <bkoz@redhat.com> -// Copyright (C) 2007 Free Software Foundation, Inc. +// Copyright (C) 2007, 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 @@ -20,24 +20,7 @@ // USA. #include <system_error> -#include <testsuite_hooks.h> - -namespace __gnu_test -{ - struct test_category : public std::error_category - { - virtual std::posix_error::posix_errno - posix(int __v) const - { return std::posix_error::posix_errno(__v); } - - virtual const std::string& - name() const - { - static std::string s("__gnu_test::test_category"); - return s; - } - }; -} +#include <testsuite_error.h> // unspecified bool operator positive tests int main() diff --git a/libstdc++-v3/testsuite/19_diagnostics/error_code/operators/not_equal.cc b/libstdc++-v3/testsuite/19_diagnostics/error_code/operators/not_equal.cc index 00153456403..d5d75553bf5 100644 --- a/libstdc++-v3/testsuite/19_diagnostics/error_code/operators/not_equal.cc +++ b/libstdc++-v3/testsuite/19_diagnostics/error_code/operators/not_equal.cc @@ -1,7 +1,7 @@ // { dg-options "-std=gnu++0x" } // 2007-08-22 Benjamin Kosnik <bkoz@redhat.com> -// Copyright (C) 2007 Free Software Foundation, Inc. +// Copyright (C) 2007, 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 @@ -20,24 +20,7 @@ // USA. #include <system_error> -#include <testsuite_hooks.h> - -namespace __gnu_test -{ - struct test_category : public std::error_category - { - virtual std::posix_error::posix_errno - posix(int __v) const - { return std::posix_error::posix_errno(__v); } - - virtual const std::string& - name() const - { - static std::string s("__gnu_test::test_category"); - return s; - } - }; -} +#include <testsuite_error.h> // unspecified bool operator positive tests int main() diff --git a/libstdc++-v3/testsuite/19_diagnostics/system_error/cons-1.cc b/libstdc++-v3/testsuite/19_diagnostics/system_error/cons-1.cc index 2885dad2723..9fc24f1f25d 100644 --- a/libstdc++-v3/testsuite/19_diagnostics/system_error/cons-1.cc +++ b/libstdc++-v3/testsuite/19_diagnostics/system_error/cons-1.cc @@ -1,7 +1,7 @@ // { dg-options "-std=gnu++0x" } // 2007-06-05 Benjamin Kosnik <bkoz@redhat.com> -// Copyright (C) 2007 Free Software Foundation, Inc. +// Copyright (C) 2007, 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 @@ -31,14 +31,14 @@ int main() // 1 { - std::system_error err1(s, e); + std::system_error err1(e, s); VERIFY( err1.code() == e ); VERIFY( std::strcmp(err1.runtime_error::what(), s.c_str()) == 0 ); } // 2 { - std::system_error err2(s, 95, std::system_category); + std::system_error err2(95, std::system_category, s); VERIFY( err2.code() == std::error_code(95, std::system_category) ); VERIFY( std::strcmp(err2.runtime_error::what(), s.c_str()) == 0 ); } diff --git a/libstdc++-v3/testsuite/19_diagnostics/system_error/cons_virtual_derivation.cc b/libstdc++-v3/testsuite/19_diagnostics/system_error/cons_virtual_derivation.cc index 09ba2fd13e4..8e67ce5edae 100644 --- a/libstdc++-v3/testsuite/19_diagnostics/system_error/cons_virtual_derivation.cc +++ b/libstdc++-v3/testsuite/19_diagnostics/system_error/cons_virtual_derivation.cc @@ -26,6 +26,6 @@ int main() { typedef std::system_error test_type; - __gnu_test::diamond_derivation<test_type, false>::test(); + __gnu_test::diamond_derivation<test_type, true>::test(); return 0; } diff --git a/libstdc++-v3/testsuite/19_diagnostics/system_error/what-1.cc b/libstdc++-v3/testsuite/19_diagnostics/system_error/what-1.cc index c178e542a3c..aef2a95c4ed 100644 --- a/libstdc++-v3/testsuite/19_diagnostics/system_error/what-1.cc +++ b/libstdc++-v3/testsuite/19_diagnostics/system_error/what-1.cc @@ -1,6 +1,6 @@ // { dg-options "-std=gnu++0x" } -// Copyright (C) 2007 +// Copyright (C) 2007, 2008 // Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free @@ -26,29 +26,31 @@ #include <cstring> #include <testsuite_hooks.h> +using namespace std; + // libstdc++/1972 void test01() { bool test __attribute__((unused)) = true; - std::string s("lack of sunlight, no water error"); + string s("lack of sunlight, no water error"); // 1 - std::system_error obj1 = std::system_error(s); + system_error obj1 = system_error(error_code(), s); // 2 - std::system_error obj2(s); + system_error obj2(error_code(), s); - VERIFY( std::strcmp(obj1.what(), s.data()) == 0 ); - VERIFY( std::strcmp(obj2.what(), s.data()) == 0 ); + VERIFY( strcmp(obj1.what(), s.data()) == 0 ); + VERIFY( strcmp(obj2.what(), s.data()) == 0 ); } void test02() { bool test __attribute__((unused)) = true; - std::string s("lack of sunlight error"); - std::system_error x(s); + string s("lack of sunlight error"); + system_error x(error_code(), s); - VERIFY( std::strcmp(x.what(), s.data()) == 0 ); + VERIFY( strcmp(x.what(), s.data()) == 0 ); } int main(void) diff --git a/libstdc++-v3/testsuite/19_diagnostics/system_error/what-2.cc b/libstdc++-v3/testsuite/19_diagnostics/system_error/what-2.cc index eb8e14c9cc1..2bb54fb8e26 100644 --- a/libstdc++-v3/testsuite/19_diagnostics/system_error/what-2.cc +++ b/libstdc++-v3/testsuite/19_diagnostics/system_error/what-2.cc @@ -1,6 +1,6 @@ // { dg-options "-std=gnu++0x" } -// Copyright (C) 2007 +// Copyright (C) 2007, 2008 // Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free @@ -30,7 +30,7 @@ class fuzzy_logic : public std::system_error { public: - fuzzy_logic() : std::system_error("whoa") { } + fuzzy_logic() : std::system_error(std::error_code(), "whoa") { } }; void test03() diff --git a/libstdc++-v3/testsuite/19_diagnostics/system_error/what-3.cc b/libstdc++-v3/testsuite/19_diagnostics/system_error/what-3.cc index 23d99a87d94..76d10b8e828 100644 --- a/libstdc++-v3/testsuite/19_diagnostics/system_error/what-3.cc +++ b/libstdc++-v3/testsuite/19_diagnostics/system_error/what-3.cc @@ -41,12 +41,12 @@ void test04() const std::string s("CA ISO emergency once again:immediate power down"); const char* strlit1 = "wish I lived in Palo Alto"; const char* strlit2 = "...or Santa Barbara"; - std::system_error obj1(s); + std::system_error obj1(std::error_code(), s); // block 01 { const std::string s2(strlit1); - std::system_error obj2(s2); + std::system_error obj2(std::error_code(), s2); obj1 = obj2; } allocate_on_stack(); @@ -55,7 +55,7 @@ void test04() // block 02 { const std::string s3(strlit2); - std::system_error obj3 = std::system_error(s3); + std::system_error obj3 = std::system_error(std::error_code(), s3); obj1 = obj3; } allocate_on_stack(); diff --git a/libstdc++-v3/testsuite/19_diagnostics/system_error/what-4.cc b/libstdc++-v3/testsuite/19_diagnostics/system_error/what-4.cc index 89570f04721..5934982fa47 100644 --- a/libstdc++-v3/testsuite/19_diagnostics/system_error/what-4.cc +++ b/libstdc++-v3/testsuite/19_diagnostics/system_error/what-4.cc @@ -1,6 +1,6 @@ // { dg-options "-std=gnu++0x" } -// Copyright (C) 2007 +// Copyright (C) 2007, 2008 // Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free @@ -32,7 +32,7 @@ void test01() bool test __attribute__((unused)) = true; std::string s("after nine thirty, this request cannot be met"); - std::system_error obj = std::system_error(s, std::posix_error::invalid_argument); + std::system_error obj = std::system_error(std::posix_error::invalid_argument, s); std::string s1(obj.what()); std::string s2(obj.what()); VERIFY( s1 == s2 ); diff --git a/libstdc++-v3/testsuite/19_diagnostics/system_error/what-big.cc b/libstdc++-v3/testsuite/19_diagnostics/system_error/what-big.cc index 765bcbf19fe..ecf89526b32 100644 --- a/libstdc++-v3/testsuite/19_diagnostics/system_error/what-big.cc +++ b/libstdc++-v3/testsuite/19_diagnostics/system_error/what-big.cc @@ -1,6 +1,6 @@ // { dg-options "-std=gnu++0x" } -// Copyright (C) 2007 Free Software Foundation, Inc. +// Copyright (C) 2007, 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 @@ -30,7 +30,7 @@ void test01() bool test __attribute__((unused)) = true; const std::string xxx(10000, 'x'); - test_type t(xxx); + test_type t(std::error_code(), xxx); VERIFY( std::strcmp(t.what(), xxx.c_str()) == 0 ); } |