From 0c93aabd51a8b406ec3d7a77ab5df54961c565e8 Mon Sep 17 00:00:00 2001 From: iains Date: Fri, 22 Oct 2010 10:30:29 +0000 Subject: CFStrings for Darwin gcc/testsuite: Based on the CFString implementation in FSF apple/trunk branch. * lib/objc-dg.exp (objc-dg-runtest): Merge flags and additional flags so that the latter can be used in dg-skip and dg-xfail clauses. * lib/obj-c++-dg.exp (obj-c++-dg-runtest): Likewise. * obj-c++.dg/template-4.mm: Don't use CFStrings on Darwin. Update test to use dg-additional-files for Object1. * obj-c++.dg/const-str-7.mm: Don't use CFStrings on Darwin. Update test to use dg-additional-files for Object1, move to torture/strings/. * obj-c++.dg/const-str-4.mm: Likewise. * obj-c++.dg/const-str-3.mm: Likewise. * obj-c++.dg/const-str-8.mm: Likewise. * obj-c++.dg/const-str-9.mm: Likewise. * obj-c++.dg/const-str-10.mm: Likewise. * obj-c++.dg/const-str-10.mm: Likewise. * obj-c++.dg/const-str-1.mm: Don't use CFStrings on Darwin. Update test to use dg-additional-files for Object1, move to strings/. * obj-c++.dg/const-str-2.mm: Likewise. * obj-c++.dg/const-str-5.mm: Likewise. * obj-c++.dg/const-str-6.mm: Likewise. * obj-c++.dg/const-str-12.mm: Likewise. * obj-c++.dg/strings/strings.exp: New. * obj-c++.dg/strings/const-cfstring-2.mm: New. * obj-c++.dg/strings/const-cfstring-5.mm: New. * obj-c++.dg/torture/strings/strings.exp: New. * obj-c++.dg/torture/strings/string1.mm: New. * obj-c++.dg/torture/strings/const-cfstring-1.mm: New. * obj-c++.dg/torture/strings/const-cfstring-3.mm: New. * obj-c++.dg/torture/strings/const-cfstring-4.mm: New. * objc/execute/string1.m: Don't use CFStrings on Darwin. Update test to use dg-additional-files for Object1, move to objc.dg/torture/strings/. * objc/execute/string2.m: Likewise. * objc/execute/string3.m: Likewise. * objc/execute/string3.m: Likewise. * objc.dg/foreach-2.m: Don't use CFStrings on Darwin. * objc.dg/foreach-4.m: Likewise. * objc.dg/foreach-5.m: Likewise. * objc.dg/const-str-3.m: Don't use CFStrings on Darwin. Update test to use dg-additional-files for Object1, move to objc.dg/torture/strings/. * objc.dg/const-str-4.m: Likewise. * objc.dg/const-str-7.m: Likewise. * objc.dg/const-str-8.m: Likewise. * objc.dg/const-str-9.m: Likewise. * objc.dg/const-str-10.m: Likewise. * objc.dg/const-str-11.m: Likewise. * objc.dg/const-str-1.m: Don't use CFStrings on Darwin. Update test to use dg-additional-files for Object1, move to objc.dg/strings/. * objc.dg/const-str-2.m: Likewise. * objc.dg/const-str-5.m: Likewise. * objc.dg/const-str-6.m: Likewise. * objc.dg/const-str-12.m: Likewise. * objc.dg/const-str-12b.m: Likewise. * objc.dg/strings/strings.exp: New. * objc.dg/strings/const-cfstring-2.m: New. * objc.dg/strings/const-cfstring-5.m: New. * objc.dg/torture/strings/strings.exp: New. * objc.dg/torture/strings/const-cfstring-1.m: New. * objc.dg/torture/strings/const-cfstring-3.m: New. * objc.dg/torture/strings/const-cfstring-4.m: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@165821 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/testsuite/objc.dg/strings/const-cfstring-5.m | 26 ++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 gcc/testsuite/objc.dg/strings/const-cfstring-5.m (limited to 'gcc/testsuite/objc.dg/strings/const-cfstring-5.m') diff --git a/gcc/testsuite/objc.dg/strings/const-cfstring-5.m b/gcc/testsuite/objc.dg/strings/const-cfstring-5.m new file mode 100644 index 00000000000..13cb7895779 --- /dev/null +++ b/gcc/testsuite/objc.dg/strings/const-cfstring-5.m @@ -0,0 +1,26 @@ +/* Test if constant CFStrings may be passed back as ObjC strings. */ +/* Author: Ziemowit Laski */ + +/* So far, CFString is darwin-only. */ +/* { dg-do compile { target *-*-darwin* } } */ +/* { dg-skip-if "NeXT only" { *-*-* } { "-fgnu-runtime" } { "" } } */ +/* { dg-options "-mconstant-cfstrings" } */ + +#include + +@interface Foo: Object { + char *cString; + unsigned int len; +} ++ (Foo *)description; +@end + +@interface Bar: Object ++ (Foo *) getString: (int) which; +@end + +@implementation Bar ++ (Foo *) getString: (int) which { + return which? [Foo description]: @"Hello"; +} +@end -- cgit v1.2.1