testsuite: skip attr-retain-?.c on AIX
[official-gcc.git] / gcc / testsuite / objc.dg / objc-gc-4.m
blob8102a5a532fc6d5e23c18c9e754c620bc7f247c0
1 /* Test looking up fields in superclasses in the context of write-barriers
2    (where component references get rewritten).  */
3 /* Contributed by Ziemowit Laski <zlaski@apple.com>  */
5 /* { dg-do compile } */
6 /* { dg-skip-if "GC API is an error from Darwin16." { *-*-darwin1[6-9]* *-*-darwin2[0-9]* } { "-fnext-runtime" } { "" } } */
7 /* { dg-options "-fobjc-gc" } */
8 /* { dg-prune-output "cc1obj: warning: '-fobjc-gc' is ignored for '-fgnu-runtime'" } */
10 #include "../objc-obj-c++-shared/TestsuiteObject.h"
11 #include <objc/objc.h>
13 @class MyWindow;
15 @interface MyDocument : TestsuiteObject {
16     MyWindow *_window;
18 @end
20 @interface MyFileDocument : MyDocument {
21      struct {
22         unsigned int autoClose:1;
23         unsigned int openForUI:1;
24         unsigned int isClosing:1;
25         unsigned int needsDiskCheck:1;
26         unsigned int isWritable:1;
27         unsigned int representsFileOnDisk:1;
28         unsigned int RESERVED:26;
29     } _fdFlags;
31 @end
33 @interface MyTextFileDocument : MyFileDocument {
34     TestsuiteObject *_textStorage;
35     struct __tfdFlags {
36         unsigned int immutable:1;
37         unsigned int lineEnding:2;
38         unsigned int isClosing:1;
39         unsigned int settingsAreSet:1;
40         unsigned int usesTabs:1;
41         unsigned int isUTF8WithBOM:1;
42         unsigned int wrapsLines:1;
43         unsigned int usingDefaultLanguage:1;
44         unsigned int RESERVED:23;
45     } _tfdFlags;
46     int _tabWidth;
47     int _indentWidth;
49 @end
51 @interface MyRTFFileDocument : MyTextFileDocument
52 - (BOOL)readFromFile:(const char *)fileName ofType:(const char *)type;
53 @end
55 @implementation MyRTFFileDocument
56 - (BOOL)readFromFile:(const char *)fileName ofType:(const char *)type {
57         if (_textStorage && fileName) {
58             [_textStorage free];
59             return YES;
60         } else if (type) {
61             _textStorage = [MyRTFFileDocument new];
62             return NO;
63         }
64    return (fileName && type);
66 @end