aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite
diff options
context:
space:
mode:
authorNicola Pero <nicola.pero@meta-innovation.com>2010-09-27 19:22:13 +0000
committerNicola Pero <nicola@gcc.gnu.org>2010-09-27 19:22:13 +0000
commit177b48f93077a03a72cee7ab5897996e2ea47cdc (patch)
tree251b23a8c4eafe1915cb28c5bfe7d86fc70d2045 /gcc/testsuite
parent16562d86a761da90ead2fe637366b6e53043167b (diff)
downloadgcc-177b48f93077a03a72cee7ab5897996e2ea47cdc.zip
gcc-177b48f93077a03a72cee7ab5897996e2ea47cdc.tar.gz
gcc-177b48f93077a03a72cee7ab5897996e2ea47cdc.tar.bz2
In gcc/: 2010-09-27 Nicola Pero <nicola.pero@meta-innovation.com>
In gcc/: 2010-09-27 Nicola Pero <nicola.pero@meta-innovation.com> * doc/objc.texi (Type encoding): Added the new 'long double' (D) code. Added byref, which was missing in the list of codes. Explain that enumeration values are encoded as the integer type that the compiler uses to store them. Explain and make examples of how 'const' interacts with pointers, and the complication of the encoding of 'const char *'. (Legacy type encoding): New subsection, explaining that GCC emits incorrect type encodings for the NeXT runtime for compatibility reasons. (@@encode): New subsection, explaining @encode and particularly that protocol qualifiers are not recognized inside an @encode() expression. (Method signatures): New subsection, explaining how method signatures are encoded. In gcc/objc/: 2010-09-27 Nicola Pero <nicola.pero@meta-innovation.com> PR objc/45763 PR objc/25450 PR objc/25464 * objc-act.c: Improved comments for encoding functions. (encode_aggregate_within): For the GNU runtime, rewritten some obsfuscated code to clarify the various cases. (encode_aggregate): Function removed. (encode_array): Generate an error if asked to encode an incomplete array as part of generating instance variables. Else, when encoding an incomplete array inside a structure, encode it as an array of zero size. (encode_pointer): For the GNU runtime, fixed encoding 'BOOL *' as '^c' instead of '*'. (encode_gnu_bitfield): Encode enumerated types exactly in the same type as integer types instead of using a hardcoded 'i'. If asked to encode a non-integer type as a bitfield, do not abort compilation immediately; instead generate an error, then skip the type. (encode_type): Use a 'switch' instead of a sequence of 'if's. Added a 'default' clause that gets executed if the type can not be matched, and that encodes it as '?' (unknown) and produces a warning. For the GNU runtime, encode enumerated types exactly in the same way as integer types instead of using a hardcoded 'i'. Encode long double as 'D'. Encode 128-bit integers as 'T' or 't'. Encode C++ reference types as pointers. Call encode_vector to encode vectors. (encode_vector): New function. 2010-09-27 Nicola Pero <nicola.pero@meta-innovation.com> Merge from 'apple/trunk' branch on FSF servers. I modified the changes to be used only when compiling for the NeXT runtime. 2005-10-10 Fariborz Jahanian <fjahanian@apple.com> Radar 4301047 * objc-act.c (encode_type): Remove the hack. 2005-07-20 Ziemowit Laski <zlaski@apple.com> Radar 4136935 * objc-act.c (pointee_is_readonly): New function. (encode_pointer, encode_aggregate_within, encode_type): Attempt to emulate GCC 3.3 when generating type encodings. In gcc/testsuite/: 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. In libobjc/: 2010-09-26 Nicola Pero <nicola.pero@meta-innovation.com> * encoding.c (objc_sizeof_type): Added support for vector type and for double long types. (objc_alignof_type): Same change. (objc_skip_typespec): Same change. * objc/encoding.h (_C_GCINVISIBLE): Use '|' for _C_GCINVISIBLE instead of '!' since '!' is already used for _C_VECTOR. * objc/objc-api.h (_C_LNG_DBL): Added. From-SVN: r164659
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 24f0c17..150dac4 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 0000000..47673f2
--- /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 c5f5ea9..5f5ba20 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 4959ea3..18db3f3 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 0000000..56fa701
--- /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 50e9919..09cb6af 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 63a92e1..4322453 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 0000000..c3d9226
--- /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 263b02a..291a41e 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 0000000..2a064d8
--- /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 0000000..60db236
--- /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 7c6c62d..ac650aa 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 0000000..8e4f2be
--- /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 2f8d517..499f083 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 0000000..9486658
--- /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" } */