OSDN Git Service

2011-10-18 Janus Weil <janus@gcc.gnu.org>
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / objc.dg / image-info.m
1 /* Check if the '-freplace-objc-classes' option causes the
2    __OBJC,__image_info section to be emitted.  This is only
3    usable on MacOS X 10.3 and later. */
4 /* Contributed by Ziemowit Laski <zlaski@apple.com>.  */
5
6 /* { dg-do compile { target { *-*-darwin* } } } */
7 /* { dg-skip-if "NeXT-only" { *-*-* } { "-fgnu-runtime" } { "" } } */
8 /* { dg-options "-freplace-objc-classes" } */
9
10 #include <objc/objc.h>
11 #include <objc/Object.h>
12
13 extern void abort(void);
14 #define CHECK_IF(expr) if(!(expr)) abort();
15
16 @interface Object (TEST_SUITE_C1)
17 - init;
18 @end
19 @implementation Object (TEST_SUITE_C1)
20 - init {return self;}
21 @end
22
23 @interface Base: Object {
24 @public
25   int a;
26   float b;
27   char c;
28 }
29 - init;
30 @end
31
32 @implementation Base
33 - init {
34   [super init];
35   a = 123;
36   b = 1.23;
37   c = 'c';
38   return self;
39 }
40 @end
41
42 /* { dg-final { scan-assembler "\t.section __OBJC, __image_info.*\n\t.align.*\nL_OBJC_ImageInfo.*:\n\t.long\t0\n\t.long\t1"  { target { *-*-darwin* && { ! lp64 } } } } } */
43 /* { dg-final { scan-assembler "\t.section __DATA, __objc_imageinfo.*\n\t.align.*\nL_OBJC_ImageInfo.*:\n\t.long\t0\n\t.long\t17" { target { *-*-darwin* && { lp64 } } } } } */