aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorAndrew Pinski <pinskia@physics.uc.edu>2005-08-15 01:13:39 +0000
committerAndrew Pinski <pinskia@gcc.gnu.org>2005-08-14 18:13:39 -0700
commit309b0e4232a331e7293d6086cef1573201a10507 (patch)
tree69b75427b3af439759b9e8caa9a6beb79970e16c /gcc
parente252987e8ee6a5340b5f54da516d9263656a132d (diff)
downloadgcc-309b0e4232a331e7293d6086cef1573201a10507.zip
gcc-309b0e4232a331e7293d6086cef1573201a10507.tar.gz
gcc-309b0e4232a331e7293d6086cef1573201a10507.tar.bz2
finally-1.m: Check that the catch and finally are being called.
2005-08-14 Andrew Pinski <pinskia@physics.uc.edu> * execute/exceptions/finally-1.m: Check that the catch and finally are being called. Also add a "return 0;" at the end of main. From-SVN: r103098
Diffstat (limited to 'gcc')
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/objc/execute/exceptions/finally-1.m60
2 files changed, 42 insertions, 23 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index cc45585..65f56b9 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2005-08-14 Andrew Pinski <pinskia@physics.uc.edu>
+
+ * execute/exceptions/finally-1.m: Check that the catch and finally are
+ being called. Also add a "return 0;" at the end of main.
+
2005-08-14 Paul Thomas <pault@gcc.gnu.org>
PR fortran/21432.
diff --git a/gcc/testsuite/objc/execute/exceptions/finally-1.m b/gcc/testsuite/objc/execute/exceptions/finally-1.m
index 9d4c396..5f32de2 100644
--- a/gcc/testsuite/objc/execute/exceptions/finally-1.m
+++ b/gcc/testsuite/objc/execute/exceptions/finally-1.m
@@ -1,45 +1,59 @@
#include <objc/Object.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+static int made_try = 0;
int
thrower_try_body()
{
- printf("Thrower try body\n");
- return (0);
+ made_try++;
+ return (0);
}
+static int made_finally = 0;
+
int
finally_body()
{
- printf("Finally body\n");
- return (0);
+ made_finally++;
+ return (0);
}
int
thrower()
{
- @try
- {
- thrower_try_body();
- @throw [Object new];
- }
- @finally
- {
- finally_body();
- } // <----- program aborts here.
- return 0;
+ @try
+ {
+ thrower_try_body();
+ @throw [Object new];
+ }
+ @finally
+ {
+ finally_body();
+ }
+ return 0;
}
+static int made_catch = 0;
int
main(int ac, char *av[])
{
- @try
- {
- thrower();
- }
- @catch (id exc)
- {
- printf("Got exception of class %s\n", [[exc class] name]);
- [exc free];
- }
+ @try
+ {
+ thrower();
+ }
+ @catch (id exc)
+ {
+ made_catch++;
+ [exc free];
+ }
+ if (made_try != 1)
+ abort ();
+ if (made_finally != 1)
+ abort ();
+ if (made_catch != 1)
+ abort ();
+ return 0;
}