diff options
Diffstat (limited to 'gcc/testsuite/g++.old-deja/g++.eh')
25 files changed, 0 insertions, 754 deletions
diff --git a/gcc/testsuite/g++.old-deja/g++.eh/cleanup1.C b/gcc/testsuite/g++.old-deja/g++.eh/cleanup1.C deleted file mode 100644 index 6faea269c9d..00000000000 --- a/gcc/testsuite/g++.old-deja/g++.eh/cleanup1.C +++ /dev/null @@ -1,34 +0,0 @@ -// Bug: obj gets destroyed twice because the fixups for the return are -// inside its cleanup region. - -extern "C" int printf (const char *, ...); - -int d; - -struct myExc { }; - -struct myExcRaiser { - ~myExcRaiser() { throw myExc(); } -}; - -struct stackObj { - ~stackObj() { ++d; printf ("stackObj::~stackObj()\n"); }; -}; - -int test() -{ - myExcRaiser rais; - stackObj obj; - return 0; -} - -int main() -{ - try { - test(); - } - catch (myExc &) { - return d != 1; - } - return 1; -} diff --git a/gcc/testsuite/g++.old-deja/g++.eh/ctor1.C b/gcc/testsuite/g++.old-deja/g++.eh/ctor1.C deleted file mode 100644 index 9874131a44d..00000000000 --- a/gcc/testsuite/g++.old-deja/g++.eh/ctor1.C +++ /dev/null @@ -1,15 +0,0 @@ -struct A -{ - A(); - A(A&); // ERROR - referenced below -}; - -int -main () -{ - try - { - throw A(); // ERROR - can't copy - } - catch (...) { } -} diff --git a/gcc/testsuite/g++.old-deja/g++.eh/flow1.C b/gcc/testsuite/g++.old-deja/g++.eh/flow1.C deleted file mode 100644 index 024670cf347..00000000000 --- a/gcc/testsuite/g++.old-deja/g++.eh/flow1.C +++ /dev/null @@ -1,21 +0,0 @@ -#include <stdio.h> - -int bar () -{ - throw 100; -} - -int main () -{ - int i = 0; // this gets deleted after flow analysis - try - { - i = bar (); - } - catch (...) - { - } - - printf ("i = %d\n", i); - return i; -} diff --git a/gcc/testsuite/g++.old-deja/g++.eh/new1.C b/gcc/testsuite/g++.old-deja/g++.eh/new1.C deleted file mode 100644 index 1671dbbe7de..00000000000 --- a/gcc/testsuite/g++.old-deja/g++.eh/new1.C +++ /dev/null @@ -1,44 +0,0 @@ -// Test that a throw in foo destroys the A, but does not free the memory. - -#include <stddef.h> -#include <stdlib.h> -#include <new.h> - -struct A { - A(); - ~A(); -}; - -struct B { - B (A); -}; - -void foo (B*); - -int newed, created; - -int main () -{ - try { - foo (new B (A ())); - } catch (...) { } - - return !(newed && !created); -} - -A::A() { created = 1; } -A::~A() { created = 0; } -B::B(A) { } -void foo (B*) { throw 1; } - -void* operator new (size_t size) throw (std::bad_alloc) -{ - ++newed; - return (void *) malloc (size); -} - -void operator delete (void *p) throw () -{ - --newed; - free (p); -} diff --git a/gcc/testsuite/g++.old-deja/g++.eh/new2.C b/gcc/testsuite/g++.old-deja/g++.eh/new2.C deleted file mode 100644 index ddc8ba82e58..00000000000 --- a/gcc/testsuite/g++.old-deja/g++.eh/new2.C +++ /dev/null @@ -1,45 +0,0 @@ -// Test that a throw in B's constructor destroys the A and frees the memory. - -#include <stddef.h> -#include <stdlib.h> -#include <new.h> - -struct A { - A(); - ~A(); -}; - -struct B { - B (A); -}; - -void foo (B*); - -int newed, created; - -int main () -{ - newed = 0; // The libraries might call new before main starts. - try { - foo (new B (A ())); - } catch (...) { } - - return !(!newed && !created); -} - -A::A() { created = 1; } -A::~A() { created = 0; } -B::B(A) { throw 1; } -void foo (B*) { } - -void* operator new (size_t size) throw (std::bad_alloc) -{ - ++newed; - return (void *) malloc (size); -} - -void operator delete (void *p) throw () -{ - --newed; - free (p); -} diff --git a/gcc/testsuite/g++.old-deja/g++.eh/pdel1.C b/gcc/testsuite/g++.old-deja/g++.eh/pdel1.C deleted file mode 100644 index b8e553c0e2f..00000000000 --- a/gcc/testsuite/g++.old-deja/g++.eh/pdel1.C +++ /dev/null @@ -1,22 +0,0 @@ -// Test for calling placement delete. - -#include <new> -#include <stddef.h> - -int r = 1; - -struct A { - A() { throw 1; } - void operator delete (void *p, int, int) { r = 0; ::operator delete (p); } -}; - -void * operator new (size_t size, int, int) { return operator new (size); } - -int main () -{ - try { - A* ap = new (1, 5) A; - } catch (...) { } - - return r; -} diff --git a/gcc/testsuite/g++.old-deja/g++.eh/pdel2.C b/gcc/testsuite/g++.old-deja/g++.eh/pdel2.C deleted file mode 100644 index 12efcd386cf..00000000000 --- a/gcc/testsuite/g++.old-deja/g++.eh/pdel2.C +++ /dev/null @@ -1,22 +0,0 @@ -// Test for not calling mismatched placement delete. - -#include <new> -#include <stddef.h> - -int r = 0; - -struct A { - A() { throw 1; } - void operator delete (void *p, int, long) { r = 1; ::operator delete (p); } -}; - -void * operator new (size_t size, int, int) { return operator new (size); } - -int main () -{ - try { - A* ap = new (1, 5) A; - } catch (...) { } - - return r; -} diff --git a/gcc/testsuite/g++.old-deja/g++.eh/ptr1.C b/gcc/testsuite/g++.old-deja/g++.eh/ptr1.C deleted file mode 100644 index 9101e9e3010..00000000000 --- a/gcc/testsuite/g++.old-deja/g++.eh/ptr1.C +++ /dev/null @@ -1,22 +0,0 @@ -// Bug: catching pointers by reference doesn't work right. - -extern "C" int printf (const char *, ...); - -struct E { - int x; - E(int i) { x = i; }; -}; - -int main() -{ - try { - E *p = new E(5); - throw p; - } - - catch (E *&e) { - printf ("address of e is 0x%lx\n", (long)e); - return !(long(e) != 5 && e->x == 5); - } - return 2; -} diff --git a/gcc/testsuite/g++.old-deja/g++.eh/rethrow1.C b/gcc/testsuite/g++.old-deja/g++.eh/rethrow1.C deleted file mode 100644 index ef4dcb4f19d..00000000000 --- a/gcc/testsuite/g++.old-deja/g++.eh/rethrow1.C +++ /dev/null @@ -1,45 +0,0 @@ -// Testcase for proper handling of rethrow. - -#include <stdio.h> - -int c, d; - -struct A -{ - int i; - A () { i = ++c; printf ("A() %d\n", i); } - A (const A&) { i = ++c; printf ("A(const A&) %d\n", i); } - ~A() { printf ("~A() %d\n", i); ++d; } -}; - -int -main () -{ - try - { - try - { - printf ("Throwing 1...\n"); - throw A(); - } - catch (A) - { - try - { - printf ("Throwing 2...\n"); - throw A(); - } - catch (A) - { - printf ("Throwing 3...\n"); - throw; - } - } - } - catch (A) - { - printf ("Caught.\n"); - } - printf ("c == %d, d == %d\n", c, d); - return c != d; -} diff --git a/gcc/testsuite/g++.old-deja/g++.eh/rethrow2.C b/gcc/testsuite/g++.old-deja/g++.eh/rethrow2.C deleted file mode 100644 index 2d2583b7219..00000000000 --- a/gcc/testsuite/g++.old-deja/g++.eh/rethrow2.C +++ /dev/null @@ -1,45 +0,0 @@ -// Testcase for proper handling of rethrow. - -#include <stdio.h> - -int c, d; - -struct A -{ - int i; - A () { i = ++c; printf ("A() %d\n", i); } - A (const A&) { i = ++c; printf ("A(const A&) %d\n", i); } - ~A() { printf ("~A() %d\n", i); ++d; } -}; - -int -main () -{ - try - { - try - { - printf ("Throwing 1...\n"); - throw A(); - } - catch (A) - { - try - { - printf ("Throwing 2...\n"); - throw; - } - catch (A) - { - printf ("Throwing 3...\n"); - throw; - } - } - } - catch (A) - { - printf ("Caught.\n"); - } - printf ("c == %d, d == %d\n", c, d); - return c != d; -} diff --git a/gcc/testsuite/g++.old-deja/g++.eh/rethrow3.C b/gcc/testsuite/g++.old-deja/g++.eh/rethrow3.C deleted file mode 100644 index 5da2081b1b9..00000000000 --- a/gcc/testsuite/g++.old-deja/g++.eh/rethrow3.C +++ /dev/null @@ -1,38 +0,0 @@ -#include <stdio.h> -#include <exception> - -static void -eh_terminate () -{ - printf ("CALLING TERMINATE\n"); - exit (1); -} - -void -eh_test (int level) -{ - try - { - if (level < 2) - eh_test (level + 1); - else - { - printf ("%d: Throwing\n", level); - throw (level); - } - } - catch (int &x) - { - printf ("%d: Got level %d\n", - level, x); - - if (level > 0) - throw; - } -} - -int main () -{ - std::set_terminate (&eh_terminate); - eh_test (0); -} diff --git a/gcc/testsuite/g++.old-deja/g++.eh/rethrow4.C b/gcc/testsuite/g++.old-deja/g++.eh/rethrow4.C deleted file mode 100644 index c5dcd2314a3..00000000000 --- a/gcc/testsuite/g++.old-deja/g++.eh/rethrow4.C +++ /dev/null @@ -1,45 +0,0 @@ -// Testcase for proper handling of rethrow. - -#include <stdio.h> - -int c, d; - -struct A -{ - int i; - A () { i = ++c; printf ("A() %d\n", i); } - A (const A&) { i = ++c; printf ("A(const A&) %d\n", i); } - ~A() { printf ("~A() %d\n", i); ++d; } -}; - -int -main () -{ - try - { - try - { - printf ("Throwing 1...\n"); - throw A(); - } - catch (A) - { - try - { - printf ("Throwing 2...\n"); - throw; - } - catch (A) - { - printf ("Throwing 3...\n"); - throw A(); - } - } - } - catch (A) - { - printf ("Caught.\n"); - } - printf ("c == %d, d == %d\n", c, d); - return c != d; -} diff --git a/gcc/testsuite/g++.old-deja/g++.eh/rethrow5.C b/gcc/testsuite/g++.old-deja/g++.eh/rethrow5.C deleted file mode 100644 index f137d1841cd..00000000000 --- a/gcc/testsuite/g++.old-deja/g++.eh/rethrow5.C +++ /dev/null @@ -1,44 +0,0 @@ -// Testcase for proper handling of rethrow. - -#include <stdio.h> - -int c, d; - -struct A -{ - int i; - A () { i = ++c; printf ("A() %d\n", i); } - A (const A&) { i = ++c; printf ("A(const A&) %d\n", i); } - ~A() { printf ("~A() %d\n", i); ++d; } -}; - -int -main () -{ - try - { - try - { - printf ("Throwing 1...\n"); - throw A(); - } - catch (A) - { - try - { - printf ("Throwing 2...\n"); - throw; - } - catch (A) - { - printf ("Falling out...\n"); - } - } - } - catch (A) - { - printf ("Caught.\n"); - } - printf ("c == %d, d == %d\n", c, d); - return c != d; -} diff --git a/gcc/testsuite/g++.old-deja/g++.eh/spec1.C b/gcc/testsuite/g++.old-deja/g++.eh/spec1.C deleted file mode 100644 index 044af8cdb9b..00000000000 --- a/gcc/testsuite/g++.old-deja/g++.eh/spec1.C +++ /dev/null @@ -1,38 +0,0 @@ -// Testing exception specifications. -// Test 1: the original exception succeeds. - -#include <stdlib.h> -#include <exception> - -void my_term () { exit (1); } -void my_unexp () { throw 42; } - -void -f () throw (char, int, std::bad_exception) -{ - throw 'a'; -} - -int main () -{ - std::set_terminate (my_term); - std::set_unexpected (my_unexp); - - try - { - f (); - } - catch (char) - { - return 0; - } - catch (int) - { - return 3; - } - catch (std::bad_exception) - { - return 4; - } - return 5; -} diff --git a/gcc/testsuite/g++.old-deja/g++.eh/spec2.C b/gcc/testsuite/g++.old-deja/g++.eh/spec2.C deleted file mode 100644 index d0269b3a4be..00000000000 --- a/gcc/testsuite/g++.old-deja/g++.eh/spec2.C +++ /dev/null @@ -1,38 +0,0 @@ -// Testing exception specifications. -// Test 2: the second throw succeeds. - -#include <stdlib.h> -#include <exception> - -void my_term () { exit (1); } -void my_unexp () { throw 42; } - -void -f () throw (int, std::bad_exception) -{ - throw 'a'; -} - -int main () -{ - std::set_terminate (my_term); - std::set_unexpected (my_unexp); - - try - { - f (); - } - catch (char) - { - return 2; - } - catch (int) - { - return 0; - } - catch (std::bad_exception) - { - return 4; - } - return 5; -} diff --git a/gcc/testsuite/g++.old-deja/g++.eh/spec3.C b/gcc/testsuite/g++.old-deja/g++.eh/spec3.C deleted file mode 100644 index 57b29d48908..00000000000 --- a/gcc/testsuite/g++.old-deja/g++.eh/spec3.C +++ /dev/null @@ -1,38 +0,0 @@ -// Testing exception specifications. -// Test 3: the bad_exception throw succeeds. - -#include <stdlib.h> -#include <exception> - -void my_term () { exit (1); } -void my_unexp () { throw 42; } - -void -f () throw (std::bad_exception) -{ - throw 'a'; -} - -int main () -{ - std::set_terminate (my_term); - std::set_unexpected (my_unexp); - - try - { - f (); - } - catch (char) - { - return 2; - } - catch (int) - { - return 3; - } - catch (std::bad_exception) - { - return 0; - } - return 5; -} diff --git a/gcc/testsuite/g++.old-deja/g++.eh/spec4.C b/gcc/testsuite/g++.old-deja/g++.eh/spec4.C deleted file mode 100644 index a92f7f06469..00000000000 --- a/gcc/testsuite/g++.old-deja/g++.eh/spec4.C +++ /dev/null @@ -1,38 +0,0 @@ -// Testing exception specifications. -// Test 4: all throws fail, call terminate. - -#include <stdlib.h> -#include <exception> - -void my_term () { exit (0); } -void my_unexp () { throw 42; } - -void -f () throw (short) -{ - throw 'a'; -} - -int main () -{ - std::set_terminate (my_term); - std::set_unexpected (my_unexp); - - try - { - f (); - } - catch (char) - { - return 2; - } - catch (int) - { - return 3; - } - catch (std::bad_exception) - { - return 4; - } - return 5; -} diff --git a/gcc/testsuite/g++.old-deja/g++.eh/spec5.C b/gcc/testsuite/g++.old-deja/g++.eh/spec5.C deleted file mode 100644 index 56154f973ee..00000000000 --- a/gcc/testsuite/g++.old-deja/g++.eh/spec5.C +++ /dev/null @@ -1,3 +0,0 @@ -// Build don't link: - -extern void *f(unsigned int k) throw(); diff --git a/gcc/testsuite/g++.old-deja/g++.eh/spec6.C b/gcc/testsuite/g++.old-deja/g++.eh/spec6.C deleted file mode 100644 index e9e3e770012..00000000000 --- a/gcc/testsuite/g++.old-deja/g++.eh/spec6.C +++ /dev/null @@ -1,46 +0,0 @@ -// Build don't link: - -// Copyright (C) 1999 Free Software Foundation, Inc. -// Contributed by Nathan Sidwell 19 Jan 1999 <nathan@acm.org> - -// Determine that throw specifiers are checked correctly. - -// [except.spec] 1, a type in an exception specifier shall not be incomplete, -// or pointer or ref to incomplete -struct X; // ERROR - forward declaration - XFAIL -void fn1() throw(X); // ERROR - incomplete type - XFAIL -void fn2() throw(X *); // ERROR - incomplete type - XFAIL -void fn3() throw(X &); // ERROR - incomplete type - XFAIL -void fn4() throw(void); // ERROR - incomplete type - XFAIL -// except for cv pointer to void -void fn5() throw(void *); - -// [except.spec] 2, exception specifiers must be the same set of types (but -// can be reordered) -void fn() throw(int, char); // gets bogus error - XFAIL -void fn() throw(char, int){} // gets bogus error - ordering is irrelevant - XFAIL - -// [except.spec] 3, virtual function overriders shall throw a subset of the -// overridden function -struct E {}; -struct F : public E {}; -struct A -{ - virtual void foo() throw(); - virtual void baz() throw(double, int); - virtual void bar(); - virtual void qux() throw(E); - virtual void quux() throw(F); -}; - -struct B : A -{ - virtual void foo() throw(int); // ERROR - not in base function - XFAIL - virtual void baz() throw(double); - virtual void bar(int) throw(int); - virtual void qux() throw(F); - virtual void quux() throw(E); // ERROR - not in base function - XFAIL -}; - -// [except.spec] 5, types shall not be defined in exception specifiers -void fn6() throw(struct Z {}); // ERROR - types shall not be defined - XFAIL diff --git a/gcc/testsuite/g++.old-deja/g++.eh/throw1.C b/gcc/testsuite/g++.old-deja/g++.eh/throw1.C deleted file mode 100644 index 49a7d1e68fd..00000000000 --- a/gcc/testsuite/g++.old-deja/g++.eh/throw1.C +++ /dev/null @@ -1,12 +0,0 @@ -// Build don't link: - -void athrow(const int & e) throw(int) -{ - throw e; -} - -int main(void) -{ - athrow(int()); - return 0; -} diff --git a/gcc/testsuite/g++.old-deja/g++.eh/throw2.C b/gcc/testsuite/g++.old-deja/g++.eh/throw2.C deleted file mode 100644 index fbf0cec9c35..00000000000 --- a/gcc/testsuite/g++.old-deja/g++.eh/throw2.C +++ /dev/null @@ -1,16 +0,0 @@ -// Build don't link: - -// Submitted by Sebastian Ritterbusch <uabp@rz.uni-karlsruhe.de> - -#define ANY int // a class with a public constructor - -void athrow(const ANY & e) throw(ANY) -{ - throw e; // gets bogus error - discarding const -} - -int main(void) -{ - athrow(ANY()); - return 0; -} diff --git a/gcc/testsuite/g++.old-deja/g++.eh/tmpl1.C b/gcc/testsuite/g++.old-deja/g++.eh/tmpl1.C deleted file mode 100644 index cdbd6e1feeb..00000000000 --- a/gcc/testsuite/g++.old-deja/g++.eh/tmpl1.C +++ /dev/null @@ -1,15 +0,0 @@ -template <class T> -void f() throw (T) -{ - throw 7; -} - - -int main() -{ - try { - f<int>(); - } catch (...) { - return 0; - } -} diff --git a/gcc/testsuite/g++.old-deja/g++.eh/tmpl2.C b/gcc/testsuite/g++.old-deja/g++.eh/tmpl2.C deleted file mode 100644 index af3dc7bc12a..00000000000 --- a/gcc/testsuite/g++.old-deja/g++.eh/tmpl2.C +++ /dev/null @@ -1,33 +0,0 @@ -// Build don't link: -// Special g++ flags: -O -// crash test - XFAIL i*86-*-linux* - -// Posted by H. J. Lu <hjl@lucon.org> - -template<class T> -class FixSeq -{ -public: - void append(const T&); -}; -class foo -{ -public: - void setupIR(); -}; -typedef FixSeq<foo *> bar; -extern void dummy (foo *); -void * -foobar (bar &x, foo *p) -{ - try - { - p -> setupIR(); - } - catch(...) - { - dummy (p); - } - x.append(p); - return p; -} diff --git a/gcc/testsuite/g++.old-deja/g++.eh/tmpl3.C b/gcc/testsuite/g++.old-deja/g++.eh/tmpl3.C deleted file mode 100644 index 521315e17e2..00000000000 --- a/gcc/testsuite/g++.old-deja/g++.eh/tmpl3.C +++ /dev/null @@ -1,11 +0,0 @@ -// Build don't link: - -// Posted by Trevor Taylor <ttaylor@powerup.com.au> - -template<class T> struct A { - void X() throw(T); -}; - -template<class T> -inline void A<T>::X() -throw(T) { } diff --git a/gcc/testsuite/g++.old-deja/g++.eh/unwind1.C b/gcc/testsuite/g++.old-deja/g++.eh/unwind1.C deleted file mode 100644 index 617b355a6c6..00000000000 --- a/gcc/testsuite/g++.old-deja/g++.eh/unwind1.C +++ /dev/null @@ -1,24 +0,0 @@ -// Test that unwinding properly restores SP. -// Contributed by Jason Merrill <jason@cygnus.com> - -int f (int i) -{ - throw i; -} - -int main () -{ - void *sp1 = __builtin_alloca (0); - - try - { - f (0); - } - catch (int) - { - } - - void *sp2 = __builtin_alloca (0); - - return (sp1 != sp2); -} |