aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/obj-c++.dg
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/obj-c++.dg')
-rw-r--r--gcc/testsuite/obj-c++.dg/cxx-ivars-3.mm24
-rw-r--r--gcc/testsuite/obj-c++.dg/encode-2.mm8
-rw-r--r--gcc/testsuite/obj-c++.dg/encode-3.mm4
-rw-r--r--gcc/testsuite/obj-c++.dg/lto/lto.exp84
-rw-r--r--gcc/testsuite/obj-c++.dg/lto/trivial-1_0.mm43
-rw-r--r--gcc/testsuite/obj-c++.dg/tls/static-1.mm1
-rw-r--r--gcc/testsuite/obj-c++.dg/torture/tls/thr-init-1.mm1
-rw-r--r--gcc/testsuite/obj-c++.dg/torture/tls/thr-init-2.mm3
-rw-r--r--gcc/testsuite/obj-c++.dg/torture/tls/thr-init-3.mm1
9 files changed, 150 insertions, 19 deletions
diff --git a/gcc/testsuite/obj-c++.dg/cxx-ivars-3.mm b/gcc/testsuite/obj-c++.dg/cxx-ivars-3.mm
index a3c4b0c492a..e94e6ec57a2 100644
--- a/gcc/testsuite/obj-c++.dg/cxx-ivars-3.mm
+++ b/gcc/testsuite/obj-c++.dg/cxx-ivars-3.mm
@@ -1,13 +1,12 @@
// Check if ObjC classes with non-POD C++ ivars are specially marked in the metadata.
// { dg-do run { target *-*-darwin* } }
-// { dg-skip-if "" { *-*-* } { "-fgnu-runtime" } { "" } }
-// { dg-options "-fobjc-call-cxx-cdtors" }
-// { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } }
-
-#include "../objc-obj-c++-shared/Object1.h"
-#include "../objc-obj-c++-shared/next-mapping.h"
+// { dg-skip-if "" { *-*-* } { "-fgnu-runtime" } { "" } }
+// { dg-options "-fobjc-call-cxx-cdtors -mmacosx-version-min=10.4" }
+// This test has no equivalent or meaning for m64/ABI V2
+// { dg-xfail-run-if "No Test Avail" { *-*-darwin* && lp64 } { "-fnext-runtime" } { "" } }
+#include <objc/objc-runtime.h>
#include <stdlib.h>
#define CHECK_IF(expr) if(!(expr)) abort()
@@ -39,18 +38,17 @@ struct cxx_struct {
int main (void)
{
+#ifndef __LP64__
Class cls;
- cls = objc_get_class("Foo");
-#if NEXT_OBJC_USE_NEW_INTERFACE
- CHECK_IF(class_isMetaClass(cls) & CLS_HAS_CXX_STRUCTORS);
- cls = objc_getClass("Bar");
- CHECK_IF(!(class_isMetaClass(cls) & CLS_HAS_CXX_STRUCTORS));
-#else
+ cls = objc_getClass("Foo");
CHECK_IF(cls->info & CLS_HAS_CXX_STRUCTORS);
cls = objc_getClass("Bar");
CHECK_IF(!(cls->info & CLS_HAS_CXX_STRUCTORS));
+
+#else
+ /* No test needed or available. */
+ abort ();
#endif
return 0;
}
-#include "../objc-obj-c++-shared/Object1-implementation.h"
diff --git a/gcc/testsuite/obj-c++.dg/encode-2.mm b/gcc/testsuite/obj-c++.dg/encode-2.mm
index cfa9bc783e3..157bb526700 100644
--- a/gcc/testsuite/obj-c++.dg/encode-2.mm
+++ b/gcc/testsuite/obj-c++.dg/encode-2.mm
@@ -1,4 +1,5 @@
-/* { dg-do compile } */
+/* { dg-do assemble } */
+/* { dg-options "-save-temps" } */
template <class T>
struct Vec {
@@ -11,7 +12,7 @@ typedef struct {
Vec<float> fvec;
float fscalar;
double dscalar;
- Vec<char> chVec;
+ Vec<signed char> chVec;
int iscalar;
} anonymous;
@@ -23,4 +24,5 @@ const char *enc3 = @encode(anonymous);
/* { dg-final { scan-assembler "{Vec<float>=ffi}" } } */
/* { dg-final { scan-assembler "{Vec<double>=ddi}" } } */
-/* { dg-final { scan-assembler "{?={Vec<double>=ddi}{Vec<float>=ffi}fd{Vec<char>=cci}i}" } } */
+/* { dg-final { scan-file "encode-2.o" "{?={Vec<double>=ddi}{Vec<float>=ffi}fd{Vec<signed char>=cci}i}" } }
+/* { dg-final cleanup-saved-temps } */
diff --git a/gcc/testsuite/obj-c++.dg/encode-3.mm b/gcc/testsuite/obj-c++.dg/encode-3.mm
index 05193ae2c2f..8627a773e25 100644
--- a/gcc/testsuite/obj-c++.dg/encode-3.mm
+++ b/gcc/testsuite/obj-c++.dg/encode-3.mm
@@ -18,7 +18,7 @@ typedef struct {
int iscalar;
long z;
long long zz;
- Vec<const char> cv;
+ Vec<const signed char> cv;
} anonymous;
//Vec<double> dd;
@@ -44,7 +44,7 @@ int main(void) {
if (strcmp (enc2, "{Vec<double>=dd" L "q}"))
_exit(-(__LINE__));
- if (strcmp (enc3, "{?=f[10d]i" L "q{Vec<const char>=rcrc" L "q}}"))
+ if (strcmp (enc3, "{?=f[10d]i" L "q{Vec<const signed char>=rcrc" L "q}}"))
_exit(-(__LINE__));
return 0;
diff --git a/gcc/testsuite/obj-c++.dg/lto/lto.exp b/gcc/testsuite/obj-c++.dg/lto/lto.exp
new file mode 100644
index 00000000000..291895ffc01
--- /dev/null
+++ b/gcc/testsuite/obj-c++.dg/lto/lto.exp
@@ -0,0 +1,84 @@
+# Copyright (C) 2010 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING3. If not see
+# <http://www.gnu.org/licenses/>.
+#
+# Based on gcc/testsuite/gcc.dg/lto/lto.exp.
+
+# Test link-time optimization across multiple files.
+#
+# Programs are broken into multiple files. Each one is compiled
+# separately with LTO information. The final executable is generated
+# by collecting all the generated object files using regular LTO or WHOPR.
+
+if $tracelevel then {
+ strace $tracelevel
+}
+
+# Load procedures from common libraries.
+load_lib standard.exp
+load_lib obj-c++-dg.exp
+
+# Load the language-independent compabibility support procedures.
+load_lib lto.exp
+
+# If LTO has not been enabled, bail.
+if { ![check_effective_target_lto] } {
+ return
+}
+
+global LTO_OPTIONS
+
+set LTO_OPTIONS [list \
+ {-O0 -fwhopr -fgnu-runtime} \
+ {-O2 -fwhopr -fgnu-runtime} \
+ {-O0 -flto -fgnu-runtime} \
+ {-O2 -flto -fgnu-runtime} \
+]
+
+obj-c++_init
+lto_init no-mathlib
+
+# Define an identifier for use with this suite to avoid name conflicts
+# with other lto tests running at the same time.
+set sid "obj_cpp_lto"
+set tests [lsort [glob -nocomplain $srcdir/$subdir/*_0.mm]]
+
+# Main loop.
+foreach src $tests {
+ # If we're only testing specific files and this isn't one of them, skip it.
+ if ![runtest_file_p $runtests $src] then {
+ continue
+ }
+ lto-execute $src $sid
+}
+
+# darwin targets can also run code with the NeXT runtime.
+if [istarget "*-*-darwin*" ] {
+set LTO_OPTIONS [list \
+ {-O0 -fwhopr -fnext-runtime} \
+ {-O2 -fwhopr -fnext-runtime} \
+ {-O0 -flto -fnext-runtime} \
+ {-O2 -flto -fnext-runtime} \
+]
+ foreach src $tests {
+ # If we're only testing specific files and this isn't one of them, skip it.
+ if ![runtest_file_p $runtests $src] then {
+ continue
+ }
+ lto-execute $src $sid
+ }
+}
+
+lto_finish
diff --git a/gcc/testsuite/obj-c++.dg/lto/trivial-1_0.mm b/gcc/testsuite/obj-c++.dg/lto/trivial-1_0.mm
new file mode 100644
index 00000000000..45b6e702481
--- /dev/null
+++ b/gcc/testsuite/obj-c++.dg/lto/trivial-1_0.mm
@@ -0,0 +1,43 @@
+/* { dg-lto-do run } */
+/* { dg-skip-if "Needs OBJC2 ABI" { "*-*-darwin*" && lp64 } { "*" } { "" } } */
+extern "C" {
+extern int printf (char *,...) ;
+extern void abort (void) ;
+}
+
+typedef struct objc_class *Class;
+
+struct objc_class {
+ Class isa;
+ /* other stuff... */
+} ;
+
+@interface myRootObject {
+@public
+ Class isa;
+}
++initialize;
++(Class)class;
+
+@end
+
+@implementation myRootObject
++initialize {
+ return self;
+}
+
++(Class)class {
+ return (Class)self;
+}
+
+@end
+
+int main(void)
+{
+ Class cl = [myRootObject class];
+ if (cl != (Class)0) {
+ printf((char *)"trivial OK\n");
+ return 0;
+ }
+ abort () ;
+}
diff --git a/gcc/testsuite/obj-c++.dg/tls/static-1.mm b/gcc/testsuite/obj-c++.dg/tls/static-1.mm
index 2d20b8881f9..6d58010eb0c 100644
--- a/gcc/testsuite/obj-c++.dg/tls/static-1.mm
+++ b/gcc/testsuite/obj-c++.dg/tls/static-1.mm
@@ -1,5 +1,6 @@
// { dg-do run }
// { dg-require-effective-target tls }
+// { dg-add-options tls }
// { dg-additional-sources "static-1a.mm" }
extern "C" {
diff --git a/gcc/testsuite/obj-c++.dg/torture/tls/thr-init-1.mm b/gcc/testsuite/obj-c++.dg/torture/tls/thr-init-1.mm
index 056073789a5..1ec8623f3ee 100644
--- a/gcc/testsuite/obj-c++.dg/torture/tls/thr-init-1.mm
+++ b/gcc/testsuite/obj-c++.dg/torture/tls/thr-init-1.mm
@@ -1,5 +1,6 @@
// { dg-do run }
// { dg-require-effective-target tls }
+// { dg-add-options tls }
/* { dg-skip-if "PR44140" { *-*-* } { "-flto" "-fwhopr" } { "" } } */
extern "C" {
extern void abort ();
diff --git a/gcc/testsuite/obj-c++.dg/torture/tls/thr-init-2.mm b/gcc/testsuite/obj-c++.dg/torture/tls/thr-init-2.mm
index 233cf20e132..4e5baac790d 100644
--- a/gcc/testsuite/obj-c++.dg/torture/tls/thr-init-2.mm
+++ b/gcc/testsuite/obj-c++.dg/torture/tls/thr-init-2.mm
@@ -1,5 +1,6 @@
// { dg-do run }
// { dg-require-effective-target tls }
+// { dg-add-options tls }
/* { dg-skip-if "PR44140" { *-*-* } { "-flto" "-fwhopr" } { "" } } */
extern "C" {
@@ -42,4 +43,4 @@ int main (int ac, char *av[])
abort () ;
return 0;
-} \ No newline at end of file
+}
diff --git a/gcc/testsuite/obj-c++.dg/torture/tls/thr-init-3.mm b/gcc/testsuite/obj-c++.dg/torture/tls/thr-init-3.mm
index e106a9fe878..1515d250057 100644
--- a/gcc/testsuite/obj-c++.dg/torture/tls/thr-init-3.mm
+++ b/gcc/testsuite/obj-c++.dg/torture/tls/thr-init-3.mm
@@ -1,5 +1,6 @@
/* { dg-do run } */
/* { dg-require-effective-target tls } */
+/* { dg-add-options tls } */
/* { dg-skip-if "PR44140" { *-*-* } { "-flto" "-fwhopr" } { "" } } */
/* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */
/* { dg-additional-sources "../../../objc-obj-c++-shared/Object1.mm" } */