Commit 309b0e42 by Andrew Pinski Committed by Andrew Pinski

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
parent e252987e
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> 2005-08-14 Paul Thomas <pault@gcc.gnu.org>
PR fortran/21432. PR fortran/21432.
......
#include <objc/Object.h> #include <objc/Object.h>
#include <stdio.h>
#include <stdlib.h>
static int made_try = 0;
int int
thrower_try_body() thrower_try_body()
{ {
printf("Thrower try body\n"); made_try++;
return (0); return (0);
} }
static int made_finally = 0;
int int
finally_body() finally_body()
{ {
printf("Finally body\n"); made_finally++;
return (0); return (0);
} }
...@@ -25,10 +31,11 @@ thrower() ...@@ -25,10 +31,11 @@ thrower()
@finally @finally
{ {
finally_body(); finally_body();
} // <----- program aborts here. }
return 0; return 0;
} }
static int made_catch = 0;
int int
main(int ac, char *av[]) main(int ac, char *av[])
...@@ -39,7 +46,14 @@ main(int ac, char *av[]) ...@@ -39,7 +46,14 @@ main(int ac, char *av[])
} }
@catch (id exc) @catch (id exc)
{ {
printf("Got exception of class %s\n", [[exc class] name]); made_catch++;
[exc free]; [exc free];
} }
if (made_try != 1)
abort ();
if (made_finally != 1)
abort ();
if (made_catch != 1)
abort ();
return 0;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment