URL
https://opencores.org/ocsvn/openrisc/openrisc/trunk
Subversion Repositories openrisc
Compare Revisions
- This comparison shows the changes necessary to convert path
/openrisc/trunk/gnu-stable/gcc-4.5.1/libstdc++-v3/testsuite/19_diagnostics
- from Rev 816 to Rev 826
- ↔ Reverse comparison
Rev 816 → Rev 826
/error_condition/modifiers/39881.cc
0,0 → 1,61
// { dg-options "-std=gnu++0x" } |
|
// Copyright (C) 2009 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 3, 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 COPYING3. If not see |
// <http://www.gnu.org/licenses/>. |
|
#include <system_error> |
#include <testsuite_hooks.h> |
|
enum my_errc { my_err = 0 }; |
|
class my_error_category_impl |
: public std::error_category |
{ |
public: |
const char* name() const { return ""; } |
std::string message(int) const { return ""; } |
} my_error_category_instance; |
|
std::error_condition |
make_error_condition(my_errc e) |
{ |
return std::error_condition(static_cast<int>(e), |
my_error_category_instance); |
} |
|
namespace std |
{ |
template<> |
struct is_error_condition_enum<my_errc> |
: public true_type { }; |
} |
|
// libstdc++/39881 |
void test01() |
{ |
bool test __attribute__((unused)) = true; |
|
std::error_condition ec2; |
ec2 = my_err; |
VERIFY( ec2 == make_error_condition(my_err) ); |
} |
|
int main() |
{ |
test01(); |
return 0; |
} |
/error_condition/cons/39881.cc
0,0 → 1,60
// { dg-options "-std=gnu++0x" } |
|
// Copyright (C) 2009 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 3, 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 COPYING3. If not see |
// <http://www.gnu.org/licenses/>. |
|
#include <system_error> |
#include <testsuite_hooks.h> |
|
enum my_errc { my_err = 0 }; |
|
class my_error_category_impl |
: public std::error_category |
{ |
public: |
const char* name() const { return ""; } |
std::string message(int) const { return ""; } |
} my_error_category_instance; |
|
std::error_condition |
make_error_condition(my_errc e) |
{ |
return std::error_condition(static_cast<int>(e), |
my_error_category_instance); |
} |
|
namespace std |
{ |
template<> |
struct is_error_condition_enum<my_errc> |
: public true_type { }; |
} |
|
// libstdc++/39881 |
void test01() |
{ |
bool test __attribute__((unused)) = true; |
|
std::error_condition ec1(my_err); |
VERIFY( ec1 == make_error_condition(my_err) ); |
} |
|
int main() |
{ |
test01(); |
return 0; |
} |
/error_condition/cons/1.cc
0,0 → 1,48
// { dg-options "-std=gnu++0x" } |
|
// Copyright (C) 2008, 2009 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 3, 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 COPYING3. If not see |
// <http://www.gnu.org/licenses/>. |
|
#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::generic_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::errc::operation_not_supported); |
VERIFY( e3.value() == int(std::errc::operation_not_supported) ); |
VERIFY( e3.category() == std::generic_category() ); |
} |
|
int main() |
{ |
test01(); |
return 0; |
} |
/error_condition/operators/bool.cc
0,0 → 1,47
// { dg-options "-std=gnu++0x" } |
|
// Copyright (C) 2008, 2009 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 3, 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 COPYING3. If not see |
// <http://www.gnu.org/licenses/>. |
|
#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 (static_cast<bool>(e1)) |
{ |
VERIFY( false ); |
} |
|
// 2 |
std::error_condition e2(std::errc::operation_not_supported); |
if (static_cast<bool>(e2)) |
{ |
VERIFY( true ); |
} |
} |
|
int main() |
{ |
test01(); |
return 0; |
} |
/error_condition/operators/bool_neg.cc
0,0 → 1,32
// { dg-options "-std=gnu++0x" } |
// { dg-do compile } |
|
// Copyright (C) 2008, 2009 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 3, 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 COPYING3. If not see |
// <http://www.gnu.org/licenses/>. |
|
#include <system_error> |
#include <testsuite_hooks.h> |
|
int test01() |
{ |
std::error_condition e; |
int i = e; |
|
return i; |
} |
|
// { dg-error "cannot convert" "" { target *-*-* } 27 } |
/error_condition/operators/equal.cc
0,0 → 1,43
// { dg-options "-std=gnu++0x" } |
|
// Copyright (C) 2008, 2009 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 3, 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 COPYING3. If not see |
// <http://www.gnu.org/licenses/>. |
|
#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::errc::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; |
} |
/error_condition/operators/not_equal.cc
0,0 → 1,43
// { dg-options "-std=gnu++0x" } |
|
// Copyright (C) 2008, 2009 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 3, 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 COPYING3. If not see |
// <http://www.gnu.org/licenses/>. |
|
#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::errc::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; |
} |
/error_code/modifiers/39882.cc
0,0 → 1,61
// { dg-options "-std=gnu++0x" } |
|
// Copyright (C) 2009 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 3, 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 COPYING3. If not see |
// <http://www.gnu.org/licenses/>. |
|
#include <system_error> |
#include <testsuite_hooks.h> |
|
enum my_errc { my_err = 0 }; |
|
class my_error_category_impl |
: public std::error_category |
{ |
public: |
const char* name() const { return ""; } |
std::string message(int) const { return ""; } |
} my_error_category_instance; |
|
std::error_code |
make_error_code(my_errc e) |
{ |
return std::error_code(static_cast<int>(e), |
my_error_category_instance); |
} |
|
namespace std |
{ |
template<> |
struct is_error_code_enum<my_errc> |
: public true_type {}; |
} |
|
// libstdc++/39882 |
void test01() |
{ |
bool test __attribute__((unused)) = true; |
|
std::error_code ec2; |
ec2 = my_err; |
VERIFY( ec2 == make_error_code(my_err) ); |
} |
|
int main() |
{ |
test01(); |
return 0; |
} |
/error_code/cons/39882.cc
0,0 → 1,60
// { dg-options "-std=gnu++0x" } |
|
// Copyright (C) 2009 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 3, 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 COPYING3. If not see |
// <http://www.gnu.org/licenses/>. |
|
#include <system_error> |
#include <testsuite_hooks.h> |
|
enum my_errc { my_err = 0 }; |
|
class my_error_category_impl |
: public std::error_category |
{ |
public: |
const char* name() const { return ""; } |
std::string message(int) const { return ""; } |
} my_error_category_instance; |
|
std::error_code |
make_error_code(my_errc e) |
{ |
return std::error_code(static_cast<int>(e), |
my_error_category_instance); |
} |
|
namespace std |
{ |
template<> |
struct is_error_code_enum<my_errc> |
: public true_type {}; |
} |
|
// libstdc++/39882 |
void test01() |
{ |
bool test __attribute__((unused)) = true; |
|
std::error_code ec1(my_err); |
VERIFY( ec1 == make_error_code(my_err) ); |
} |
|
int main() |
{ |
test01(); |
return 0; |
} |
/error_code/cons/1.cc
0,0 → 1,45
// { dg-options "-std=gnu++0x" } |
// 2007-08-22 Benjamin Kosnik <bkoz@redhat.com> |
|
// Copyright (C) 2007, 2008, 2009 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 3, 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 COPYING3. If not see |
// <http://www.gnu.org/licenses/>. |
|
#include <system_error> |
#include <testsuite_error.h> |
|
int main() |
{ |
bool test __attribute__((unused)) = true; |
|
// 1 |
std::error_code e1; |
VERIFY( e1.value() == 0 ); |
VERIFY( e1.category() == std::system_category() ); |
|
// 2 |
const __gnu_test::test_category cat; |
std::error_code e2(e1.value(), cat); |
VERIFY( e2.value() == e1.value() ); |
VERIFY( e2.category() == cat ); |
|
// 3 |
std::error_code e3(std::make_error_code(std::errc::operation_not_supported)); |
VERIFY( e3.value() == int(std::errc::operation_not_supported) ); |
VERIFY( e3.category() == std::generic_category() ); |
|
return 0; |
} |
/error_code/operators/bool.cc
0,0 → 1,44
// { dg-options "-std=gnu++0x" } |
// 2007-08-22 Benjamin Kosnik <bkoz@redhat.com> |
|
// Copyright (C) 2007, 2009 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 3, 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 COPYING3. If not see |
// <http://www.gnu.org/licenses/>. |
|
#include <system_error> |
#include <testsuite_hooks.h> |
|
// unspecified bool operator positive tests |
int main() |
{ |
bool test __attribute__((unused)) = true; |
|
// 1 |
std::error_code e1; |
if (static_cast<bool>(e1)) |
{ |
VERIFY( false ); |
} |
|
// 2 |
std::error_code e2(std::make_error_code(std::errc::operation_not_supported)); |
if (static_cast<bool>(e2)) |
{ |
VERIFY( true ); |
} |
|
return 0; |
} |
/error_code/operators/bool_neg.cc
0,0 → 1,33
// { dg-options "-std=gnu++0x" } |
// { dg-do compile } |
// 2007-08-22 Benjamin Kosnik <bkoz@redhat.com> |
|
// Copyright (C) 2007, 2009 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 3, 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 COPYING3. If not see |
// <http://www.gnu.org/licenses/>. |
|
#include <system_error> |
#include <testsuite_hooks.h> |
|
int main() |
{ |
std::error_code e; |
int i = e; |
|
return i; |
} |
|
// { dg-error "cannot convert" "" { target *-*-* } 28 } |
/error_code/operators/equal.cc
0,0 → 1,40
// { dg-options "-std=gnu++0x" } |
// 2007-08-22 Benjamin Kosnik <bkoz@redhat.com> |
|
// Copyright (C) 2007, 2008, 2009 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 3, 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 COPYING3. If not see |
// <http://www.gnu.org/licenses/>. |
|
#include <system_error> |
#include <testsuite_error.h> |
|
// unspecified bool operator positive tests |
int main() |
{ |
bool test __attribute__((unused)) = true; |
|
std::error_code e1; |
std::error_code e2(std::make_error_code(std::errc::operation_not_supported)); |
|
VERIFY( e1 == e1 ); |
VERIFY( !(e1 == e2) ); |
|
const __gnu_test::test_category cat; |
std::error_code e3(e2.value(), cat); |
VERIFY( !(e2 == e3) ); |
|
return 0; |
} |
/error_code/operators/not_equal.cc
0,0 → 1,40
// { dg-options "-std=gnu++0x" } |
// 2007-08-22 Benjamin Kosnik <bkoz@redhat.com> |
|
// Copyright (C) 2007, 2008, 2009 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 3, 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 COPYING3. If not see |
// <http://www.gnu.org/licenses/>. |
|
#include <system_error> |
#include <testsuite_error.h> |
|
// unspecified bool operator positive tests |
int main() |
{ |
bool test __attribute__((unused)) = true; |
|
std::error_code e1; |
std::error_code e2(std::make_error_code(std::errc::operation_not_supported)); |
|
VERIFY( !(e1 != e1) ); |
VERIFY( e1 != e2 ); |
|
const __gnu_test::test_category cat; |
std::error_code e3(e2.value(), cat); |
VERIFY( e2 != e3 ); |
|
return 0; |
} |
/error_category/cons/copy_neg.cc
0,0 → 1,38
// { dg-options "-std=gnu++0x" } |
// { dg-do compile } |
// 2007-08-22 Benjamin Kosnik <bkoz@redhat.com> |
|
// Copyright (C) 2007, 2008, 2009 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 3, 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 COPYING3. If not see |
// <http://www.gnu.org/licenses/>. |
|
#include <system_error> |
#include <testsuite_error.h> |
|
int main() |
{ |
bool test __attribute__((unused)) = true; |
|
__gnu_test::test_category c1; |
__gnu_test::test_category c2(c1); |
|
return 0; |
} |
|
// { dg-error "deleted function" "" { target *-*-* } 72 } |
// { dg-error "used here" "" { target *-*-* } 31 } |
// { dg-error "first required here" "" { target *-*-* } 30 } |
// { dg-excess-errors "copy constructor" } |
/error_category/cons/default.cc
0,0 → 1,33
// { dg-options "-std=gnu++0x" } |
// 2007-08-22 Benjamin Kosnik <bkoz@redhat.com> |
|
// Copyright (C) 2007, 2008, 2009 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 3, 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 COPYING3. If not see |
// <http://www.gnu.org/licenses/>. |
|
#include <system_error> |
#include <testsuite_error.h> |
|
int main() |
{ |
bool test __attribute__((unused)) = true; |
|
// 1 |
__gnu_test::test_category c1; |
__gnu_test::test_derived_category c2; |
|
return 0; |
} |
/error_category/operators/equal.cc
0,0 → 1,34
// { dg-options "-std=gnu++0x" } |
// 2007-08-22 Benjamin Kosnik <bkoz@redhat.com> |
|
// Copyright (C) 2007, 2008, 2009 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 3, 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 COPYING3. If not see |
// <http://www.gnu.org/licenses/>. |
|
#include <system_error> |
#include <testsuite_error.h> |
|
int main() |
{ |
bool test __attribute__((unused)) = true; |
|
__gnu_test::test_category c1; |
__gnu_test::test_derived_category c2; |
VERIFY( c1 == c1 ); |
VERIFY( !(c1 == c2) ); |
|
return 0; |
} |
/error_category/operators/not_equal.cc
0,0 → 1,34
// { dg-options "-std=gnu++0x" } |
// 2007-08-22 Benjamin Kosnik <bkoz@redhat.com> |
|
// Copyright (C) 2007, 2008, 2009 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 3, 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 COPYING3. If not see |
// <http://www.gnu.org/licenses/>. |
|
#include <system_error> |
#include <testsuite_error.h> |
|
int main() |
{ |
bool test __attribute__((unused)) = true; |
|
__gnu_test::test_category c1; |
__gnu_test::test_derived_category c2; |
VERIFY( !(c1 != c1) ); |
VERIFY( c1 != c2 ); |
|
return 0; |
} |
/logic_error/cons_virtual_derivation.cc
0,0 → 1,28
// 2007-05-29 Benjamin Kosnik <bkoz@redhat.com> |
|
// Copyright (C) 2007, 2008, 2009 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 3, 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 COPYING3. If not see |
// <http://www.gnu.org/licenses/>. |
|
#include <stdexcept> |
#include <testsuite_api.h> |
|
int main() |
{ |
typedef std::logic_error test_type; |
__gnu_test::diamond_derivation<test_type, false>::test(); |
return 0; |
} |
/logic_error/what-1.cc
0,0 → 1,58
// 2001-02-26 Benjamin Kosnik <bkoz@redhat.com> |
|
// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009 |
// 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 3, 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 COPYING3. If not see |
// <http://www.gnu.org/licenses/>. |
|
// 19.1 Exception classes |
|
#include <string> |
#include <stdexcept> |
#include <cstring> |
#include <testsuite_hooks.h> |
|
// libstdc++/1972 |
void test01() |
{ |
bool test __attribute__((unused)) = true; |
std::string s("lack of sunlight, no water error"); |
|
// 1 |
std::logic_error obj1 = std::logic_error(s); |
|
// 2 |
std::logic_error obj2(s); |
|
VERIFY( std::strcmp(obj1.what(), s.data()) == 0 ); |
VERIFY( std::strcmp(obj2.what(), s.data()) == 0 ); |
} |
|
void test02() |
{ |
bool test __attribute__((unused)) = true; |
std::string s("lack of sunlight error"); |
std::domain_error x(s); |
|
VERIFY( std::strcmp(x.what(), s.data()) == 0 ); |
} |
|
int main(void) |
{ |
test01(); |
test02(); |
return 0; |
} |
/logic_error/what-2.cc
0,0 → 1,50
// 2001-02-26 Benjamin Kosnik <bkoz@redhat.com> |
|
// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009 |
// 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 3, 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 COPYING3. If not see |
// <http://www.gnu.org/licenses/>. |
|
// 19.1 Exception classes |
|
#include <string> |
#include <stdexcept> |
#include <cstring> |
#include <testsuite_hooks.h> |
|
// libstdc++/2089 |
class fuzzy_logic : public std::logic_error |
{ |
public: |
fuzzy_logic() : std::logic_error("whoa") { } |
}; |
|
void test03() |
{ |
bool test __attribute__((unused)) = true; |
try |
{ throw fuzzy_logic(); } |
catch(const fuzzy_logic& obj) |
{ VERIFY( std::strcmp("whoa", obj.what()) == 0 ); } |
catch(...) |
{ VERIFY( false ); } |
} |
|
int main(void) |
{ |
test03(); |
return 0; |
} |
/logic_error/what-big.cc
0,0 → 1,40
// 2007-05-29 Benjamin Kosnik <bkoz@redhat.com> |
|
// Copyright (C) 2007, 2009 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 3, 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 COPYING3. If not see |
// <http://www.gnu.org/licenses/>. |
|
#include <cstring> |
#include <string> |
#include <stdexcept> |
#include <testsuite_hooks.h> |
|
// Can construct and return 10k character error string. |
void test01() |
{ |
typedef std::logic_error test_type; |
|
bool test __attribute__((unused)) = true; |
const std::string xxx(10000, 'x'); |
test_type t(xxx); |
VERIFY( std::strcmp(t.what(), xxx.c_str()) == 0 ); |
} |
|
int main(void) |
{ |
test01(); |
return 0; |
} |
/logic_error/what-3.cc
0,0 → 1,68
// { dg-options "-std=gnu++0x" } |
|
// Copyright (C) 2007, 2009 |
// 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 3, 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 COPYING3. If not see |
// <http://www.gnu.org/licenses/>. |
|
#include <string> |
#include <stdexcept> |
#include <cstring> |
#include <testsuite_hooks.h> |
|
// test copy ctors, assignment operators, and persistence of member string data |
// libstdc++/1972 |
// via Greg Bumgardner <bumgard@roguewave.com> |
void allocate_on_stack(void) |
{ |
const size_t num = 512; |
__extension__ char array[num]; |
for (size_t i = 0; i < num; i++) |
array[i]=0; |
} |
|
void test04() |
{ |
bool test __attribute__((unused)) = true; |
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::logic_error obj1(s); |
|
// block 01 |
{ |
const std::string s2(strlit1); |
std::logic_error obj2(s2); |
obj1 = obj2; |
} |
allocate_on_stack(); |
VERIFY( std::strcmp(strlit1, obj1.what()) == 0 ); |
|
// block 02 |
{ |
const std::string s3(strlit2); |
std::logic_error obj3 = std::logic_error(s3); |
obj1 = obj3; |
} |
allocate_on_stack(); |
VERIFY( std::strcmp(strlit2, obj1.what()) == 0 ); |
} |
|
int main(void) |
{ |
test04(); |
return 0; |
} |
/headers/stdexcept/types_std.cc
0,0 → 1,33
// { dg-do compile } |
|
// Copyright (C) 2007, 2009 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 3, 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 COPYING3. If not see |
// <http://www.gnu.org/licenses/>. |
|
#include <stdexcept> |
|
namespace gnu |
{ |
typedef std::logic_error t1; |
typedef std::domain_error t2; |
typedef std::invalid_argument t3; |
typedef std::length_error t4; |
typedef std::out_of_range t5; |
typedef std::runtime_error t6; |
typedef std::range_error t7; |
typedef std::overflow_error t8; |
typedef std::underflow_error t9; |
} |
/headers/stdexcept/synopsis.cc
0,0 → 1,33
// { dg-do compile } |
|
// Copyright (C) 2007, 2009 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 3, 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 COPYING3. If not see |
// <http://www.gnu.org/licenses/>. |
|
#include <stdexcept> |
|
namespace std { |
class logic_error; |
class domain_error; |
class invalid_argument; |
class length_error; |
class out_of_range; |
class runtime_error; |
class range_error; |
class overflow_error; |
class underflow_error; |
} |
|
/headers/cassert/macros.cc
0,0 → 1,27
// { dg-do compile } |
|
// Copyright (C) 2007, 2009 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 3, 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 COPYING3. If not see |
// <http://www.gnu.org/licenses/>. |
|
#include <cassert> |
|
namespace gnu |
{ |
#ifndef assert |
#error "assert_must_be_a_macro" |
#endif |
} |
/headers/cerrno/macros.cc
0,0 → 1,35
// { dg-do compile } |
|
// Copyright (C) 2007, 2009 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 3, 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 COPYING3. If not see |
// <http://www.gnu.org/licenses/>. |
|
#include <cerrno> |
|
namespace gnu |
{ |
#ifndef EDOM |
#error "EDOM_must_be_a_macro" |
#endif |
|
#ifndef ERANGE |
#error "ERANGE_must_be_a_macro" |
#endif |
|
#ifndef errno |
#error "errno_must_be_a_macro" |
#endif |
} |
/headers/system_error/types_std_c++0x.cc
0,0 → 1,29
// { dg-options "-std=gnu++0x" } |
// { dg-do compile } |
|
// Copyright (C) 2007, 2009 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 3, 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 COPYING3. If not see |
// <http://www.gnu.org/licenses/>. |
|
#include <system_error> |
|
namespace gnu |
{ |
using std::system_error; |
using std::error_code; |
using std::error_category; |
using std::system_category; |
} |
/headers/system_error/std_c++0x_neg.cc
0,0 → 1,25
// { dg-do compile } |
|
// Copyright (C) 2007, 2009 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 3, 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 COPYING3. If not see |
// <http://www.gnu.org/licenses/>. |
|
#include <system_error> // { dg-excess-errors "In file included from" } |
|
// { dg-error "upcoming ISO" "" { target *-*-* } 31 } |
|
|
|
/headers/system_error/errc_std_c++0x.cc
0,0 → 1,157
// { dg-options "-std=gnu++0x" } |
// { dg-do compile } |
|
// Copyright (C) 2007, 2008, 2009 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 3, 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 COPYING3. If not see |
// <http://www.gnu.org/licenses/>. |
|
#include <system_error> |
|
#define TEST_ERRC(x) errc x(errc::x); (void)x |
|
void test01() |
{ |
using std::errc; |
|
TEST_ERRC(address_family_not_supported); |
TEST_ERRC(address_in_use); |
TEST_ERRC(address_not_available); |
TEST_ERRC(already_connected); |
TEST_ERRC(argument_list_too_long); |
TEST_ERRC(argument_out_of_domain); |
TEST_ERRC(bad_address); |
TEST_ERRC(bad_file_descriptor); |
|
#ifdef _GLIBCXX_HAVE_EBADMSG |
TEST_ERRC(bad_message); |
#endif |
|
TEST_ERRC(broken_pipe); |
TEST_ERRC(connection_aborted); |
TEST_ERRC(connection_already_in_progress); |
TEST_ERRC(connection_refused); |
TEST_ERRC(connection_reset); |
TEST_ERRC(cross_device_link); |
TEST_ERRC(destination_address_required); |
TEST_ERRC(device_or_resource_busy); |
TEST_ERRC(directory_not_empty); |
TEST_ERRC(executable_format_error); |
TEST_ERRC(file_exists); |
TEST_ERRC(file_too_large); |
TEST_ERRC(filename_too_long); |
TEST_ERRC(function_not_supported); |
TEST_ERRC(host_unreachable); |
|
#ifdef _GLIBCXX_HAVE_EIDRM |
TEST_ERRC(identifier_removed); |
#endif |
|
TEST_ERRC(illegal_byte_sequence); |
TEST_ERRC(inappropriate_io_control_operation); |
TEST_ERRC(interrupted); |
TEST_ERRC(invalid_argument); |
TEST_ERRC(invalid_seek); |
TEST_ERRC(io_error); |
TEST_ERRC(is_a_directory); |
TEST_ERRC(message_size); |
TEST_ERRC(network_down); |
TEST_ERRC(network_reset); |
TEST_ERRC(network_unreachable); |
TEST_ERRC(no_buffer_space); |
TEST_ERRC(no_child_process); |
|
#ifdef _GLIBCXX_HAVE_ENOLINK |
TEST_ERRC(no_link); |
#endif |
|
TEST_ERRC(no_lock_available); |
|
#ifdef _GLIBCXX_HAVE_ENODATA |
TEST_ERRC(no_message_available); |
#endif |
|
TEST_ERRC(no_message); |
TEST_ERRC(no_protocol_option); |
TEST_ERRC(no_space_on_device); |
|
#ifdef _GLIBCXX_HAVE_ENOSR |
TEST_ERRC(no_stream_resources); |
#endif |
|
TEST_ERRC(no_such_device_or_address); |
TEST_ERRC(no_such_device); |
TEST_ERRC(no_such_file_or_directory); |
TEST_ERRC(no_such_process); |
TEST_ERRC(not_a_directory); |
TEST_ERRC(not_a_socket); |
|
#ifdef _GLIBCXX_HAVE_ENOSTR |
TEST_ERRC(not_a_stream); |
#endif |
|
TEST_ERRC(not_connected); |
TEST_ERRC(not_enough_memory); |
TEST_ERRC(not_supported); |
|
#ifdef _GLIBCXX_HAVE_ECANCELED |
TEST_ERRC(operation_canceled); |
#endif |
|
TEST_ERRC(operation_in_progress); |
TEST_ERRC(operation_not_permitted); |
TEST_ERRC(operation_not_supported); |
TEST_ERRC(operation_would_block); |
|
#ifdef _GLIBCXX_HAVE_EOWNERDEAD |
TEST_ERRC(owner_dead); |
#endif |
|
TEST_ERRC(permission_denied); |
|
#ifdef _GLIBCXX_HAVE_EPROTO |
TEST_ERRC(protocol_error); |
#endif |
|
TEST_ERRC(protocol_not_supported); |
TEST_ERRC(read_only_file_system); |
TEST_ERRC(resource_deadlock_would_occur); |
TEST_ERRC(resource_unavailable_try_again); |
TEST_ERRC(result_out_of_range); |
|
#ifdef _GLIBCXX_HAVE_ENOTRECOVERABLE |
TEST_ERRC(state_not_recoverable); |
#endif |
|
#ifdef _GLIBCXX_HAVE_ETIME |
TEST_ERRC(stream_timeout); |
#endif |
|
#ifdef _GLIBCXX_HAVE_ETXTBSY |
TEST_ERRC(text_file_busy); |
#endif |
|
TEST_ERRC(timed_out); |
TEST_ERRC(too_many_files_open_in_system); |
TEST_ERRC(too_many_files_open); |
TEST_ERRC(too_many_links); |
TEST_ERRC(too_many_symbolic_link_levels); |
|
#ifdef _GLIBCXX_HAVE_EOVERFLOW |
TEST_ERRC(value_too_large); |
#endif |
|
TEST_ERRC(wrong_protocol_type); |
} |
/headers/system_error/34538.cc
0,0 → 1,28
// { dg-options "-std=gnu++0x" } |
// { dg-do compile } |
|
// Copyright (C) 2007, 2009 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 3, 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 COPYING3. If not see |
// <http://www.gnu.org/licenses/>. |
|
#include <stdexcept> |
#include <system_error> |
|
// libstdc++/34538 |
int main() |
{ |
throw std::invalid_argument("foo"); |
} |
/runtime_error/cons_virtual_derivation.cc
0,0 → 1,28
// 2007-05-29 Benjamin Kosnik <bkoz@redhat.com> |
|
// Copyright (C) 2007, 2008, 2009 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 3, 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 COPYING3. If not see |
// <http://www.gnu.org/licenses/>. |
|
#include <stdexcept> |
#include <testsuite_api.h> |
|
int main() |
{ |
typedef std::runtime_error test_type; |
__gnu_test::diamond_derivation<test_type, false>::test(); |
return 0; |
} |
/runtime_error/what-1.cc
0,0 → 1,58
// 2001-02-26 Benjamin Kosnik <bkoz@redhat.com> |
|
// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009 |
// 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 3, 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 COPYING3. If not see |
// <http://www.gnu.org/licenses/>. |
|
// 19.1 Exception classes |
|
#include <string> |
#include <stdexcept> |
#include <cstring> |
#include <testsuite_hooks.h> |
|
// libstdc++/1972 |
void test01() |
{ |
bool test __attribute__((unused)) = true; |
std::string s("lack of sunlight, no water error"); |
|
// 1 |
std::runtime_error obj1 = std::runtime_error(s); |
|
// 2 |
std::runtime_error obj2(s); |
|
VERIFY( std::strcmp(obj1.what(), s.data()) == 0 ); |
VERIFY( std::strcmp(obj2.what(), s.data()) == 0 ); |
} |
|
void test02() |
{ |
bool test __attribute__((unused)) = true; |
std::string s("lack of sunlight error"); |
std::range_error x(s); |
|
VERIFY( std::strcmp(x.what(), s.data()) == 0 ); |
} |
|
int main(void) |
{ |
test01(); |
test02(); |
return 0; |
} |
/runtime_error/what-2.cc
0,0 → 1,50
// 2001-02-26 Benjamin Kosnik <bkoz@redhat.com> |
|
// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009 |
// 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 3, 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 COPYING3. If not see |
// <http://www.gnu.org/licenses/>. |
|
// 19.1 Exception classes |
|
#include <string> |
#include <stdexcept> |
#include <cstring> |
#include <testsuite_hooks.h> |
|
// libstdc++/2089 |
class fuzzy_logic : public std::runtime_error |
{ |
public: |
fuzzy_logic() : std::runtime_error("whoa") { } |
}; |
|
void test03() |
{ |
bool test __attribute__((unused)) = true; |
try |
{ throw fuzzy_logic(); } |
catch(const fuzzy_logic& obj) |
{ VERIFY( std::strcmp("whoa", obj.what()) == 0 ); } |
catch(...) |
{ VERIFY( false ); } |
} |
|
int main(void) |
{ |
test03(); |
return 0; |
} |
/runtime_error/what-big.cc
0,0 → 1,40
// 2007-05-29 Benjamin Kosnik <bkoz@redhat.com> |
|
// Copyright (C) 2007, 2009 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 3, 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 COPYING3. If not see |
// <http://www.gnu.org/licenses/>. |
|
#include <cstring> |
#include <string> |
#include <stdexcept> |
#include <testsuite_hooks.h> |
|
// Can construct and return 10k character error string. |
void test01() |
{ |
typedef std::runtime_error test_type; |
|
bool test __attribute__((unused)) = true; |
const std::string xxx(10000, 'x'); |
test_type t(xxx); |
VERIFY( std::strcmp(t.what(), xxx.c_str()) == 0 ); |
} |
|
int main(void) |
{ |
test01(); |
return 0; |
} |
/runtime_error/what-3.cc
0,0 → 1,70
// 2001-02-26 Benjamin Kosnik <bkoz@redhat.com> |
|
// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009 |
// 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 3, 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 COPYING3. If not see |
// <http://www.gnu.org/licenses/>. |
|
// 19.1 Exception classes |
|
#include <string> |
#include <stdexcept> |
#include <cstring> |
#include <testsuite_hooks.h> |
|
// test copy ctors, assignment operators, and persistence of member string data |
// libstdc++/1972 |
// via Greg Bumgardner <bumgard@roguewave.com> |
void allocate_on_stack(void) |
{ |
const size_t num = 512; |
__extension__ char array[num]; |
for (size_t i = 0; i < num; i++) |
array[i]=0; |
} |
|
void test04() |
{ |
bool test __attribute__((unused)) = true; |
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::runtime_error obj1(s); |
|
// block 01 |
{ |
const std::string s2(strlit1); |
std::runtime_error obj2(s2); |
obj1 = obj2; |
} |
allocate_on_stack(); |
VERIFY( std::strcmp(strlit1, obj1.what()) == 0 ); |
|
// block 02 |
{ |
const std::string s3(strlit2); |
std::runtime_error obj3 = std::runtime_error(s3); |
obj1 = obj3; |
} |
allocate_on_stack(); |
VERIFY( std::strcmp(strlit2, obj1.what()) == 0 ); |
} |
|
int main(void) |
{ |
test04(); |
return 0; |
} |
/system_error/39880.cc
0,0 → 1,29
// { dg-options "-std=gnu++0x" } |
// { dg-do compile } |
|
// Copyright (C) 2009 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 3, 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 COPYING3. If not see |
// <http://www.gnu.org/licenses/>. |
|
#include <system_error> |
|
// libstdc++/39880 |
void test01() |
{ |
std::error_code ec; |
if (ec == std::errc::not_supported) |
{ } |
} |
/system_error/cons_virtual_derivation.cc
0,0 → 1,29
// { dg-options "-std=gnu++0x" } |
// 2007-05-29 Benjamin Kosnik <bkoz@redhat.com> |
|
// Copyright (C) 2007, 2008, 2009 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 3, 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 COPYING3. If not see |
// <http://www.gnu.org/licenses/>. |
|
#include <system_error> |
#include <testsuite_api.h> |
|
int main() |
{ |
typedef std::system_error test_type; |
__gnu_test::diamond_derivation<test_type, true>::test(); |
return 0; |
} |
/system_error/cons-1.cc
0,0 → 1,47
// { dg-options "-std=gnu++0x" } |
// 2007-06-05 Benjamin Kosnik <bkoz@redhat.com> |
|
// Copyright (C) 2007, 2008, 2009 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 3, 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 COPYING3. If not see |
// <http://www.gnu.org/licenses/>. |
|
#include <cstring> |
#include <system_error> |
#include <testsuite_hooks.h> |
|
int main() |
{ |
bool test __attribute__((unused)) = true; |
const std::string s("too late: boulangerie out of pain au raisin"); |
const std::error_code |
e(std::make_error_code(std::errc::operation_not_supported)); |
|
// 1 |
{ |
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(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 ); |
} |
|
return 0; |
} |
/system_error/what-1.cc
0,0 → 1,60
// { dg-options "-std=gnu++0x" } |
|
// Copyright (C) 2007, 2008, 2009 |
// 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 3, 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 COPYING3. If not see |
// <http://www.gnu.org/licenses/>. |
|
// 19.1 Exception classes |
|
#include <string> |
#include <system_error> |
#include <cstring> |
#include <testsuite_hooks.h> |
|
using namespace std; |
|
// libstdc++/1972 |
void test01() |
{ |
bool test __attribute__((unused)) = true; |
string s("lack of sunlight, no water error"); |
|
// 1 |
system_error obj1 = system_error(error_code(), s); |
|
// 2 |
system_error obj2(error_code(), s); |
|
VERIFY( strcmp(obj1.what(), s.data()) == 0 ); |
VERIFY( strcmp(obj2.what(), s.data()) == 0 ); |
} |
|
void test02() |
{ |
bool test __attribute__((unused)) = true; |
string s("lack of sunlight error"); |
system_error x(error_code(), s); |
|
VERIFY( strcmp(x.what(), s.data()) == 0 ); |
} |
|
int main(void) |
{ |
test01(); |
test02(); |
return 0; |
} |
/system_error/what-2.cc
0,0 → 1,50
// { dg-options "-std=gnu++0x" } |
|
// Copyright (C) 2007, 2008, 2009 |
// 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 3, 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 COPYING3. If not see |
// <http://www.gnu.org/licenses/>. |
|
// 19.1 Exception classes |
|
#include <string> |
#include <system_error> |
#include <cstring> |
#include <testsuite_hooks.h> |
|
// libstdc++/2089 |
class fuzzy_logic : public std::system_error |
{ |
public: |
fuzzy_logic() : std::system_error(std::error_code(), "whoa") { } |
}; |
|
void test03() |
{ |
bool test __attribute__((unused)) = true; |
try |
{ throw fuzzy_logic(); } |
catch(const fuzzy_logic& obj) |
{ VERIFY( std::strcmp("whoa", obj.what()) == 0 ); } |
catch(...) |
{ VERIFY( false ); } |
} |
|
int main(void) |
{ |
test03(); |
return 0; |
} |
/system_error/what-big.cc
0,0 → 1,40
// { dg-options "-std=gnu++0x" } |
|
// Copyright (C) 2007, 2008, 2009 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 3, 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 COPYING3. If not see |
// <http://www.gnu.org/licenses/>. |
|
#include <cstring> |
#include <string> |
#include <system_error> |
#include <testsuite_hooks.h> |
|
// Can construct and return 10k character error string. |
void test01() |
{ |
typedef std::system_error test_type; |
|
bool test __attribute__((unused)) = true; |
const std::string xxx(10000, 'x'); |
test_type t(std::error_code(), xxx); |
VERIFY( std::strcmp(t.what(), xxx.c_str()) == 0 ); |
} |
|
int main(void) |
{ |
test01(); |
return 0; |
} |
/system_error/what-3.cc
0,0 → 1,68
// { dg-options "-std=gnu++0x" } |
|
// Copyright (C) 2007, 2009 |
// 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 3, 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 COPYING3. If not see |
// <http://www.gnu.org/licenses/>. |
|
#include <string> |
#include <system_error> |
#include <cstring> |
#include <testsuite_hooks.h> |
|
// test copy ctors, assignment operators, and persistence of member string data |
// libstdc++/1972 |
// via Greg Bumgardner <bumgard@roguewave.com> |
void allocate_on_stack(void) |
{ |
const size_t num = 512; |
__extension__ char array[num]; |
for (size_t i = 0; i < num; i++) |
array[i]=0; |
} |
|
void test04() |
{ |
bool test __attribute__((unused)) = true; |
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(std::error_code(), s); |
|
// block 01 |
{ |
const std::string s2(strlit1); |
std::system_error obj2(std::error_code(), s2); |
obj1 = obj2; |
} |
allocate_on_stack(); |
VERIFY( std::strcmp(strlit1, obj1.what()) == 0 ); |
|
// block 02 |
{ |
const std::string s3(strlit2); |
std::system_error obj3 = std::system_error(std::error_code(), s3); |
obj1 = obj3; |
} |
allocate_on_stack(); |
VERIFY( std::strcmp(strlit2, obj1.what()) == 0 ); |
} |
|
int main(void) |
{ |
test04(); |
return 0; |
} |
/system_error/what-4.cc
0,0 → 1,45
// { dg-options "-std=gnu++0x" } |
|
// Copyright (C) 2007, 2008, 2009 |
// 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 3, 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 COPYING3. If not see |
// <http://www.gnu.org/licenses/>. |
|
// 19.1 Exception classes |
|
#include <cstring> |
#include <string> |
#include <system_error> |
#include <testsuite_hooks.h> |
|
// Make sure each invocation of what() doesn't grow the message. |
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(std::make_error_code(std::errc::invalid_argument), s); |
std::string s1(obj.what()); |
std::string s2(obj.what()); |
VERIFY( s1 == s2 ); |
} |
|
int main(void) |
{ |
test01(); |
return 0; |
} |