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.dg/] [try-catch-1.m] - Rev 478

Go to most recent revision | Compare with Previous | Blame | View Log

/* Test if the compiler accepts @throw / @try..@catch..@finally syntax.  */
/* Developed by Ziemowit Laski <zlaski@apple.com>.  */
/* { dg-options "-fobjc-exceptions" } */
/* { dg-do compile } */
 
#include "../objc-obj-c++-shared/Object1.h"
#include <stdio.h>
#include <setjmp.h>
 
@interface Frob: Object
@end
 
@implementation Frob: Object
@end
 
static int exc_control = 0;
 
int proc() {
  if(exc_control) {
    printf ("Throwing (%d)... ", exc_control);
    @throw [Frob new];
  }
  return 1;
}
 
int foo()
{
        @try {
                return proc();
        }
        @catch (Frob* ex) {
		if(exc_control > 1) {
		  printf("Rethrowing (%d)... ", exc_control);
		  @throw;
		}
		return 0;
        }
	@finally {
		printf("In @finally block (%d)... ", exc_control);
	}
}
 

Go to most recent revision | Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

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