OSDN Git Service

In gcc/objc/:
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / objc.dg / ivar-problem-1.m
1 /* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, November 2010.  */
2 /* { dg-do compile } */
3
4 /* This test checks what happens if there are 16 instance variables.
5    In that case, the class was not created correctly.  In this testcase,
6    we have two classes, one with 15 variables and one with 16.  Older
7    GCCs would generate a bogus warning for the second class but not 
8    for the first one.  */
9
10 #include <stdlib.h>
11 #include <objc/objc.h>
12
13 @interface MyRootClass1
14 {
15   Class isa;
16   int v2;
17   int v3;
18   int v4;
19   int v5;
20   int v6;
21   int v7;
22   int v8;
23   int v9;
24   int v10;
25   int v11;
26   int v12;
27   int v13;
28   int v14;
29   int v15;
30 }
31 - (id) init;
32 @end
33
34 @implementation MyRootClass1
35 - (id) init { return self; }
36 @end
37
38
39 @interface MyRootClass2
40 {
41   Class isa;
42   int v2;
43   int v3;
44   int v4;
45   int v5;
46   int v6;
47   int v7;
48   int v8;
49   int v9;
50   int v10;
51   int v11;
52   int v12;
53   int v13;
54   int v14;
55   int v15;
56   /* Adding the 16th variable used to cause bogus warnings to be
57      generated.  */
58   int v16;
59 }
60 - (id) init;
61 @end
62
63 @implementation MyRootClass2
64 - (id) init { return self; } /* This should not generate a bogus warning.  */
65 @end