1 /* Additional testing for the NeXT runtime. Encoding in -m64 mode */
3 /* { dg-do run { target *-*-darwin* } } */
4 /* { dg-require-effective-target lp64 } */
5 /* { dg-options "-Wno-deprecated-declarations" } */
6 /* { dg-skip-if "" { *-*-* } { "-fgnu-runtime" } { "" } } */
7 /* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */
8 /* { dg-additional-sources "../objc-obj-c++-shared/Object1.m" } */
10 #include "../objc-obj-c++-shared/Object1.h"
11 #include "../objc-obj-c++-shared/next-mapping.h"
15 #define CHECK_IF(E) if (!(E)) abort ()
17 @class NSDictionary, NSFont, NSError, _NSATSTypesetterGuts, NSString, NSMenu, NSArray;
19 typedef unsigned char UInt8;
20 typedef const signed long OSStatus;
21 typedef unsigned long CFIndex;
22 typedef unsigned int UInt32;
23 typedef UInt32 FourCharCode;
24 typedef FourCharCode OSType;
29 typedef struct FSRef FSRef;
31 typedef struct _NSPoint {
36 typedef struct _NSSize {
41 typedef struct _NSRect {
46 typedef struct _NSRange {
47 unsigned int location;
51 typedef const char *NXAtom;
54 NSDictionary *_attributes;
56 CFIndex _characterLength;
57 CFIndex _nominalGlyphLocation;
59 float _defaultLineHeight;
60 float _defaultBaselineOffset;
61 float _horizExpansion;
63 NSRect _attachmentBBox;
65 unsigned long ull, *ullp;
68 const struct objc_object *a2;
71 const struct objc_selector *b2;
75 const char *const str4;
77 unsigned int _isAttachmentRun:1;
78 unsigned int _hasPositionalStake:1;
79 unsigned int _isDefaultFace:1;
80 unsigned int _hasCombiningMarks:1;
81 unsigned int _isScreenFont:1;
82 unsigned int _reserved:27;
84 } NSATSGlyphStorageRun;
86 typedef struct __CFSet *CFMutableSetRef;
87 typedef const struct __CTLine * CTLineRef;
88 typedef const struct __NSAppleEventManagerSuspension* NSAppleEventManagerSuspensionID;
90 struct ComponentInstanceRecord {
93 typedef struct ComponentInstanceRecord ComponentInstanceRecord;
94 typedef ComponentInstanceRecord *ComponentInstance;
96 typedef NSString *(*NSErrorUserInfoFormatterFunc)(id objToBeDisplayed, NSError *err, char modifier);
98 NSErrorUserInfoFormatterFunc formatterFunc;
99 NSString *userInfoKey;
100 unsigned int parameterMask;
101 } NSErrorUserInfoFormatter;
103 typedef Object MyObj;
104 typedef Object *MyPtr;
106 @interface Foo: Object {
107 NSATSGlyphStorageRun r;
109 - (NSError *)_errorWithOSStatus:(OSStatus)inOSStatus ref1:(const FSRef *)inRef1 ref2:(const struct FSRef *)inRef2
110 reading:(BOOL)inReadingNotWriting;
111 - (const NSATSGlyphStorageRun *)_attributeRunForCharacterAtIndex:(const CFIndex)charIndex;
112 - (const _NSATSTypesetterGuts *)_getATSTypesetterGuts:(const struct objc_selector *)sel;
113 - (void)resumeWithSuspensionID:(NSAppleEventManagerSuspensionID)suspensionID and:(const CFIndex *)status;
114 - (const id)anotherMeth:(const SEL)sel and:(const Foo *)foo and:(const struct objc_object *)obj;
115 - (id)str1:(const char *)str1 str2:(char *)str2 str3:(char *const)str3 str4:(const char *const)str4;
116 - (oneway void)foo1:(Foo *)foo1 foo2:(const Foo *)foo2 foo3:(Foo *const)foo3 foo4:(const Foo *const)foo4;
117 - (in const char *)sel1:(const SEL)sel1 id1:(const id)id1;
118 - (inout id)obj1:(const MyPtr)obj1 obj2:(Object *const)obj2 obj3:(MyObj *const)obj3;
119 + (ComponentInstance)_defaultScriptingComponent;
120 - (NSString *)_formatCocoaErrorString:(NSString *)formatString parameters:(const char *)parameters
121 applicableFormatters:(NSErrorUserInfoFormatter **)formatters count:(int)numFormatters;
122 - (NSErrorUserInfoFormatter *)formatter_func:(id)obj run:(const NSATSGlyphStorageRun **)run;
123 - (BOOL)_forgetWord:(bycopy in NSString *)word inDictionary:(bycopy in NSString *)language;
124 - (void)_registerServicesMenu:(NSMenu *)servicesMenu withSendTypes:(const NXAtom *)sendTypes
125 andReturnTypes:(const NXAtom *)returnTypes addToList:(BOOL)addToList;
126 + (CFMutableSetRef *)_proxySharePointer;
127 - (NSRange)_checkGrammarInString:(in NSString *)stringToCheck language:(bycopy in NSString *)language details:(bycopy out NSArray **)details;
128 - (bool)_resolvePositionalStakeGlyphsForLineFragment:(CTLineRef)line lineFragmentRect:(NSRect)lineFragmentRect
129 minPosition:(float)minPosition maxPosition:(float)maxPosition maxLineFragmentWidth:(float)maxLineFragmentWidth
130 breakHint:(CFIndex *)charIndex;
131 + (BOOL)findVoiceByIdentifier:(NSString *)identifier returningCreator:(OSType *)returnedCreator returningID:(OSType *)returnedID;
137 - (NSError *)_errorWithOSStatus:(OSStatus)inOSStatus ref1:(const FSRef *)inRef1 ref2:(const struct FSRef *)inRef2
138 reading:(BOOL)inReadingNotWriting {
139 return (NSError *)self;
141 - (const NSATSGlyphStorageRun *)_attributeRunForCharacterAtIndex:(CFIndex)charIndex {
142 return (const NSATSGlyphStorageRun *)self;
144 - (const _NSATSTypesetterGuts *)_getATSTypesetterGuts:(const struct objc_selector *)sel {
145 return (const _NSATSTypesetterGuts *)self;
147 - (void)resumeWithSuspensionID:(NSAppleEventManagerSuspensionID)suspensionID and:(const CFIndex *)status {
149 - (const id)anotherMeth:(const SEL)sel and:(const Foo *)foo and:(const struct objc_object *)obj {
150 return (const id)self;
152 - (id)str1:(const char *)str1 str2:(char *)str2 str3:(char *const)str3 str4:(const char *const)str4 {
155 - (oneway void)foo1:(Foo *)foo1 foo2:(const Foo *)foo2 foo3:(Foo *const)foo3 foo4:(const Foo *const)foo4 {
157 - (in const char *)sel1:(const SEL)sel1 id1:(const id)id1 {
160 - (inout id)obj1:(const MyPtr)obj1 obj2:(Object *const)obj2 obj3:(MyObj *const)obj3 {
163 + (ComponentInstance)_defaultScriptingComponent {
164 return (ComponentInstance)0;
166 - (NSString *)_formatCocoaErrorString:(NSString *)formatString parameters:(const char *)parameters
167 applicableFormatters:(NSErrorUserInfoFormatter **)formatters count:(int)numFormatters {
168 return (NSString *)self;
170 - (NSErrorUserInfoFormatter *)formatter_func:(id)obj run:(const NSATSGlyphStorageRun **)run {
171 return (NSErrorUserInfoFormatter *)0;
173 - (BOOL)_forgetWord:(bycopy in NSString *)word inDictionary:(bycopy in NSString *)language {
176 - (void)_registerServicesMenu:(NSMenu *)servicesMenu withSendTypes:(const NXAtom *)sendTypes
177 andReturnTypes:(const NXAtom *)returnTypes addToList:(BOOL)addToList {
179 + (CFMutableSetRef *)_proxySharePointer {
180 return (CFMutableSetRef *)0;
182 - (NSRange)_checkGrammarInString:(in NSString *)stringToCheck language:(bycopy in NSString *)language details:(bycopy out NSArray **)details {
185 - (bool)_resolvePositionalStakeGlyphsForLineFragment:(CTLineRef)line lineFragmentRect:(NSRect)lineFragmentRect
186 minPosition:(float)minPosition maxPosition:(float)maxPosition maxLineFragmentWidth:(float)maxLineFragmentWidth
187 breakHint:(CFIndex *)charIndex {
190 + (BOOL)findVoiceByIdentifier:(NSString *)identifier returningCreator:(OSType *)returnedCreator returningID:(OSType *)returnedID {
196 Class fooClass = objc_getClass ("Foo");
198 struct objc_ivar_list *ivars;
199 struct objc_ivar *ivar;
201 meth = class_getInstanceMethod (fooClass, @selector(_errorWithOSStatus:ref1:ref2:reading:));
202 CHECK_IF (!strcmp (meth->method_types, "@44@0:8q16r^{FSRef=[80C]}24r^{FSRef=[80C]}32c40"));
204 meth = class_getInstanceMethod (fooClass, @selector(_attributeRunForCharacterAtIndex:));
205 CHECK_IF (!strcmp (meth->method_types, "r^{?=@@QQ^Qffff{_NSRect={_NSPoint=ff}{_NSSize=ff}}q^qQ^Q@@@:::****{?=b1b1b1b1b1b27}}24@0:8Q16"));
207 meth = class_getInstanceMethod (fooClass, @selector(_getATSTypesetterGuts:));
208 CHECK_IF (!strcmp (meth->method_types, "r@24@0:8r:16"));
210 meth = class_getInstanceMethod (fooClass, @selector(resumeWithSuspensionID:and:));
211 CHECK_IF (!strcmp (meth->method_types, "v32@0:8^{__NSAppleEventManagerSuspension=}16r^Q24"));
213 meth = class_getInstanceMethod (fooClass, @selector(anotherMeth:and:and:));
214 CHECK_IF (!strcmp (meth->method_types, "r@40@0:8r:16r@24r@32"));
216 meth = class_getInstanceMethod (fooClass, @selector(str1:str2:str3:str4:));
217 CHECK_IF (!strcmp (meth->method_types, "@48@0:8r*16*24*32r*40"));
219 meth = class_getInstanceMethod (fooClass, @selector(foo1:foo2:foo3:foo4:));
220 CHECK_IF (!strcmp (meth->method_types, "Vv48@0:8@16r@24@32r@40"));
222 meth = class_getInstanceMethod (fooClass, @selector(sel1:id1:));
223 CHECK_IF (!strcmp (meth->method_types, "rn*32@0:8r:16r@24"));
225 meth = class_getInstanceMethod (fooClass, @selector(obj1:obj2:obj3:));
226 CHECK_IF (!strcmp (meth->method_types, "N@40@0:8r@16@24^{Object=#}32"));
228 meth = class_getClassMethod (fooClass, @selector(_defaultScriptingComponent));
229 CHECK_IF (!strcmp (meth->method_types, "^{ComponentInstanceRecord=[1q]}16@0:8"));
231 meth = class_getInstanceMethod (fooClass, @selector(_formatCocoaErrorString:parameters:applicableFormatters:count:));
232 CHECK_IF (!strcmp (meth->method_types, "@44@0:8@16r*24^^{?}32i40"));
234 meth = class_getInstanceMethod (fooClass, @selector(formatter_func:run:));
235 CHECK_IF (!strcmp (meth->method_types, "^{?=^?@I}32@0:8@16r^^{?}24"));
237 meth = class_getInstanceMethod (fooClass, @selector(_forgetWord:inDictionary:));
238 CHECK_IF (!strcmp (meth->method_types, "c32@0:8nO@16nO@24"));
240 meth = class_getInstanceMethod (fooClass, @selector(_registerServicesMenu:withSendTypes:andReturnTypes:addToList:));
241 CHECK_IF (!strcmp (meth->method_types, "v44@0:8@16r^*24r^*32c40"));
243 meth = class_getClassMethod (fooClass, @selector(_proxySharePointer));
244 CHECK_IF (!strcmp (meth->method_types, "^^{__CFSet}16@0:8"));
246 meth = class_getInstanceMethod (fooClass, @selector(_checkGrammarInString:language:details:));
247 CHECK_IF (!strcmp (meth->method_types, "{_NSRange=II}40@0:8n@16nO@24oO^@32"));
249 meth = class_getInstanceMethod (fooClass, @selector(_resolvePositionalStakeGlyphsForLineFragment:lineFragmentRect:minPosition:maxPosition:maxLineFragmentWidth:breakHint:));
250 CHECK_IF (!strcmp (meth->method_types, "B60@0:8^{__CTLine=}16{_NSRect={_NSPoint=ff}{_NSSize=ff}}24f40f44f48^Q52"));
252 meth = class_getClassMethod (fooClass, @selector(findVoiceByIdentifier:returningCreator:returningID:));
253 CHECK_IF (!strcmp (meth->method_types, "c40@0:8@16^I24^I32"));
255 ivars = fooClass->ivars;
256 CHECK_IF (ivars->ivar_count == 1);
258 ivar = ivars->ivar_list;
259 CHECK_IF (!strcmp (ivar->ivar_name, "r"));
260 CHECK_IF (!strcmp (ivar->ivar_type,
261 "{?=\"_attributes\"@\"NSDictionary\"\"_font\"@\"NSFont\"\"_characterLength\""
262 "Q\"_nominalGlyphLocation\"Q\"p\"^Q\"_defaultLineHeight\"f\"_defaultBaselineOffset\""
263 "f\"_horizExpansion\"f\"_baselineDelta\"f\"_attachmentBBox\"{_NSRect=\"origin\""
264 "{_NSPoint=\"x\"f\"y\"f}\"size\"{_NSSize=\"width\"f\"height\"f}}\"ll\"q\"llp\"^q\"ull\""
265 "Q\"ullp\"^Q\"a\"@\"a1\"@\"a2\"@\"b\":\"b1\":\"b2\":\"str1\"*\"str2\"*\"str3\"*\"str4\""
266 "*\"_rFlags\"{?=\"_isAttachmentRun\"b1\"_hasPositionalStake\"b1\"_isDefaultFace\""
267 "b1\"_hasCombiningMarks\"b1\"_isScreenFont\"b1\"_reserved\"b27}}"));