diff options
author | Ziemowit Laski <zlaski@apple.com> | 2005-06-29 21:01:29 +0000 |
---|---|---|
committer | Ziemowit Laski <zlaski@gcc.gnu.org> | 2005-06-29 21:01:29 +0000 |
commit | c64de75f40ec7f27630860a2950da995fff3771a (patch) | |
tree | 6eb42b09d8fffee909d4e2a323a1040fbd7da55c /gcc/testsuite | |
parent | d5dfe0b8c26fbe6a76765713dc3c37aea01d9b26 (diff) | |
download | gcc-c64de75f40ec7f27630860a2950da995fff3771a.zip gcc-c64de75f40ec7f27630860a2950da995fff3771a.tar.gz gcc-c64de75f40ec7f27630860a2950da995fff3771a.tar.bz2 |
darwin.c (machopic_select_section): constant ObjC string objects now always have type "__builtin_ObjCString".
[gcc/ChangeLog]
2005-06-29 Ziemowit Laski <zlaski@apple.com>
* config/darwin.c (machopic_select_section): constant ObjC string
objects now always have type "__builtin_ObjCString".
[gcc/objc/ChangeLog]
2005-06-29 Ziemowit Laski <zlaski@apple.com>
* objc-act.c (objc_build_internal_const_str_type): New function.
(check_string_class_template): Use objc_get_class_ivars() instead
of TYPE_FIELDS() to retrieve ivar list.
(AT_LEAST_AS_LARGE_AS): Check the size of each field's type rather
than the field itself.
(objc_build_string_object): Synthesize a "__builtin_ObjCString"
type and use it to lay out compile-time string objects.
* objc-act.h (OCTI_INTERNAL_CNST_STR_TYPE, internal_const_str_type):
New.
[gcc/testsuite/ChangeLog]
2005-06-29 Ziemowit Laski <zlaski@apple.com>
* obj-c++.dg/const-str-1[0-1].mm: New.
* objc.dg/const-str-1[0-1].m: New.
From-SVN: r101437
Diffstat (limited to 'gcc/testsuite')
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/obj-c++.dg/const-str-10.mm | 28 | ||||
-rw-r--r-- | gcc/testsuite/obj-c++.dg/const-str-11.mm | 27 | ||||
-rw-r--r-- | gcc/testsuite/objc.dg/const-str-10.m | 28 | ||||
-rw-r--r-- | gcc/testsuite/objc.dg/const-str-11.m | 27 |
5 files changed, 115 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 0c5663f..0ba3b14 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2005-06-29 Ziemowit Laski <zlaski@apple.com> + + * obj-c++.dg/const-str-1[0-1].mm: New. + * objc.dg/const-str-1[0-1].m: New. + 2005-05-29 Richard Henderson <rth@redhat.com> * lib/target-supports.exp (check_effective_target_vect_no_int_max): diff --git a/gcc/testsuite/obj-c++.dg/const-str-10.mm b/gcc/testsuite/obj-c++.dg/const-str-10.mm new file mode 100644 index 0000000..4efe044 --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/const-str-10.mm @@ -0,0 +1,28 @@ +/* Test if ObjC constant string layout is checked properly, regardless of how + constant string classes get derived. */ +/* Contributed by Ziemowit Laski <zlaski@apple.com> */ + +/* { dg-options "-fnext-runtime" } */ +/* { dg-do compile { target *-*-darwin* } } */ + +#include <objc/Object.h> + +@interface NSString: Object +@end + +@interface NSSimpleCString : NSString { +@protected + char *bytes; + unsigned int numBytes; +} +@end + +@interface NSConstantString : NSSimpleCString +@end + +extern struct objc_class _NSConstantStringClassReference; + +const NSConstantString *appKey = @"MyApp"; + +/* { dg-final { scan-assembler ".section __OBJC, __cstring_object" } } */ +/* { dg-final { scan-assembler ".long\t__NSConstantStringClassReference\n\t.long\t.*\n\t.long\t5\n\t.data" } } */ diff --git a/gcc/testsuite/obj-c++.dg/const-str-11.mm b/gcc/testsuite/obj-c++.dg/const-str-11.mm new file mode 100644 index 0000000..3b7ec7a --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/const-str-11.mm @@ -0,0 +1,27 @@ +/* Test if ObjC constant string layout is checked properly, regardless of how + constant string classes get derived. */ +/* Contributed by Ziemowit Laski <zlaski@apple.com> */ + +/* { dg-options "-fnext-runtime -fconstant-string-class=XStr" } */ +/* { dg-do compile { target *-*-darwin* } } */ + +#include <objc/Object.h> + +@interface XString: Object { +@protected + char *bytes; +} +@end + +@interface XStr : XString { +@public + unsigned int len; +} +@end + +extern struct objc_class _XStrClassReference; + +const XStr *appKey = @"MyApp"; + +/* { dg-final { scan-assembler ".section __OBJC, __cstring_object" } } */ +/* { dg-final { scan-assembler ".long\t__XStrClassReference\n\t.long\t.*\n\t.long\t5\n\t.data" } } */ diff --git a/gcc/testsuite/objc.dg/const-str-10.m b/gcc/testsuite/objc.dg/const-str-10.m new file mode 100644 index 0000000..4efe044 --- /dev/null +++ b/gcc/testsuite/objc.dg/const-str-10.m @@ -0,0 +1,28 @@ +/* Test if ObjC constant string layout is checked properly, regardless of how + constant string classes get derived. */ +/* Contributed by Ziemowit Laski <zlaski@apple.com> */ + +/* { dg-options "-fnext-runtime" } */ +/* { dg-do compile { target *-*-darwin* } } */ + +#include <objc/Object.h> + +@interface NSString: Object +@end + +@interface NSSimpleCString : NSString { +@protected + char *bytes; + unsigned int numBytes; +} +@end + +@interface NSConstantString : NSSimpleCString +@end + +extern struct objc_class _NSConstantStringClassReference; + +const NSConstantString *appKey = @"MyApp"; + +/* { dg-final { scan-assembler ".section __OBJC, __cstring_object" } } */ +/* { dg-final { scan-assembler ".long\t__NSConstantStringClassReference\n\t.long\t.*\n\t.long\t5\n\t.data" } } */ diff --git a/gcc/testsuite/objc.dg/const-str-11.m b/gcc/testsuite/objc.dg/const-str-11.m new file mode 100644 index 0000000..3b7ec7a --- /dev/null +++ b/gcc/testsuite/objc.dg/const-str-11.m @@ -0,0 +1,27 @@ +/* Test if ObjC constant string layout is checked properly, regardless of how + constant string classes get derived. */ +/* Contributed by Ziemowit Laski <zlaski@apple.com> */ + +/* { dg-options "-fnext-runtime -fconstant-string-class=XStr" } */ +/* { dg-do compile { target *-*-darwin* } } */ + +#include <objc/Object.h> + +@interface XString: Object { +@protected + char *bytes; +} +@end + +@interface XStr : XString { +@public + unsigned int len; +} +@end + +extern struct objc_class _XStrClassReference; + +const XStr *appKey = @"MyApp"; + +/* { dg-final { scan-assembler ".section __OBJC, __cstring_object" } } */ +/* { dg-final { scan-assembler ".long\t__XStrClassReference\n\t.long\t.*\n\t.long\t5\n\t.data" } } */ |