summaryrefslogtreecommitdiff
path: root/gcc/testsuite
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite')
-rw-r--r--gcc/testsuite/ChangeLog60
-rw-r--r--gcc/testsuite/obj-c++.dg/encode-1-next.mm26
-rw-r--r--gcc/testsuite/obj-c++.dg/encode-1.mm1
-rw-r--r--gcc/testsuite/obj-c++.dg/encode-5.mm16
-rw-r--r--gcc/testsuite/obj-c++.dg/threedotthree-abi-1.mm71
-rw-r--r--gcc/testsuite/objc.dg/encode-1.m1
-rw-r--r--gcc/testsuite/objc.dg/encode-3.m18
-rw-r--r--gcc/testsuite/objc.dg/encode-6-next.m23
-rw-r--r--gcc/testsuite/objc.dg/encode-6.m1
-rw-r--r--gcc/testsuite/objc.dg/encode-7-next-64bit.m266
-rw-r--r--gcc/testsuite/objc.dg/encode-7-next.m267
-rw-r--r--gcc/testsuite/objc.dg/proto-qual-1.m10
-rw-r--r--gcc/testsuite/objc.dg/threedotthree-abi-1.m68
-rw-r--r--gcc/testsuite/objc.dg/type-size-2.m15
-rw-r--r--gcc/testsuite/objc.dg/type-size-3.m18
15 files changed, 856 insertions, 5 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 24f0c17c4bd..150dac4e4b8 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,65 @@
2010-09-27 Nicola Pero <nicola.pero@meta-innovation.com>
+ PR objc/25464
+ * objc.dg/type-size-3.m: New test.
+
+2010-09-27 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ PR objc/45763
+ * objc.dg/encode-1.m: Execute the test with the GNU runtime as
+ well.
+
+2010-09-27 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ PR objc/25450
+ * objc.dg/encode-3.m: Updated for fix of encoding of enums.
+ * objc.dg/type-size-2.m: Same change.
+ * obj-c++.dg/encode-5.mm: Same change.
+
+2010-09-27 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ Merge from 'apple/trunk' branch on FSF servers. The original
+ Changelogs are below.
+
+ * objc.dg/encode-6.m: Execute the test only with the GNU runtime.
+ * objc.dg/encode-6-next.m: New file (from encode-6.m in the
+ branch).
+ * objc.dg/encode-7-next.m: New file (from encode-7.m in the
+ branch).
+ * objc.dg/encode-7-next-64bit.m: New file (from encode-7-64bit.m
+ in the branch).
+ * objc.dg/proto-qual-1.m: Test the 3.3 ABI on NeXT (from
+ proto-qual-1.m in the branch) and the normal ABI on GNU.
+ * objc.dg/threedotthree-abi-1.m: New file (from the branch). Run
+ the test only with the NeXT runtime.
+ * obj-c++/encode-1.mm: Execute the test only with the GNU runtime.
+ * obj-c++/encode-1-next.mm: New file (from encode-1.mm in the
+ branch).
+ * obj-c++.dg/threedotthree-abi-1.mm: New file (from the branch).
+ Run the test only with the NeXT runtime.
+
+ 2006-03-30 Fariborz Jahanian <fjahanian@apple.com>
+
+ Radar 4492973
+ * objc.dg/encode-7-64bit.m: New.
+ * objc.dg/encode-7.m: Skip if -m64.
+
+ 2005-10-19 Fariborz Jahanian <fjahanian@apple.com>
+
+ Radar 4301047
+ * objc.dg/proto-qual-1.m: Fix test to match 3.3 ABI
+ * obj-c++.dg/threedotthree-abi-1.mm: New
+ * objc.dg/threedotthree-abi-1.m: New
+
+ 2005-07-20 Ziemowit Laski <zlaski@apple.com>
+
+ Radar 4136935
+ * obj-c++.dg/encode-1.mm: Tweak encodings to match fix.
+ * objc.dg/encode-6.m: Likewise.
+ * objc.dg/encode-7.m: New test case.
+
+2010-09-27 Nicola Pero <nicola.pero@meta-innovation.com>
+
Merge from 'apple/trunk' branch on FSF servers. Renamed
const-str-12.m to constr-str-12b.m to avoid conflicts.
diff --git a/gcc/testsuite/obj-c++.dg/encode-1-next.mm b/gcc/testsuite/obj-c++.dg/encode-1-next.mm
new file mode 100644
index 00000000000..47673f20cb2
--- /dev/null
+++ b/gcc/testsuite/obj-c++.dg/encode-1-next.mm
@@ -0,0 +1,26 @@
+/* This file tests that things are encoded using the gcc-3.3 ABI which is only
+ used by the NeXT runtime. */
+/* Test for graceful encoding of const-qualified fields and parameters. */
+/* Author: Ziemowit Laski <zlaski@apple.com> */
+
+/* { dg-do compile } */
+/* { dg-skip-if "" { *-*-* } { "-fgnu-runtime" } { "" } } */
+
+struct Cxx {
+ const struct Cxx *next;
+};
+
+@interface ObjC {
+ const struct Cxx *obj;
+}
+- (ObjC *)initWithCxx: (struct Cxx *const)c and: (const struct Cxx *)d;
+@end
+
+@implementation ObjC
+- (ObjC *)initWithCxx: (struct Cxx *const)c and: (const struct Cxx *)d {
+ obj = d;
+ return self;
+}
+@end
+
+/* { dg-final { scan-assembler "@\[0-9\]+@0:\[0-9\]+\\^{Cxx=\\^{Cxx}}\[0-9\]+r\\^{Cxx=\\^{Cxx}}" } } */
diff --git a/gcc/testsuite/obj-c++.dg/encode-1.mm b/gcc/testsuite/obj-c++.dg/encode-1.mm
index c5f5ea969ab..5f5ba20139e 100644
--- a/gcc/testsuite/obj-c++.dg/encode-1.mm
+++ b/gcc/testsuite/obj-c++.dg/encode-1.mm
@@ -2,6 +2,7 @@
/* Author: Ziemowit Laski <zlaski@apple.com> */
/* { dg-do compile } */
+/* { dg-skip-if "" { *-*-* } { "-fnext-runtime" } { "" } } */
struct Cxx {
const struct Cxx *next;
diff --git a/gcc/testsuite/obj-c++.dg/encode-5.mm b/gcc/testsuite/obj-c++.dg/encode-5.mm
index 4959ea394a3..18db3f3dd8c 100644
--- a/gcc/testsuite/obj-c++.dg/encode-5.mm
+++ b/gcc/testsuite/obj-c++.dg/encode-5.mm
@@ -70,7 +70,21 @@ int main(void) {
CHECK_IF(offs3 == offs2 + sizeof(XXRect) && offs4 == offs3 + sizeof(int));
CHECK_IF(totsize == offs4 + sizeof(int));
meth = [proto descriptionForClassMethod: @selector(getEnum:enum:bool:)];
- scan_initial("^i%u@%u:%u^{?=ff(__XXAngle=II)}%ui%uc%u");
+ /* Here we have the complication that 'enum Enum' could be encoded
+ as 'i' on __NEXT_RUNTIME_, and (most likely) as 'I' on the GNU
+ runtime. So we get the @encode(enum Enum), then put it into the
+ string in place of the traditional 'i'.
+ */
+ /* scan_initial("^i%u@%u:%u^{?=ff(__XXAngle=II)}%ui%uc%u"); */
+ {
+ char pattern[1024];
+
+ sprintf (pattern, "^%s%%u@%%u:%%u^{?=ff(__XXAngle=II)}%%u%s%%uc%%u",
+ @encode(enum Enum), @encode(enum Enum));
+ scan_initial(pattern);
+ }
+
+
CHECK_IF(offs3 == offs2 + sizeof(XXPoint *) && offs4 == offs3 + sizeof(enum Enum));
CHECK_IF(totsize == offs4 + sizeof(int)); /* 'ObjCBool' is really 'char' */
meth = [proto descriptionForClassMethod: @selector(getBool:)];
diff --git a/gcc/testsuite/obj-c++.dg/threedotthree-abi-1.mm b/gcc/testsuite/obj-c++.dg/threedotthree-abi-1.mm
new file mode 100644
index 00000000000..56fa701c86f
--- /dev/null
+++ b/gcc/testsuite/obj-c++.dg/threedotthree-abi-1.mm
@@ -0,0 +1,71 @@
+/* This file tests that things are encoded using the gcc-3.3 ABI which is only
+ used by the NeXT runtime. */
+/* { dg-do run { target *-*-darwin* } } */
+/* { dg-skip-if "" { *-*-* } { "-fgnu-runtime" } { "" } } */
+#include <stdio.h>
+#include <string.h>
+#include "../objc-obj-c++-shared/Protocol1.h"
+#ifndef __NEXT_RUNTIME__
+#include <objc/objc-api.h>
+#endif
+
+extern "C" void abort();
+
+
+@protocol CommonProtocol
+
+-(oneway void)methodCall_On:(in bycopy id)someValue_On;
+-(oneway void)methodCall_nO:(bycopy in id)someValue_nO;
+
+-(oneway void)methodCall_Oo:(out bycopy id)someValue_Oo;
+-(oneway void)methodCall_oO:(bycopy out id)someValue_oO;
+
+-(oneway void)methodCall_rn:(in const id)someValue_rn;
+
+-(oneway void)methodCall_oOn:(in bycopy out id)someValue_oOn;
+
+@end
+
+@interface ObjCClass <CommonProtocol>
+{
+
+}
+
+@end
+
+@implementation ObjCClass
+-(oneway void)methodCall_On:(in bycopy id)someValue_On { }
+-(oneway void)methodCall_nO:(bycopy in id)someValue_nO { }
+
+-(oneway void)methodCall_Oo:(out bycopy id)someValue_Oo { }
+-(oneway void)methodCall_oO:(bycopy out id)someValue_oO { }
+
+-(oneway void)methodCall_rn:(in const id)someValue_rn { }
+-(oneway void)methodCall_oOn:(in bycopy out id)someValue_oOn { }
+@end
+
+Protocol *proto = @protocol(CommonProtocol);
+struct objc_method_description *meth;
+
+int main()
+{
+ meth = [proto descriptionForInstanceMethod: @selector(methodCall_On:)];
+ if (strcmp (meth->types, "Vv12@0:4On@8"))
+ abort();
+ meth = [proto descriptionForInstanceMethod: @selector(methodCall_nO:)];
+ if (strcmp (meth->types, "Vv12@0:4nO@8"))
+ abort();
+ meth = [proto descriptionForInstanceMethod: @selector(methodCall_Oo:)];
+ if (strcmp (meth->types, "Vv12@0:4Oo@8"))
+ abort();
+ meth = [proto descriptionForInstanceMethod: @selector(methodCall_oO:)];
+ if (strcmp (meth->types, "Vv12@0:4oO@8"))
+ abort();
+ meth = [proto descriptionForInstanceMethod: @selector(methodCall_rn:)];
+ if (strcmp (meth->types, "Vv12@0:4rn@8"))
+ abort();
+ meth = [proto descriptionForInstanceMethod: @selector(methodCall_oOn:)];
+ if (strcmp (meth->types, "Vv12@0:4oOn@8"))
+ abort();
+ return 0;
+}
diff --git a/gcc/testsuite/objc.dg/encode-1.m b/gcc/testsuite/objc.dg/encode-1.m
index 50e9919f941..09cb6af19c2 100644
--- a/gcc/testsuite/objc.dg/encode-1.m
+++ b/gcc/testsuite/objc.dg/encode-1.m
@@ -4,7 +4,6 @@
where we have 'typedef char BOOL'. */
/* Contributed by Ziemowit Laski <zlaski@apple.com>. */
/* { dg-do run } */
-/* { dg-options "-fnext-runtime" } */
#include <string.h>
#include <stdlib.h>
#include <objc/objc.h>
diff --git a/gcc/testsuite/objc.dg/encode-3.m b/gcc/testsuite/objc.dg/encode-3.m
index 63a92e19cd0..432245337ab 100644
--- a/gcc/testsuite/objc.dg/encode-3.m
+++ b/gcc/testsuite/objc.dg/encode-3.m
@@ -44,7 +44,7 @@ unsigned totsize, offs0, offs1, offs2, offs3, offs4, offs5, offs6, offs7;
static void scan_initial(const char *pattern) {
totsize = offs0 = offs1 = offs2 = offs3 = offs4 = offs5 = offs6 = offs7 = (unsigned)-1;
sscanf(meth->types, pattern, &totsize, &offs0, &offs1, &offs2, &offs3,
- &offs4, &offs5, &offs6, &offs7);
+ &offs4, &offs5, &offs6, &offs7);
CHECK_IF(!offs0 && offs1 == sizeof(id) && offs2 == offs1 + sizeof(SEL) && totsize >= offs2);
}
@@ -65,7 +65,21 @@ int main(void) {
CHECK_IF(offs3 == offs2 + sizeof(XXRect) && offs4 == offs3 + sizeof(int));
CHECK_IF(totsize == offs4 + sizeof(int));
meth = [proto descriptionForClassMethod: @selector(getEnum:enum:bool:)];
- scan_initial("^i%u@%u:%u^{?=ff(__XXAngle=II)}%ui%uc%u");
+
+ /* Here we have the complication that 'enum Enum' could be encoded
+ as 'i' on __NEXT_RUNTIME_, and (most likely) as 'I' on the GNU
+ runtime. So we get the @encode(enum Enum), then put it into the
+ string in place of the traditional 'i'.
+ */
+ /* scan_initial("^i%u@%u:%u^{?=ff(__XXAngle=II)}%ui%uc%u"); */
+ {
+ char pattern[1024];
+
+ sprintf (pattern, "^%s%%u@%%u:%%u^{?=ff(__XXAngle=II)}%%u%s%%uc%%u",
+ @encode(enum Enum), @encode(enum Enum));
+ scan_initial(pattern);
+ }
+
CHECK_IF(offs3 == offs2 + sizeof(XXPoint *) && offs4 == offs3 + sizeof(enum Enum));
CHECK_IF(totsize == offs4 + sizeof(int)); /* 'ObjCBool' is really 'char' */
meth = [proto descriptionForClassMethod: @selector(getBool:)];
diff --git a/gcc/testsuite/objc.dg/encode-6-next.m b/gcc/testsuite/objc.dg/encode-6-next.m
new file mode 100644
index 00000000000..c3d922659aa
--- /dev/null
+++ b/gcc/testsuite/objc.dg/encode-6-next.m
@@ -0,0 +1,23 @@
+/* Test for graceful encoding of const-qualified fields and parameters. */
+/* Author: Ziemowit Laski <zlaski@apple.com> */
+/* { dg-do compile } */
+/* { dg-skip-if "" { *-*-* } { "-fgnu-runtime" } { "" } } */
+
+struct Cxx {
+ const struct Cxx *next;
+};
+
+@interface ObjC {
+ const struct Cxx *obj;
+}
+- (ObjC *)initWithCxx: (struct Cxx *const)c and: (const struct Cxx *)d;
+@end
+
+@implementation ObjC
+- (ObjC *)initWithCxx: (struct Cxx *const)c and: (const struct Cxx *)d {
+ obj = d;
+ return self;
+}
+@end
+
+/* { dg-final { scan-assembler "@\[0-9\]+@0:\[0-9\]+\\^{Cxx=\\^{Cxx}}\[0-9\]+r\\^{Cxx=\\^{Cxx}}" } } */
diff --git a/gcc/testsuite/objc.dg/encode-6.m b/gcc/testsuite/objc.dg/encode-6.m
index 263b02ad0f3..291a41e96a0 100644
--- a/gcc/testsuite/objc.dg/encode-6.m
+++ b/gcc/testsuite/objc.dg/encode-6.m
@@ -1,6 +1,7 @@
/* Test for graceful encoding of const-qualified fields and parameters. */
/* Author: Ziemowit Laski <zlaski@apple.com> */
/* { dg-do compile } */
+/* { dg-skip-if "" { *-*-* } { "-fnext-runtime" } { "" } } */
struct Cxx {
const struct Cxx *next;
diff --git a/gcc/testsuite/objc.dg/encode-7-next-64bit.m b/gcc/testsuite/objc.dg/encode-7-next-64bit.m
new file mode 100644
index 00000000000..2a064d8816c
--- /dev/null
+++ b/gcc/testsuite/objc.dg/encode-7-next-64bit.m
@@ -0,0 +1,266 @@
+/* Additional testing for the NeXT runtime. Encoding in -m64 mode */
+
+/* { dg-do run { target *-*-darwin* } } */
+/* { dg-options "-m64" } */
+/* { dg-skip-if "" { *-*-* } { "-fgnu-runtime" } { "" } } */
+
+#include <objc/Object.h>
+#include <stdbool.h>
+#include <string.h>
+#include <stdlib.h>
+#define CHECK_IF(E) if (!(E)) abort ()
+
+@class NSDictionary, NSFont, NSError, _NSATSTypesetterGuts, NSString, NSMenu, NSArray;
+
+typedef unsigned char UInt8;
+typedef const signed long OSStatus;
+typedef unsigned long CFIndex;
+typedef unsigned int UInt32;
+typedef UInt32 FourCharCode;
+typedef FourCharCode OSType;
+
+struct FSRef {
+ UInt8 hidden[80];
+};
+typedef struct FSRef FSRef;
+
+typedef struct _NSPoint {
+ float x;
+ float y;
+} NSPoint;
+
+typedef struct _NSSize {
+ float width;
+ float height;
+} NSSize;
+
+typedef struct _NSRect {
+ NSPoint origin;
+ NSSize size;
+} NSRect;
+
+typedef struct _NSRange {
+ unsigned int location;
+ unsigned int length;
+} NSRange;
+
+typedef const char *NXAtom;
+
+typedef struct {
+ NSDictionary *_attributes;
+ NSFont *_font;
+ CFIndex _characterLength;
+ CFIndex _nominalGlyphLocation;
+ const CFIndex *p;
+ float _defaultLineHeight;
+ float _defaultBaselineOffset;
+ float _horizExpansion;
+ float _baselineDelta;
+ NSRect _attachmentBBox;
+ long ll, *llp;
+ unsigned long ull, *ullp;
+ id a;
+ const id a1;
+ const struct objc_object *a2;
+ SEL b;
+ const SEL b1;
+ const struct objc_selector *b2;
+ const char *str1;
+ char *str2;
+ char *const str3;
+ const char *const str4;
+ struct {
+ unsigned int _isAttachmentRun:1;
+ unsigned int _hasPositionalStake:1;
+ unsigned int _isDefaultFace:1;
+ unsigned int _hasCombiningMarks:1;
+ unsigned int _isScreenFont:1;
+ unsigned int _reserved:27;
+ } _rFlags;
+} NSATSGlyphStorageRun;
+
+typedef struct __CFSet *CFMutableSetRef;
+typedef const struct __CTLine * CTLineRef;
+typedef const struct __NSAppleEventManagerSuspension* NSAppleEventManagerSuspensionID;
+
+struct ComponentInstanceRecord {
+ long data[1];
+};
+typedef struct ComponentInstanceRecord ComponentInstanceRecord;
+typedef ComponentInstanceRecord *ComponentInstance;
+
+typedef NSString *(*NSErrorUserInfoFormatterFunc)(id objToBeDisplayed, NSError *err, char modifier);
+typedef struct {
+ NSErrorUserInfoFormatterFunc formatterFunc;
+ NSString *userInfoKey;
+ unsigned int parameterMask;
+} NSErrorUserInfoFormatter;
+
+typedef Object MyObj;
+typedef Object *MyPtr;
+
+@interface Foo: Object {
+ NSATSGlyphStorageRun r;
+}
+- (NSError *)_errorWithOSStatus:(OSStatus)inOSStatus ref1:(const FSRef *)inRef1 ref2:(const struct FSRef *)inRef2
+ reading:(BOOL)inReadingNotWriting;
+- (const NSATSGlyphStorageRun *)_attributeRunForCharacterAtIndex:(const CFIndex)charIndex;
+- (const _NSATSTypesetterGuts *)_getATSTypesetterGuts:(const struct objc_selector *)sel;
+- (void)resumeWithSuspensionID:(NSAppleEventManagerSuspensionID)suspensionID and:(const CFIndex *)status;
+- (const id)anotherMeth:(const SEL)sel and:(const Foo *)foo and:(const struct objc_object *)obj;
+- (id)str1:(const char *)str1 str2:(char *)str2 str3:(char *const)str3 str4:(const char *const)str4;
+- (oneway void)foo1:(Foo *)foo1 foo2:(const Foo *)foo2 foo3:(Foo *const)foo3 foo4:(const Foo *const)foo4;
+- (in const char *)sel1:(const SEL)sel1 id1:(const id)id1;
+- (inout id)obj1:(const MyPtr)obj1 obj2:(Object *const)obj2 obj3:(MyObj *const)obj3;
++ (ComponentInstance)_defaultScriptingComponent;
+- (NSString *)_formatCocoaErrorString:(NSString *)formatString parameters:(const char *)parameters
+ applicableFormatters:(NSErrorUserInfoFormatter **)formatters count:(int)numFormatters;
+- (NSErrorUserInfoFormatter *)formatter_func:(id)obj run:(const NSATSGlyphStorageRun **)run;
+- (BOOL)_forgetWord:(bycopy in NSString *)word inDictionary:(bycopy in NSString *)language;
+- (void)_registerServicesMenu:(NSMenu *)servicesMenu withSendTypes:(const NXAtom *)sendTypes
+ andReturnTypes:(const NXAtom *)returnTypes addToList:(BOOL)addToList;
++ (CFMutableSetRef *)_proxySharePointer;
+- (NSRange)_checkGrammarInString:(in NSString *)stringToCheck language:(bycopy in NSString *)language details:(bycopy out NSArray **)details;
+- (bool)_resolvePositionalStakeGlyphsForLineFragment:(CTLineRef)line lineFragmentRect:(NSRect)lineFragmentRect
+ minPosition:(float)minPosition maxPosition:(float)maxPosition maxLineFragmentWidth:(float)maxLineFragmentWidth
+ breakHint:(CFIndex *)charIndex;
++ (BOOL)findVoiceByIdentifier:(NSString *)identifier returningCreator:(OSType *)returnedCreator returningID:(OSType *)returnedID;
+@end
+
+NSRange globalRange;
+
+@implementation Foo
+- (NSError *)_errorWithOSStatus:(OSStatus)inOSStatus ref1:(const FSRef *)inRef1 ref2:(const struct FSRef *)inRef2
+ reading:(BOOL)inReadingNotWriting {
+ return (NSError *)self;
+}
+- (const NSATSGlyphStorageRun *)_attributeRunForCharacterAtIndex:(CFIndex)charIndex {
+ return (const NSATSGlyphStorageRun *)self;
+}
+- (const _NSATSTypesetterGuts *)_getATSTypesetterGuts:(const struct objc_selector *)sel {
+ return (const _NSATSTypesetterGuts *)self;
+}
+- (void)resumeWithSuspensionID:(NSAppleEventManagerSuspensionID)suspensionID and:(const CFIndex *)status {
+}
+- (const id)anotherMeth:(const SEL)sel and:(const Foo *)foo and:(const struct objc_object *)obj {
+ return (const id)self;
+}
+- (id)str1:(const char *)str1 str2:(char *)str2 str3:(char *const)str3 str4:(const char *const)str4 {
+ return self;
+}
+- (oneway void)foo1:(Foo *)foo1 foo2:(const Foo *)foo2 foo3:(Foo *const)foo3 foo4:(const Foo *const)foo4 {
+}
+- (in const char *)sel1:(const SEL)sel1 id1:(const id)id1 {
+ return "Hello";
+}
+- (inout id)obj1:(const MyPtr)obj1 obj2:(Object *const)obj2 obj3:(MyObj *const)obj3 {
+ return self;
+}
++ (ComponentInstance)_defaultScriptingComponent {
+ return (ComponentInstance)0;
+}
+- (NSString *)_formatCocoaErrorString:(NSString *)formatString parameters:(const char *)parameters
+ applicableFormatters:(NSErrorUserInfoFormatter **)formatters count:(int)numFormatters {
+ return (NSString *)self;
+}
+- (NSErrorUserInfoFormatter *)formatter_func:(id)obj run:(const NSATSGlyphStorageRun **)run {
+ return (NSErrorUserInfoFormatter *)0;
+}
+- (BOOL)_forgetWord:(bycopy in NSString *)word inDictionary:(bycopy in NSString *)language {
+ return YES;
+}
+- (void)_registerServicesMenu:(NSMenu *)servicesMenu withSendTypes:(const NXAtom *)sendTypes
+ andReturnTypes:(const NXAtom *)returnTypes addToList:(BOOL)addToList {
+}
++ (CFMutableSetRef *)_proxySharePointer {
+ return (CFMutableSetRef *)0;
+}
+- (NSRange)_checkGrammarInString:(in NSString *)stringToCheck language:(bycopy in NSString *)language details:(bycopy out NSArray **)details {
+ return globalRange;
+}
+- (bool)_resolvePositionalStakeGlyphsForLineFragment:(CTLineRef)line lineFragmentRect:(NSRect)lineFragmentRect
+ minPosition:(float)minPosition maxPosition:(float)maxPosition maxLineFragmentWidth:(float)maxLineFragmentWidth
+ breakHint:(CFIndex *)charIndex {
+ return false;
+}
++ (BOOL)findVoiceByIdentifier:(NSString *)identifier returningCreator:(OSType *)returnedCreator returningID:(OSType *)returnedID {
+ return NO;
+}
+@end
+
+int main(void) {
+ Class fooClass = objc_getClass ("Foo");
+ Method meth;
+ struct objc_ivar_list *ivars;
+ struct objc_ivar *ivar;
+
+ meth = class_getInstanceMethod (fooClass, @selector(_errorWithOSStatus:ref1:ref2:reading:));
+ CHECK_IF (!strcmp (meth->method_types, "@44@0:8q16r^{FSRef=[80C]}24r^{FSRef=[80C]}32c40"));
+
+ meth = class_getInstanceMethod (fooClass, @selector(_attributeRunForCharacterAtIndex:));
+ CHECK_IF (!strcmp (meth->method_types, "r^{?=@@QQ^Qffff{_NSRect={_NSPoint=ff}{_NSSize=ff}}q^qQ^Q@@@:::****{?=b1b1b1b1b1b27}}24@0:8Q16"));
+
+ meth = class_getInstanceMethod (fooClass, @selector(_getATSTypesetterGuts:));
+ CHECK_IF (!strcmp (meth->method_types, "r@24@0:8r:16"));
+
+ meth = class_getInstanceMethod (fooClass, @selector(resumeWithSuspensionID:and:));
+ CHECK_IF (!strcmp (meth->method_types, "v32@0:8^{__NSAppleEventManagerSuspension=}16r^Q24"));
+
+ meth = class_getInstanceMethod (fooClass, @selector(anotherMeth:and:and:));
+ CHECK_IF (!strcmp (meth->method_types, "r@40@0:8r:16r@24r@32"));
+
+ meth = class_getInstanceMethod (fooClass, @selector(str1:str2:str3:str4:));
+ CHECK_IF (!strcmp (meth->method_types, "@48@0:8r*16*24*32r*40"));
+
+ meth = class_getInstanceMethod (fooClass, @selector(foo1:foo2:foo3:foo4:));
+ CHECK_IF (!strcmp (meth->method_types, "Vv48@0:8@16r@24@32r@40"));
+
+ meth = class_getInstanceMethod (fooClass, @selector(sel1:id1:));
+ CHECK_IF (!strcmp (meth->method_types, "rn*32@0:8r:16r@24"));
+
+ meth = class_getInstanceMethod (fooClass, @selector(obj1:obj2:obj3:));
+ CHECK_IF (!strcmp (meth->method_types, "N@40@0:8r@16@24^{Object=#}32"));
+
+ meth = class_getClassMethod (fooClass, @selector(_defaultScriptingComponent));
+ CHECK_IF (!strcmp (meth->method_types, "^{ComponentInstanceRecord=[1q]}16@0:8"));
+
+ meth = class_getInstanceMethod (fooClass, @selector(_formatCocoaErrorString:parameters:applicableFormatters:count:));
+ CHECK_IF (!strcmp (meth->method_types, "@44@0:8@16r*24^^{?}32i40"));
+
+ meth = class_getInstanceMethod (fooClass, @selector(formatter_func:run:));
+ CHECK_IF (!strcmp (meth->method_types, "^{?=^?@I}32@0:8@16r^^{?}24"));
+
+ meth = class_getInstanceMethod (fooClass, @selector(_forgetWord:inDictionary:));
+ CHECK_IF (!strcmp (meth->method_types, "c32@0:8nO@16nO@24"));
+
+ meth = class_getInstanceMethod (fooClass, @selector(_registerServicesMenu:withSendTypes:andReturnTypes:addToList:));
+ CHECK_IF (!strcmp (meth->method_types, "v44@0:8@16r^*24r^*32c40"));
+
+ meth = class_getClassMethod (fooClass, @selector(_proxySharePointer));
+ CHECK_IF (!strcmp (meth->method_types, "^^{__CFSet}16@0:8"));
+
+ meth = class_getInstanceMethod (fooClass, @selector(_checkGrammarInString:language:details:));
+ CHECK_IF (!strcmp (meth->method_types, "{_NSRange=II}40@0:8n@16nO@24oO^@32"));
+
+ meth = class_getInstanceMethod (fooClass, @selector(_resolvePositionalStakeGlyphsForLineFragment:lineFragmentRect:minPosition:maxPosition:maxLineFragmentWidth:breakHint:));
+ CHECK_IF (!strcmp (meth->method_types, "B60@0:8^{__CTLine=}16{_NSRect={_NSPoint=ff}{_NSSize=ff}}24f40f44f48^Q52"));
+
+ meth = class_getClassMethod (fooClass, @selector(findVoiceByIdentifier:returningCreator:returningID:));
+ CHECK_IF (!strcmp (meth->method_types, "c40@0:8@16^I24^I32"));
+
+ ivars = fooClass->ivars;
+ CHECK_IF (ivars->ivar_count == 1);
+
+ ivar = ivars->ivar_list;
+ CHECK_IF (!strcmp (ivar->ivar_name, "r"));
+ CHECK_IF (!strcmp (ivar->ivar_type,
+ "{?=\"_attributes\"@\"NSDictionary\"\"_font\"@\"NSFont\"\"_characterLength\""
+ "Q\"_nominalGlyphLocation\"Q\"p\"^Q\"_defaultLineHeight\"f\"_defaultBaselineOffset\""
+ "f\"_horizExpansion\"f\"_baselineDelta\"f\"_attachmentBBox\"{_NSRect=\"origin\""
+ "{_NSPoint=\"x\"f\"y\"f}\"size\"{_NSSize=\"width\"f\"height\"f}}\"ll\"q\"llp\"^q\"ull\""
+ "Q\"ullp\"^Q\"a\"@\"a1\"@\"a2\"@\"b\":\"b1\":\"b2\":\"str1\"*\"str2\"*\"str3\"*\"str4\""
+ "*\"_rFlags\"{?=\"_isAttachmentRun\"b1\"_hasPositionalStake\"b1\"_isDefaultFace\""
+ "b1\"_hasCombiningMarks\"b1\"_isScreenFont\"b1\"_reserved\"b27}}"));
+
+ return 0;
+}
diff --git a/gcc/testsuite/objc.dg/encode-7-next.m b/gcc/testsuite/objc.dg/encode-7-next.m
new file mode 100644
index 00000000000..60db23675eb
--- /dev/null
+++ b/gcc/testsuite/objc.dg/encode-7-next.m
@@ -0,0 +1,267 @@
+/* Additional testing for the NeXT runtime. */
+/* Author: Ziemowit Laski <zlaski@apple.com> */
+
+/* { dg-do run { target *-*-darwin* } } */
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "-m64" } { "" } } */
+/* { dg-skip-if "" { *-*-* } { "-fgnu-runtime" } { "" } } */
+
+#include "../objc-obj-c++-shared/Object1.h"
+#include <stdbool.h>
+#include <string.h>
+#include <stdlib.h>
+#define CHECK_IF(E) if (!(E)) abort ()
+
+@class NSDictionary, NSFont, NSError, _NSATSTypesetterGuts, NSString, NSMenu, NSArray;
+
+typedef unsigned char UInt8;
+typedef const signed long OSStatus;
+typedef unsigned long CFIndex;
+typedef unsigned int UInt32;
+typedef UInt32 FourCharCode;
+typedef FourCharCode OSType;
+
+struct FSRef {
+ UInt8 hidden[80];
+};
+typedef struct FSRef FSRef;
+
+typedef struct _NSPoint {
+ float x;
+ float y;
+} NSPoint;
+
+typedef struct _NSSize {
+ float width;
+ float height;
+} NSSize;
+
+typedef struct _NSRect {
+ NSPoint origin;
+ NSSize size;
+} NSRect;
+
+typedef struct _NSRange {
+ unsigned int location;
+ unsigned int length;
+} NSRange;
+
+typedef const char *NXAtom;
+
+typedef struct {
+ NSDictionary *_attributes;
+ NSFont *_font;
+ CFIndex _characterLength;
+ CFIndex _nominalGlyphLocation;
+ const CFIndex *p;
+ float _defaultLineHeight;
+ float _defaultBaselineOffset;
+ float _horizExpansion;
+ float _baselineDelta;
+ NSRect _attachmentBBox;
+ long ll, *llp;
+ unsigned long ull, *ullp;
+ id a;
+ const id a1;
+ const struct objc_object *a2;
+ SEL b;
+ const SEL b1;
+ const struct objc_selector *b2;
+ const char *str1;
+ char *str2;
+ char *const str3;
+ const char *const str4;
+ struct {
+ unsigned int _isAttachmentRun:1;
+ unsigned int _hasPositionalStake:1;
+ unsigned int _isDefaultFace:1;
+ unsigned int _hasCombiningMarks:1;
+ unsigned int _isScreenFont:1;
+ unsigned int _reserved:27;
+ } _rFlags;
+} NSATSGlyphStorageRun;
+
+typedef struct __CFSet *CFMutableSetRef;
+typedef const struct __CTLine * CTLineRef;
+typedef const struct __NSAppleEventManagerSuspension* NSAppleEventManagerSuspensionID;
+
+struct ComponentInstanceRecord {
+ long data[1];
+};
+typedef struct ComponentInstanceRecord ComponentInstanceRecord;
+typedef ComponentInstanceRecord *ComponentInstance;
+
+typedef NSString *(*NSErrorUserInfoFormatterFunc)(id objToBeDisplayed, NSError *err, char modifier);
+typedef struct {
+ NSErrorUserInfoFormatterFunc formatterFunc;
+ NSString *userInfoKey;
+ unsigned int parameterMask;
+} NSErrorUserInfoFormatter;
+
+typedef Object MyObj;
+typedef Object *MyPtr;
+
+@interface Foo: Object {
+ NSATSGlyphStorageRun r;
+}
+- (NSError *)_errorWithOSStatus:(OSStatus)inOSStatus ref1:(const FSRef *)inRef1 ref2:(const struct FSRef *)inRef2
+ reading:(BOOL)inReadingNotWriting;
+- (const NSATSGlyphStorageRun *)_attributeRunForCharacterAtIndex:(const CFIndex)charIndex;
+- (const _NSATSTypesetterGuts *)_getATSTypesetterGuts:(const struct objc_selector *)sel;
+- (void)resumeWithSuspensionID:(NSAppleEventManagerSuspensionID)suspensionID and:(const CFIndex *)status;
+- (const id)anotherMeth:(const SEL)sel and:(const Foo *)foo and:(const struct objc_object *)obj;
+- (id)str1:(const char *)str1 str2:(char *)str2 str3:(char *const)str3 str4:(const char *const)str4;
+- (oneway void)foo1:(Foo *)foo1 foo2:(const Foo *)foo2 foo3:(Foo *const)foo3 foo4:(const Foo *const)foo4;
+- (in const char *)sel1:(const SEL)sel1 id1:(const id)id1;
+- (inout id)obj1:(const MyPtr)obj1 obj2:(Object *const)obj2 obj3:(MyObj *const)obj3;
++ (ComponentInstance)_defaultScriptingComponent;
+- (NSString *)_formatCocoaErrorString:(NSString *)formatString parameters:(const char *)parameters
+ applicableFormatters:(NSErrorUserInfoFormatter **)formatters count:(int)numFormatters;
+- (NSErrorUserInfoFormatter *)formatter_func:(id)obj run:(const NSATSGlyphStorageRun **)run;
+- (BOOL)_forgetWord:(bycopy in NSString *)word inDictionary:(bycopy in NSString *)language;
+- (void)_registerServicesMenu:(NSMenu *)servicesMenu withSendTypes:(const NXAtom *)sendTypes
+ andReturnTypes:(const NXAtom *)returnTypes addToList:(BOOL)addToList;
++ (CFMutableSetRef *)_proxySharePointer;
+- (NSRange)_checkGrammarInString:(in NSString *)stringToCheck language:(bycopy in NSString *)language details:(bycopy out NSArray **)details;
+- (bool)_resolvePositionalStakeGlyphsForLineFragment:(CTLineRef)line lineFragmentRect:(NSRect)lineFragmentRect
+ minPosition:(float)minPosition maxPosition:(float)maxPosition maxLineFragmentWidth:(float)maxLineFragmentWidth
+ breakHint:(CFIndex *)charIndex;
++ (BOOL)findVoiceByIdentifier:(NSString *)identifier returningCreator:(OSType *)returnedCreator returningID:(OSType *)returnedID;
+@end
+
+NSRange globalRange;
+
+@implementation Foo
+- (NSError *)_errorWithOSStatus:(OSStatus)inOSStatus ref1:(const FSRef *)inRef1 ref2:(const struct FSRef *)inRef2
+ reading:(BOOL)inReadingNotWriting {
+ return (NSError *)self;
+}
+- (const NSATSGlyphStorageRun *)_attributeRunForCharacterAtIndex:(CFIndex)charIndex {
+ return (const NSATSGlyphStorageRun *)self;
+}
+- (const _NSATSTypesetterGuts *)_getATSTypesetterGuts:(const struct objc_selector *)sel {
+ return (const _NSATSTypesetterGuts *)self;
+}
+- (void)resumeWithSuspensionID:(NSAppleEventManagerSuspensionID)suspensionID and:(const CFIndex *)status {
+}
+- (const id)anotherMeth:(const SEL)sel and:(const Foo *)foo and:(const struct objc_object *)obj {
+ return (const id)self;
+}
+- (id)str1:(const char *)str1 str2:(char *)str2 str3:(char *const)str3 str4:(const char *const)str4 {
+ return self;
+}
+- (oneway void)foo1:(Foo *)foo1 foo2:(const Foo *)foo2 foo3:(Foo *const)foo3 foo4:(const Foo *const)foo4 {
+}
+- (in const char *)sel1:(const SEL)sel1 id1:(const id)id1 {
+ return "Hello";
+}
+- (inout id)obj1:(const MyPtr)obj1 obj2:(Object *const)obj2 obj3:(MyObj *const)obj3 {
+ return self;
+}
++ (ComponentInstance)_defaultScriptingComponent {
+ return (ComponentInstance)0;
+}
+- (NSString *)_formatCocoaErrorString:(NSString *)formatString parameters:(const char *)parameters
+ applicableFormatters:(NSErrorUserInfoFormatter **)formatters count:(int)numFormatters {
+ return (NSString *)self;
+}
+- (NSErrorUserInfoFormatter *)formatter_func:(id)obj run:(const NSATSGlyphStorageRun **)run {
+ return (NSErrorUserInfoFormatter *)0;
+}
+- (BOOL)_forgetWord:(bycopy in NSString *)word inDictionary:(bycopy in NSString *)language {
+ return YES;
+}
+- (void)_registerServicesMenu:(NSMenu *)servicesMenu withSendTypes:(const NXAtom *)sendTypes
+ andReturnTypes:(const NXAtom *)returnTypes addToList:(BOOL)addToList {
+}
++ (CFMutableSetRef *)_proxySharePointer {
+ return (CFMutableSetRef *)0;
+}
+- (NSRange)_checkGrammarInString:(in NSString *)stringToCheck language:(bycopy in NSString *)language details:(bycopy out NSArray **)details {
+ return globalRange;
+}
+- (bool)_resolvePositionalStakeGlyphsForLineFragment:(CTLineRef)line lineFragmentRect:(NSRect)lineFragmentRect
+ minPosition:(float)minPosition maxPosition:(float)maxPosition maxLineFragmentWidth:(float)maxLineFragmentWidth
+ breakHint:(CFIndex *)charIndex {
+ return false;
+}
++ (BOOL)findVoiceByIdentifier:(NSString *)identifier returningCreator:(OSType *)returnedCreator returningID:(OSType *)returnedID {
+ return NO;
+}
+@end
+
+int main(void) {
+ Class fooClass = objc_getClass ("Foo");
+ Method meth;
+ struct objc_ivar_list *ivars;
+ struct objc_ivar *ivar;
+
+ meth = class_getInstanceMethod (fooClass, @selector(_errorWithOSStatus:ref1:ref2:reading:));
+ CHECK_IF (!strcmp (meth->method_types, "@24@0:4l8r^{FSRef=[80C]}12r^{FSRef=[80C]}16c20"));
+
+ meth = class_getInstanceMethod (fooClass, @selector(_attributeRunForCharacterAtIndex:));
+ CHECK_IF (!strcmp (meth->method_types, "r^{?=@@II^Iffff{_NSRect={_NSPoint=ff}{_NSSize=ff}}l^lL^L@@@:::****{?=b1b1b1b1b1b27}}12@0:4L8"));
+
+ meth = class_getInstanceMethod (fooClass, @selector(_getATSTypesetterGuts:));
+ CHECK_IF (!strcmp (meth->method_types, "r@12@0:4r:8"));
+
+ meth = class_getInstanceMethod (fooClass, @selector(resumeWithSuspensionID:and:));
+ CHECK_IF (!strcmp (meth->method_types, "v16@0:4^{__NSAppleEventManagerSuspension=}8r^I12"));
+
+ meth = class_getInstanceMethod (fooClass, @selector(anotherMeth:and:and:));
+ CHECK_IF (!strcmp (meth->method_types, "r@20@0:4r:8r@12r@16"));
+
+ meth = class_getInstanceMethod (fooClass, @selector(str1:str2:str3:str4:));
+ CHECK_IF (!strcmp (meth->method_types, "@24@0:4r*8*12*16r*20"));
+
+ meth = class_getInstanceMethod (fooClass, @selector(foo1:foo2:foo3:foo4:));
+ CHECK_IF (!strcmp (meth->method_types, "Vv24@0:4@8r@12@16r@20"));
+
+ meth = class_getInstanceMethod (fooClass, @selector(sel1:id1:));
+ CHECK_IF (!strcmp (meth->method_types, "rn*16@0:4r:8r@12"));
+
+ meth = class_getInstanceMethod (fooClass, @selector(obj1:obj2:obj3:));
+ CHECK_IF (!strcmp (meth->method_types, "N@20@0:4r@8@12^{Object=#}16"));
+
+ meth = class_getClassMethod (fooClass, @selector(_defaultScriptingComponent));
+ CHECK_IF (!strcmp (meth->method_types, "^{ComponentInstanceRecord=[1l]}8@0:4"));
+
+ meth = class_getInstanceMethod (fooClass, @selector(_formatCocoaErrorString:parameters:applicableFormatters:count:));
+ CHECK_IF (!strcmp (meth->method_types, "@24@0:4@8r*12^^{?}16i20"));
+
+ meth = class_getInstanceMethod (fooClass, @selector(formatter_func:run:));
+ CHECK_IF (!strcmp (meth->method_types, "^{?=^?@I}16@0:4@8r^^{?}12"));
+
+ meth = class_getInstanceMethod (fooClass, @selector(_forgetWord:inDictionary:));
+ CHECK_IF (!strcmp (meth->method_types, "c16@0:4nO@8nO@12"));
+
+ meth = class_getInstanceMethod (fooClass, @selector(_registerServicesMenu:withSendTypes:andReturnTypes:addToList:));
+ CHECK_IF (!strcmp (meth->method_types, "v24@0:4@8r^*12r^*16c20"));
+
+ meth = class_getClassMethod (fooClass, @selector(_proxySharePointer));
+ CHECK_IF (!strcmp (meth->method_types, "^^{__CFSet}8@0:4"));
+
+ meth = class_getInstanceMethod (fooClass, @selector(_checkGrammarInString:language:details:));
+ CHECK_IF (!strcmp (meth->method_types, "{_NSRange=II}20@0:4n@8nO@12oO^@16"));
+
+ meth = class_getInstanceMethod (fooClass, @selector(_resolvePositionalStakeGlyphsForLineFragment:lineFragmentRect:minPosition:maxPosition:maxLineFragmentWidth:breakHint:));
+ CHECK_IF (!strcmp (meth->method_types, "B44@0:4^{__CTLine=}8{_NSRect={_NSPoint=ff}{_NSSize=ff}}12f28f32f36^I40"));
+
+ meth = class_getClassMethod (fooClass, @selector(findVoiceByIdentifier:returningCreator:returningID:));
+ CHECK_IF (!strcmp (meth->method_types, "c20@0:4@8^I12^I16"));
+
+ ivars = fooClass->ivars;
+ CHECK_IF (ivars->ivar_count == 1);
+
+ ivar = ivars->ivar_list;
+ CHECK_IF (!strcmp (ivar->ivar_name, "r"));
+ CHECK_IF (!strcmp (ivar->ivar_type,
+ "{?=\"_attributes\"@\"NSDictionary\"\"_font\"@\"NSFont\"\"_characterLength\""
+ "I\"_nominalGlyphLocation\"I\"p\"^I\"_defaultLineHeight\"f\"_defaultBaselineOffset\""
+ "f\"_horizExpansion\"f\"_baselineDelta\"f\"_attachmentBBox\"{_NSRect=\"origin\""
+ "{_NSPoint=\"x\"f\"y\"f}\"size\"{_NSSize=\"width\"f\"height\"f}}\"ll\"l\"llp\"^l\"ull\""
+ "L\"ullp\"^L\"a\"@\"a1\"@\"a2\"@\"b\":\"b1\":\"b2\":\"str1\"*\"str2\"*\"str3\"*\"str4\""
+ "*\"_rFlags\"{?=\"_isAttachmentRun\"b1\"_hasPositionalStake\"b1\"_isDefaultFace\""
+ "b1\"_hasCombiningMarks\"b1\"_isScreenFont\"b1\"_reserved\"b27}}"));
+
+ return 0;
+}
diff --git a/gcc/testsuite/objc.dg/proto-qual-1.m b/gcc/testsuite/objc.dg/proto-qual-1.m
index 7c6c62d241b..ac650aa25a7 100644
--- a/gcc/testsuite/objc.dg/proto-qual-1.m
+++ b/gcc/testsuite/objc.dg/proto-qual-1.m
@@ -44,10 +44,20 @@ static void scan_initial(const char *pattern) {
int main(void) {
meth = [proto descriptionForInstanceMethod: @selector(address:with:)];
+#ifndef __NEXT_RUNTIME__
scan_initial("O@%u@%u:%uRN@%uo^^S%u");
+#else
+ /* The NEXT runtime tries to be compatible with gcc-3.3 */
+ scan_initial("O@%u@%u:%uNR@%uo^^S%u");
+#endif
CHECK_IF(offs3 == offs2 + aligned_sizeof(id) && totsize == offs3 + aligned_sizeof(unsigned));
meth = [proto descriptionForClassMethod: @selector(retainArgument:with:)];
+#ifndef __NEXT_RUNTIME__
scan_initial("Vv%u@%u:%uoO@%un^*%u");
+#else
+ /* The NEXT runtime tries to be compatible with gcc-3.3 */
+ scan_initial("Vv%u@%u:%uOo@%un^*%u");
+#endif
CHECK_IF(offs3 == offs2 + aligned_sizeof(id) && totsize == offs3 + aligned_sizeof(char **));
return 0;
}
diff --git a/gcc/testsuite/objc.dg/threedotthree-abi-1.m b/gcc/testsuite/objc.dg/threedotthree-abi-1.m
new file mode 100644
index 00000000000..8e4f2bed174
--- /dev/null
+++ b/gcc/testsuite/objc.dg/threedotthree-abi-1.m
@@ -0,0 +1,68 @@
+/* This file tests that things are encoded using the gcc-3.3 ABI which is only
+ used by the NeXT runtime. */
+/* { dg-do run { target *-*-darwin* } } */
+/* { dg-skip-if "" { *-*-* } { "-fgnu-runtime" } { "" } } */
+#include <stdio.h>
+#include <string.h>
+#include "../objc-obj-c++-shared/Protocol1.h"
+
+extern void abort();
+
+
+@protocol CommonProtocol
+
+-(oneway void)methodCall_On:(in bycopy id)someValue_On;
+-(oneway void)methodCall_nO:(bycopy in id)someValue_nO;
+
+-(oneway void)methodCall_Oo:(out bycopy id)someValue_Oo;
+-(oneway void)methodCall_oO:(bycopy out id)someValue_oO;
+
+-(oneway void)methodCall_rn:(in const id)someValue_rn;
+
+-(oneway void)methodCall_oOn:(in bycopy out id)someValue_oOn;
+
+@end
+
+@interface ObjCClass <CommonProtocol>
+{
+
+}
+
+@end
+
+@implementation ObjCClass
+-(oneway void)methodCall_On:(in bycopy id)someValue_On { }
+-(oneway void)methodCall_nO:(bycopy in id)someValue_nO { }
+
+-(oneway void)methodCall_Oo:(out bycopy id)someValue_Oo { }
+-(oneway void)methodCall_oO:(bycopy out id)someValue_oO { }
+
+-(oneway void)methodCall_rn:(in const id)someValue_rn { }
+-(oneway void)methodCall_oOn:(in bycopy out id)someValue_oOn { }
+@end
+
+Protocol *proto = @protocol(CommonProtocol);
+struct objc_method_description *meth;
+
+int main()
+{
+ meth = [proto descriptionForInstanceMethod: @selector(methodCall_On:)];
+ if (strcmp (meth->types, "Vv12@0:4On@8"))
+ abort();
+ meth = [proto descriptionForInstanceMethod: @selector(methodCall_nO:)];
+ if (strcmp (meth->types, "Vv12@0:4nO@8"))
+ abort();
+ meth = [proto descriptionForInstanceMethod: @selector(methodCall_Oo:)];
+ if (strcmp (meth->types, "Vv12@0:4Oo@8"))
+ abort();
+ meth = [proto descriptionForInstanceMethod: @selector(methodCall_oO:)];
+ if (strcmp (meth->types, "Vv12@0:4oO@8"))
+ abort();
+ meth = [proto descriptionForInstanceMethod: @selector(methodCall_rn:)];
+ if (strcmp (meth->types, "Vv12@0:4rn@8"))
+ abort();
+ meth = [proto descriptionForInstanceMethod: @selector(methodCall_oOn:)];
+ if (strcmp (meth->types, "Vv12@0:4oOn@8"))
+ abort();
+ return 0;
+}
diff --git a/gcc/testsuite/objc.dg/type-size-2.m b/gcc/testsuite/objc.dg/type-size-2.m
index 2f8d517a3a3..499f0831dd2 100644
--- a/gcc/testsuite/objc.dg/type-size-2.m
+++ b/gcc/testsuite/objc.dg/type-size-2.m
@@ -48,7 +48,20 @@ int main(void) {
cls = objc_get_class("ArrayTest");
meth = class_get_instance_method(cls, @selector(str:with:and:));
- scan_initial("r*%u@%u:%u*%u*%u[4i]%u");
+
+ /* Here we have the complication that 'enum Enum' could be encoded
+ as 'i' on __NEXT_RUNTIME_, and (most likely) as 'I' on the GNU
+ runtime. So we get the @encode(enum Enum), then put it into the
+ string in place of the traditional 'i'.
+ */
+ /* scan_initial("r*%u@%u:%u*%u*%u[4i]%u"); */
+ {
+ char pattern[1024];
+
+ sprintf (pattern, "r*%%u@%%u:%%u*%%u*%%u[4%s]%%u", @encode(enum Enum));
+ scan_initial(pattern);
+ }
+
CHECK_IF(offs3 == offs2 + sizeof(signed char *) && offs4 == offs3 + sizeof(unsigned char *));
CHECK_IF(totsize == offs4 + sizeof(enum Enum *));
meth = class_get_instance_method(cls, @selector(meth1:with:with:));
diff --git a/gcc/testsuite/objc.dg/type-size-3.m b/gcc/testsuite/objc.dg/type-size-3.m
new file mode 100644
index 00000000000..9486658853c
--- /dev/null
+++ b/gcc/testsuite/objc.dg/type-size-3.m
@@ -0,0 +1,18 @@
+/* Reject ivars with an unknown size. */
+/* Contributed by Nicola Pero <nicola.pero@meta-innovation.com> */
+/* { dg-do compile } */
+
+typedef struct
+{
+ unsigned long int a;
+ double b[];
+} test_type;
+
+@interface Test
+{
+ test_type c;
+}
+@end
+
+@implementation Test
+@end /* { dg-error "instance variable has unknown size" } */