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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [objc.dg/] [proto-hier-2.m] - Rev 867

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

/* Test protocol warning.  */
/* Contributed by Devang Patel <dpatel@apple.com>.  */
/* { dg-do compile } */
 
typedef struct objc_object { struct objc_class *class_pointer; } *id;
 
@protocol Bar
@end
 
id <Bar> Foo_Bar () { }
 
typedef struct
{
        int i;
} MyStruct;
 
@interface Foo
{
  id _mainData;
  MyStruct *_anotherData;
}
 
-(id) mainDataSource;
-(id) anotherDataSource;
-(id) my_method: (int) i;
@end
 
@implementation Foo
-(id) anotherDataSource
{
        return (id)_anotherData;
}
 
-(id) mainDataSource
{
        return _mainData;
}
 
-(id) my_method: (int) i
{
  id one = [self anotherDataSource];
 
  i = i - 1;
  // Do not issue warning about my_method not found in protocol
  return [(one ? [self mainDataSource] : one) my_method:i];
}
 
@end
 
 

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.