OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [objc/] [execute/] [exceptions/] [handler-1.m] - Blame information for rev 307

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 307 jeremybenn
/* Test custom exception handlers  */
2
/* Author: David Ayers */
3
 
4
#ifdef __NEXT_RUNTIME__
5
/* This test only runs for the GNU runtime. */
6
 
7
int main(void)
8
{
9
  return 0;
10
}
11
 
12
#else
13
 
14
#include <objc/objc-api.h>
15
#include <objc/Object.h>
16
#include <stdio.h>
17
#include <stdlib.h>
18
 
19
static unsigned int handlerExpected = 0;
20
 
21
void
22
my_exception_handler(id excp)
23
{
24
  /* Returning from the handler would abort.  */
25
  if (handlerExpected)
26
    exit(0);
27
 
28
  abort();
29
}
30
 
31
int
32
main(int argc, char *argv[])
33
{
34
  _objc_unexpected_exception = my_exception_handler;
35
 
36
  @try
37
    {
38
      @throw [Object new];
39
    }
40
  @catch (id exc)
41
    {
42
      handlerExpected = 1;
43
    }
44
 
45
  @throw [Object new];
46
  abort();
47
  return 0;
48
}
49
 
50
 
51
#endif

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.