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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [objc.dg/] [category-1.m] - Blame information for rev 704

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 704 jeremybenn
/* Test class methods inside categories.  */
2
/* Author: Ziemowit Laski <zlaski@apple.com>.  */
3
 
4
/* { dg-do run } */
5
/* { dg-xfail-run-if "need OBJC2 ABI" { *-*-darwin* && { lp64 &&  { ! objc2 } } } { "-fnext-runtime" } { "" } } */
6
 
7
#include "../objc-obj-c++-shared/TestsuiteObject.m"
8
extern int strcmp(const char *s1, const char *s2);
9
extern void abort(void);
10
 
11
#define CHECK_IF(expr) if(!(expr)) abort()
12
 
13
@interface MyObject: TestsuiteObject
14
+ (Class)whatever1;
15
@end
16
 
17
@implementation MyObject
18
+ (Class)whatever1 { return [super superclass]; }
19
@end
20
 
21
@interface MyObject (ThisWontCompile)
22
+(Class)whatever2;
23
@end
24
 
25
@implementation MyObject (ThisWontCompile)
26
+(Class)whatever2 { return [super superclass]; }
27
@end
28
 
29
int main (int argc, const char * argv[])
30
{
31
  Class w1 = [MyObject whatever1];
32
  Class w2 = [MyObject whatever2];
33
 
34
  CHECK_IF(!strcmp( object_getClassName( w1 ), "TestsuiteObject"));
35
  CHECK_IF(!strcmp( object_getClassName( w2 ), "TestsuiteObject"));
36
 
37
  return 0;
38
}
39
 

powered by: WebSVN 2.1.0

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