diff options
Diffstat (limited to 'libstdc++-v3/testsuite/18_support')
9 files changed, 114 insertions, 22 deletions
diff --git a/libstdc++-v3/testsuite/18_support/bad_exception/23591_thread-1.c b/libstdc++-v3/testsuite/18_support/bad_exception/23591_thread-1.c index 9e621c3f786..f6c623043cd 100644 --- a/libstdc++-v3/testsuite/18_support/bad_exception/23591_thread-1.c +++ b/libstdc++-v3/testsuite/18_support/bad_exception/23591_thread-1.c @@ -1,7 +1,7 @@ // { dg-require-sharedlib "" } // { dg-options "-g -O2 -pthread -ldl -x c" { target *-*-linux* } } -// Copyright (C) 2005, 2009 Free Software Foundation, Inc. +// Copyright (C) 2005, 2009, 2010 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 @@ -32,20 +32,20 @@ static void* run(void* arg) void (*cb)(); lib = dlopen("./testsuite_shared.so", RTLD_NOW); - if (lib == NULL) + if (!lib) { printf("dlopen failed: %s\n", strerror(errno)); - return NULL; + return 0; } cb = (function_type) dlsym(lib, "try_throw_exception"); - if (cb == NULL) + if (!cb) { printf("dlsym failed: %s\n", strerror(errno)); - return NULL; + return 0; } cb(); dlclose(lib); - return NULL; + return 0; } // libstdc++/23591 @@ -53,9 +53,9 @@ int main(void) { pthread_t pt; - if (pthread_create(&pt, NULL, &run, NULL) != 0) + if (pthread_create(&pt, 0, &run, 0) != 0) return 1; - if (pthread_join(pt, NULL) != 0) + if (pthread_join(pt, 0) != 0) return 1; return 0; diff --git a/libstdc++-v3/testsuite/18_support/exception/38732.cc b/libstdc++-v3/testsuite/18_support/exception/38732.cc index 43cf5b891ba..7c70f3a17b3 100644 --- a/libstdc++-v3/testsuite/18_support/exception/38732.cc +++ b/libstdc++-v3/testsuite/18_support/exception/38732.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2009 Free Software Foundation, Inc. +// Copyright (C) 2009, 2010 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 @@ -17,7 +17,6 @@ #include <typeinfo> #include <exception> -#include <cstddef> #include "unwind.h" #include <testsuite_hooks.h> @@ -67,21 +66,21 @@ void test01 () throw 0; } catch(...) { __cxa_exception *exc = __cxa_get_globals()->caughtExceptions; - VERIFY ( exc != NULL ); + VERIFY ( exc != 0 ); VERIFY ( typeid(int) == *exc->exceptionType ); } try { throw 0LL; } catch(...) { __cxa_exception *exc = __cxa_get_globals()->caughtExceptions; - VERIFY ( exc != NULL ); + VERIFY ( exc != 0 ); VERIFY ( typeid(long long int) == *exc->exceptionType ); } try { throw 0.0; } catch(...) { __cxa_exception *exc = __cxa_get_globals()->caughtExceptions; - VERIFY ( exc != NULL ); + VERIFY ( exc != 0 ); VERIFY ( typeid(double) == *exc->exceptionType ); } } diff --git a/libstdc++-v3/testsuite/18_support/exception_ptr/make_exception_ptr.cc b/libstdc++-v3/testsuite/18_support/exception_ptr/make_exception_ptr.cc index bc16ccdfa1b..4a7283f67de 100644 --- a/libstdc++-v3/testsuite/18_support/exception_ptr/make_exception_ptr.cc +++ b/libstdc++-v3/testsuite/18_support/exception_ptr/make_exception_ptr.cc @@ -21,7 +21,7 @@ #include <exception> #include <testsuite_hooks.h> -bool test01() +void test01() { bool test __attribute__((unused)) = true; diff --git a/libstdc++-v3/testsuite/18_support/exception_ptr/requirements.cc b/libstdc++-v3/testsuite/18_support/exception_ptr/requirements.cc new file mode 100644 index 00000000000..36e6375d9a9 --- /dev/null +++ b/libstdc++-v3/testsuite/18_support/exception_ptr/requirements.cc @@ -0,0 +1,60 @@ +// { dg-options "-std=gnu++0x" } +// { dg-require-atomic-builtins "" } + +// Copyright (C) 2010 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 <exception> +#include <testsuite_hooks.h> + +// test NullablePointer requirements +void test01() +{ + std::exception_ptr p1; // DefaultConstructible + std::exception_ptr p2(p1); // CopyConstructible + p1 = p2; // CopyAssignable + VERIFY( p1 == p2 ); // EqualityComparable + VERIFY( !bool(p1) ); // contextually convertible to bool + swap(p1, p2); // Swappable + + // Table 39 expressions + std::exception_ptr p3 = nullptr; + std::exception_ptr p4(nullptr); + VERIFY( std::exception_ptr() == nullptr ); + p4 = nullptr; + VERIFY( p4 == nullptr ); + VERIFY( nullptr == p4 ); + VERIFY( (p4 != nullptr) == !(p4 == nullptr) ); + VERIFY( (nullptr != p4) == !(p4 == nullptr) ); + + std::exception_ptr p5{}; // value initialized ... + VERIFY( p5 == nullptr ); // ... is equivalent to null +} + +// additional exception_ptr requirements +void test02() +{ + std::exception_ptr p1; + VERIFY( p1 == nullptr ); +} + +int main() +{ + test01(); + test02(); + return 0; +} diff --git a/libstdc++-v3/testsuite/18_support/exception_ptr/requirements_neg.cc b/libstdc++-v3/testsuite/18_support/exception_ptr/requirements_neg.cc new file mode 100644 index 00000000000..b897b506dfe --- /dev/null +++ b/libstdc++-v3/testsuite/18_support/exception_ptr/requirements_neg.cc @@ -0,0 +1,33 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } +// { dg-require-atomic-builtins "" } + +// Copyright (C) 2010 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 <exception> + +// test implicit conversions +void test01() +{ + std::exception_ptr p; + + int __attribute__((unused)) i = p; // { dg-error "cannot convert" } + bool __attribute__((unused)) b = p; // { dg-error "cannot convert" } + void* __attribute__((unused)) v = p; // { dg-error "cannot convert" } +} + diff --git a/libstdc++-v3/testsuite/18_support/headers/cstdbool/std_c++0x_neg.cc b/libstdc++-v3/testsuite/18_support/headers/cstdbool/std_c++0x_neg.cc index e764fbb4a99..264e1a3692b 100644 --- a/libstdc++-v3/testsuite/18_support/headers/cstdbool/std_c++0x_neg.cc +++ b/libstdc++-v3/testsuite/18_support/headers/cstdbool/std_c++0x_neg.cc @@ -18,7 +18,7 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. -#include <cstdbool> // { dg-excess-errors "In file included from" } +#include <cstdbool> // { dg-error "upcoming ISO" "" { target *-*-* } 31 } diff --git a/libstdc++-v3/testsuite/18_support/headers/cstdint/std_c++0x_neg.cc b/libstdc++-v3/testsuite/18_support/headers/cstdint/std_c++0x_neg.cc index 569dc678223..fdbb1dae515 100644 --- a/libstdc++-v3/testsuite/18_support/headers/cstdint/std_c++0x_neg.cc +++ b/libstdc++-v3/testsuite/18_support/headers/cstdint/std_c++0x_neg.cc @@ -18,7 +18,7 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. -#include <cstdint> // { dg-excess-errors "In file included from" } +#include <cstdint> // { dg-error "upcoming ISO" "" { target *-*-* } 31 } diff --git a/libstdc++-v3/testsuite/18_support/new_delete_placement.cc b/libstdc++-v3/testsuite/18_support/new_delete_placement.cc index ef845d3a391..866a89b79cb 100644 --- a/libstdc++-v3/testsuite/18_support/new_delete_placement.cc +++ b/libstdc++-v3/testsuite/18_support/new_delete_placement.cc @@ -1,6 +1,6 @@ // 2002-07-24 Benjamin Kosnik -// Copyright (C) 2002, 2004, 2009 Free Software Foundation +// Copyright (C) 2002, 2004, 2009, 2010 Free Software Foundation // // 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 @@ -27,7 +27,7 @@ void test01() { void* pc = new char; void* pa = new char[10]; - void* tmp = NULL; + void* tmp = 0; operator delete(pc, tmp); operator delete[](pa, tmp); } diff --git a/libstdc++-v3/testsuite/18_support/pthread_guard.cc b/libstdc++-v3/testsuite/18_support/pthread_guard.cc index 965328ebcba..5389316bab0 100644 --- a/libstdc++-v3/testsuite/18_support/pthread_guard.cc +++ b/libstdc++-v3/testsuite/18_support/pthread_guard.cc @@ -1,5 +1,5 @@ // -// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc. +// Copyright (C) 2007, 2008, 2009, 2010 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 @@ -40,7 +40,7 @@ void* do_something (void *arg) { static int bar __attribute__((unused)) = get_bar (); - return NULL; + return 0; } int @@ -48,10 +48,10 @@ get_foo (void) { pthread_t new_thread; - if (pthread_create (&new_thread, NULL, do_something, NULL) != 0) + if (pthread_create (&new_thread, 0, do_something, 0) != 0) std::abort (); - if (pthread_join (new_thread, NULL) != 0) + if (pthread_join (new_thread, 0) != 0) std::abort (); return 1; |