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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.2.2/] [gcc/] [testsuite/] [objc.dg/] [category-1.m] - Blame information for rev 154

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
/* Test class methods inside categories.  */
2
/* Author: Ziemowit Laski <zlaski@apple.com>.  */
3
/* { dg-options "-lobjc" } */
4
/* { dg-do run } */
5
 
6
#include <objc/Object.h>
7
 
8
#ifdef __NEXT_RUNTIME__
9
#define SUPERCLASS superclass
10
#else
11
#define SUPERCLASS superClass
12
#endif
13
 
14
extern int strcmp(const char *s1, const char *s2);
15
extern void abort(void);
16
#define CHECK_IF(expr) if(!(expr)) abort()
17
 
18
@interface MyObject: Object
19
+ (Class)whatever1;
20
@end
21
 
22
@implementation MyObject
23
+ (Class)whatever1 { return [super SUPERCLASS]; }
24
@end
25
 
26
@interface MyObject (ThisWontCompile)
27
+(Class)whatever2;
28
@end
29
 
30
@implementation MyObject (ThisWontCompile)
31
+(Class)whatever2 { return [super SUPERCLASS]; }
32
@end
33
 
34
int main (int argc, const char * argv[])
35
{
36
  Class w1 = [MyObject whatever1];
37
  Class w2 = [MyObject whatever2];
38
 
39
  CHECK_IF(!strcmp(w1->name, "Object"));
40
  CHECK_IF(!strcmp(w2->name, "Object"));
41
  return 0;
42
}
43
 

powered by: WebSVN 2.1.0

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