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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [obj-c++.dg/] [try-catch-1.mm] - Diff between revs 154 and 816

Only display areas with differences | Details | Blame | View Log

Rev 154 Rev 816
/* Test if the compiler accepts @throw / @try..@catch..@finally syntax.  */
/* Test if the compiler accepts @throw / @try..@catch..@finally syntax.  */
/* Developed by Ziemowit Laski .  */
/* Developed by Ziemowit Laski .  */
/* { dg-options "-fobjc-exceptions" } */
/* { dg-options "-fobjc-exceptions" } */
/* { dg-do compile } */
/* { dg-do compile } */
#include 
#include 
#include 
#include 
#include 
#include 
@interface Frob: Object
@interface Frob: Object
@end
@end
@implementation Frob: Object
@implementation Frob: Object
@end
@end
static int exc_control = 0;
static int exc_control = 0;
int proc() {
int proc() {
  if(exc_control) {
  if(exc_control) {
    printf ("Throwing (%d)... ", exc_control);
    printf ("Throwing (%d)... ", exc_control);
    @throw [Frob new];
    @throw [Frob new];
  }
  }
  return 1;
  return 1;
}
}
int foo()
int foo()
{
{
  @try {
  @try {
    return proc();
    return proc();
  }
  }
  @catch (Frob* ex) {
  @catch (Frob* ex) {
    if(exc_control > 1) {
    if(exc_control > 1) {
      printf("Rethrowing (%d)... ", exc_control);
      printf("Rethrowing (%d)... ", exc_control);
      @throw;
      @throw;
    }
    }
    return 0;
    return 0;
  }
  }
  @finally {
  @finally {
    printf("In @finally block (%d)... ", exc_control);
    printf("In @finally block (%d)... ", exc_control);
  }
  }
}
}
 
 

powered by: WebSVN 2.1.0

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