From 554fd8c5195424bdbcabf5de30fdc183aba391bd Mon Sep 17 00:00:00 2001 From: upstream source tree Date: Sun, 15 Mar 2015 20:14:05 -0400 Subject: obtained gcc-4.6.4.tar.bz2 from upstream website; verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository. --- gcc/testsuite/obj-c++.dg/tls/diag-1.mm | 12 ++++++++++++ gcc/testsuite/obj-c++.dg/tls/diag-2.mm | 26 ++++++++++++++++++++++++++ gcc/testsuite/obj-c++.dg/tls/diag-3.mm | 11 +++++++++++ gcc/testsuite/obj-c++.dg/tls/diag-4.mm | 10 ++++++++++ gcc/testsuite/obj-c++.dg/tls/diag-5.mm | 4 ++++ gcc/testsuite/obj-c++.dg/tls/init-1.mm | 14 ++++++++++++++ gcc/testsuite/obj-c++.dg/tls/init-2.mm | 14 ++++++++++++++ gcc/testsuite/obj-c++.dg/tls/static-1.mm | 31 +++++++++++++++++++++++++++++++ gcc/testsuite/obj-c++.dg/tls/static-1a.mm | 17 +++++++++++++++++ gcc/testsuite/obj-c++.dg/tls/tls.exp | 25 +++++++++++++++++++++++++ gcc/testsuite/obj-c++.dg/tls/trivial.m | 3 +++ 11 files changed, 167 insertions(+) create mode 100644 gcc/testsuite/obj-c++.dg/tls/diag-1.mm create mode 100644 gcc/testsuite/obj-c++.dg/tls/diag-2.mm create mode 100644 gcc/testsuite/obj-c++.dg/tls/diag-3.mm create mode 100644 gcc/testsuite/obj-c++.dg/tls/diag-4.mm create mode 100644 gcc/testsuite/obj-c++.dg/tls/diag-5.mm create mode 100644 gcc/testsuite/obj-c++.dg/tls/init-1.mm create mode 100644 gcc/testsuite/obj-c++.dg/tls/init-2.mm create mode 100644 gcc/testsuite/obj-c++.dg/tls/static-1.mm create mode 100644 gcc/testsuite/obj-c++.dg/tls/static-1a.mm create mode 100644 gcc/testsuite/obj-c++.dg/tls/tls.exp create mode 100644 gcc/testsuite/obj-c++.dg/tls/trivial.m (limited to 'gcc/testsuite/obj-c++.dg/tls') diff --git a/gcc/testsuite/obj-c++.dg/tls/diag-1.mm b/gcc/testsuite/obj-c++.dg/tls/diag-1.mm new file mode 100644 index 000000000..7c3245d9f --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/tls/diag-1.mm @@ -0,0 +1,12 @@ +// Valid __thread specifiers. +// { dg-require-effective-target tls } + +__thread int g1; +extern __thread int g2; +static __thread int g3; + +void foo() +{ + extern __thread int l1; + static __thread int l2; +} diff --git a/gcc/testsuite/obj-c++.dg/tls/diag-2.mm b/gcc/testsuite/obj-c++.dg/tls/diag-2.mm new file mode 100644 index 000000000..de88eb193 --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/tls/diag-2.mm @@ -0,0 +1,26 @@ +/* Invalid __thread specifiers. */ +/* { dg-require-effective-target tls } */ + +__thread extern int g1; /* { dg-error "'__thread' before 'extern'" } */ +__thread static int g2; /* { dg-error "'__thread' before 'static'" } */ +__thread __thread int g3; /* { dg-error "duplicate '__thread'" } */ +typedef __thread int g4; /* { dg-error "multiple storage classes" } */ + +void foo() +{ + __thread int l1; /* { dg-error "implicitly auto and declared '__thread'" } */ + auto __thread int l2; /* { dg-error "multiple storage classes" } */ + __thread extern int l3; /* { dg-error "'__thread' before 'extern'" } */ + register __thread int l4; /* { dg-error "multiple storage classes" } */ +} + +__thread void f1 (); /* { dg-error "storage class '__thread' invalid for function 'f1'" } */ +extern __thread void f2 (); /* { dg-error "storage class '__thread' invalid for function 'f2'" } */ +static __thread void f3 (); /* { dg-error "storage class '__thread' invalid for function 'f3'" } */ +__thread void f4 () { } /* { dg-error "storage class '__thread' invalid for function 'f4'" } */ + +void bar(__thread int p1); /* { dg-error "(invalid in parameter)|(specified for parameter)" } */ + +struct A { + __thread int i; /* { dg-error "storage class specified for 'i'" } */ +}; diff --git a/gcc/testsuite/obj-c++.dg/tls/diag-3.mm b/gcc/testsuite/obj-c++.dg/tls/diag-3.mm new file mode 100644 index 000000000..0a597b20f --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/tls/diag-3.mm @@ -0,0 +1,11 @@ +/* Report invalid extern and __thread combinations. */ +/* { dg-require-effective-target tls } */ + +extern int j; /* { dg-error "previously declared here" } */ +__thread int j; /* { dg-error "follows non-thread-local" } */ + +extern __thread int i; /* { dg-error "previously declared here" } */ +int i; /* { dg-error "follows thread-local" } */ + +extern __thread int k; /* This is fine. */ +__thread int k; diff --git a/gcc/testsuite/obj-c++.dg/tls/diag-4.mm b/gcc/testsuite/obj-c++.dg/tls/diag-4.mm new file mode 100644 index 000000000..10ac2aada --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/tls/diag-4.mm @@ -0,0 +1,10 @@ +/* Invalid __thread specifiers. */ +/* { dg-require-effective-target tls } */ + +__thread typedef int g4; /* { dg-error "multiple storage classes in declaration of" } */ + +void foo() +{ + __thread auto int l2; /* { dg-error "multiple storage classes in declaration of" } */ + __thread register int l4; /* { dg-error "multiple storage classes in declaration of" } */ +} diff --git a/gcc/testsuite/obj-c++.dg/tls/diag-5.mm b/gcc/testsuite/obj-c++.dg/tls/diag-5.mm new file mode 100644 index 000000000..413d107f2 --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/tls/diag-5.mm @@ -0,0 +1,4 @@ +/* __thread specifiers on empty declarations. */ +/* { dg-require-effective-target tls } */ + +__thread struct foo; /* { dg-error "qualifiers can only be specified for objects and functions" } */ diff --git a/gcc/testsuite/obj-c++.dg/tls/init-1.mm b/gcc/testsuite/obj-c++.dg/tls/init-1.mm new file mode 100644 index 000000000..943088713 --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/tls/init-1.mm @@ -0,0 +1,14 @@ +/* Invalid initializations. */ +/* { dg-require-effective-target tls } */ + +__thread int i = 42; + +static int j; +__thread int *p = &j; + +/* Note that this is valid in C++ (unlike C) as a run-time initialization. */ +int *q = &i; + +/* Valid because "const int k" is an integral constant expression in C++. */ +__thread const int k = 42; +__thread const int l = k; \ No newline at end of file diff --git a/gcc/testsuite/obj-c++.dg/tls/init-2.mm b/gcc/testsuite/obj-c++.dg/tls/init-2.mm new file mode 100644 index 000000000..dc886ba01 --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/tls/init-2.mm @@ -0,0 +1,14 @@ +/* Invalid initializations. */ +/* { dg-require-effective-target tls } */ + +extern __thread int i; +__thread int *p = &i; /* { dg-error "dynamically initialized" } */ + +extern int f(); +__thread int j = f(); /* { dg-error "dynamically initialized" } */ + +struct S +{ + S(); +}; +__thread S s; /* { dg-error "" } two errors here */ diff --git a/gcc/testsuite/obj-c++.dg/tls/static-1.mm b/gcc/testsuite/obj-c++.dg/tls/static-1.mm new file mode 100644 index 000000000..6d58010eb --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/tls/static-1.mm @@ -0,0 +1,31 @@ +// { dg-do run } +// { dg-require-effective-target tls } +// { dg-add-options tls } +// { dg-additional-sources "static-1a.mm" } + +extern "C" { +extern void abort (); +} +extern int test (); + +struct A +{ + static __thread int i; +}; + +__thread int A::i = 8; + +int +main () +{ + if (A::i != 8) + abort (); + + if (test ()) + abort (); + + if (A::i != 17) + abort (); + + return 0; +} diff --git a/gcc/testsuite/obj-c++.dg/tls/static-1a.mm b/gcc/testsuite/obj-c++.dg/tls/static-1a.mm new file mode 100644 index 000000000..40974205f --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/tls/static-1a.mm @@ -0,0 +1,17 @@ +// { dg-skip-if "Additional Source File" *-*-* "*" "" } +// This is the additional source file for test static-1.mm + +struct A +{ + static __thread int i; +}; + +int +test () +{ + if (A::i != 8) + return 1; + + A::i = 17; + return 0; +} diff --git a/gcc/testsuite/obj-c++.dg/tls/tls.exp b/gcc/testsuite/obj-c++.dg/tls/tls.exp new file mode 100644 index 000000000..a4ba6393f --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/tls/tls.exp @@ -0,0 +1,25 @@ +# Load support procs. +load_lib obj-c++-dg.exp + +# If a testcase doesn't have special options, use these. +global DEFAULT_OBJCXXFLAGS +if ![info exists DEFAULT_OBJCXXFLAGS] then { + set DEFAULT_OBJCXXFLAGS " -ansi -pedantic-errors -Wno-long-long" +} + +# Initialize `dg'. +dg-init + +# Gather a list of all tests. +set tests [lsort [glob -nocomplain $srcdir/$subdir/*.mm]] + +# Main loop. +dg-runtest $tests "-fgnu-runtime" $DEFAULT_OBJCXXFLAGS + +# darwin targets can also run code with the NeXT runtime. +if [istarget "*-*-darwin*" ] { +dg-runtest $tests "-fnext-runtime" $DEFAULT_OBJCXXFLAGS +} + +# All done. +dg-finish diff --git a/gcc/testsuite/obj-c++.dg/tls/trivial.m b/gcc/testsuite/obj-c++.dg/tls/trivial.m new file mode 100644 index 000000000..e2b8f45b8 --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/tls/trivial.m @@ -0,0 +1,3 @@ +// { dg-require-effective-target tls } + +__thread int i; -- cgit v1.2.3