dg.exp: Exclude debug subdir, it has its own .exp.
authorJakub Jelinek <jakub@redhat.com>
Thu, 14 Feb 2002 14:17:42 +0000 (15:17 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Thu, 14 Feb 2002 14:17:42 +0000 (15:17 +0100)
* g++.dg/dg.exp: Exclude debug subdir, it has its own .exp.
* g++.dg/debug/debug.exp: New.
* g++.dg/debug/trivial.C: New.
* g++.dg/debug/debug1.C: Moved...
* g++.dg/other/debug1.C: ...from here.
* g++.dg/debug/debug2.C: Moved...
* g++.dg/other/debug2.C: ...from here.
* g++.dg/debug/debug3.C: Moved...
* g++.dg/other/debug3.C: ...from here.

From-SVN: r49766

gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/debug/debug.exp [new file with mode: 0644]
gcc/testsuite/g++.dg/debug/debug1.C [new file with mode: 0644]
gcc/testsuite/g++.dg/debug/debug2.C [new file with mode: 0644]
gcc/testsuite/g++.dg/debug/debug3.C [new file with mode: 0644]
gcc/testsuite/g++.dg/debug/trivial.C [new file with mode: 0644]
gcc/testsuite/g++.dg/dg.exp
gcc/testsuite/g++.dg/other/debug1.C [deleted file]
gcc/testsuite/g++.dg/other/debug2.C [deleted file]
gcc/testsuite/g++.dg/other/debug3.C [deleted file]

index b139854f0462d49d58e8798bcaa761cfd8d2015f..2cf855f20601ae801a1c63ed1c4d3afcc31c81f4 100644 (file)
@@ -1,5 +1,15 @@
 2002-02-14  Jakub Jelinek  <jakub@redhat.com>
 
+       * g++.dg/dg.exp: Exclude debug subdir, it has its own .exp.
+       * g++.dg/debug/debug.exp: New.
+       * g++.dg/debug/trivial.C: New.
+       * g++.dg/debug/debug1.C: Moved...
+       * g++.dg/other/debug1.C: ...from here.
+       * g++.dg/debug/debug2.C: Moved...
+       * g++.dg/other/debug2.C: ...from here.
+       * g++.dg/debug/debug3.C: Moved...
+       * g++.dg/other/debug3.C: ...from here.
+
        * gcc.dg/noncompile/20020213-1.c: New test.
 
 2002-02-13  Jakub Jelinek  <jakub@redhat.com>
diff --git a/gcc/testsuite/g++.dg/debug/debug.exp b/gcc/testsuite/g++.dg/debug/debug.exp
new file mode 100644 (file)
index 0000000..6622179
--- /dev/null
@@ -0,0 +1,78 @@
+#   Copyright (C) 2002 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 2 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 this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  
+
+# G++ testsuite that uses the `dg.exp' driver.
+
+# Load support procs.
+load_lib g++-dg.exp
+
+# This is the list of debugging options we'll try.  Some of them won't
+# be supported, that's OK; they will be quickly eliminated.
+# It's probably not a good idea to add more optimisation options.
+
+if ![info exists DEBUG_TORTURE_OPTIONS] {
+    set DEBUG_TORTURE_OPTIONS ""
+    foreach type {-gdwarf-2 -gstabs -gstabs+ -gxcoff -gxcoff+ -gcoff} {
+       set comp_output [g++_target_compile \
+               "$srcdir/$subdir/trivial.C" "trivial.S" assembly \
+               "additional_flags=$type"]
+       if { ! [string match "*: unknown or unsupported -g option*" \
+               $comp_output] } {
+           foreach level {1 "" 3} {
+               lappend DEBUG_TORTURE_OPTIONS [list "${type}${level}"]
+               foreach opt { -O2 -O3 } {
+                   lappend DEBUG_TORTURE_OPTIONS \
+                           [list "${type}${level}" "$opt" ]
+               }
+           }
+       }
+    }
+}
+
+verbose -log "Using options $DEBUG_TORTURE_OPTIONS"
+
+# Initialize `dg'.
+dg-init
+
+# Main loop.
+
+foreach test [lsort [glob -nocomplain $srcdir/$subdir/*.C]] {
+    global runtests
+
+    # If we're only testing specific files and this isn't one of 
+    # them, skip it.
+    if ![runtest_file_p $runtests $test] {
+       continue
+    }
+
+    set nshort [file tail [file dirname $test]]/[file tail $test]
+
+    foreach flags $DEBUG_TORTURE_OPTIONS {
+       set doit 1
+       # if { [string match {*/debug-[126].c} "$nshort"] \
+       #       && [string match "*1" [lindex "$flags" 0] ] } { 
+       #    set doit 0
+       # }
+       
+       if { $doit } {
+           verbose -log "Testing $nshort, $flags" 1
+           dg-test $test $flags ""
+       }
+    }
+}
+
+# All done.
+dg-finish
diff --git a/gcc/testsuite/g++.dg/debug/debug1.C b/gcc/testsuite/g++.dg/debug/debug1.C
new file mode 100644 (file)
index 0000000..3efcbc9
--- /dev/null
@@ -0,0 +1,48 @@
+// Test whether dwarf2 debug info works with named return value optimization
+// { dg-do compile }
+
+struct S
+{
+  virtual ~S();
+  S (const char *str);
+  S& operator= (const char *str);
+  operator const char *() const;
+  S& operator+= (const char *str);
+};
+inline S operator+ (const char *s1, const S &s2)
+{
+  S x (s1);
+  x += s2;
+  return x;
+}
+struct U
+{
+  U ();
+  U& operator= (const char *);
+  const char *foo() const;
+  operator const char *() const { return foo(); }
+};
+template <class T> struct V
+{
+  T v;
+};
+template <class T> struct W
+{
+  V<T> *w;
+  W() : w (0) {}
+  const T& operator* () const { return w->v; }
+  T& operator* () { return w->v; }
+};
+struct X {
+  X();
+};
+struct Y {
+  Y (const U &u);
+};
+X::X()
+{
+  W<U> a;
+  U b;
+  b = (*a) + "xx";
+  Y c (b);
+}
diff --git a/gcc/testsuite/g++.dg/debug/debug2.C b/gcc/testsuite/g++.dg/debug/debug2.C
new file mode 100644 (file)
index 0000000..e016420
--- /dev/null
@@ -0,0 +1,42 @@
+/* Verify that sched re-inserts needed scopes properly.  */
+/* { dg-do compile } */
+/* { dg-options "-mcpu=ev5" { target alpha*-*-* } } */
+
+template <class T>
+inline void foo()
+{
+  void (T::*x)() __attribute__ ((__unused__)) = &T::bar;
+}
+
+template <class T>
+struct D
+{
+  void bar() {
+  }
+  T i;
+};
+
+template <class T>
+struct E
+{
+  void bar() {
+    foo <D<T> > ();
+    *i-- = *i;
+  }
+  T i;
+};
+
+struct A {};
+template<typename T> struct B { typedef typename T::t t; };
+template<typename T> struct B<T*> { typedef T& t; };
+template<typename T>
+struct C
+{
+  T b;
+  explicit C (const T& i) : b (i) { }
+  typename B<T>::t operator* () const { return *b; }
+  C operator-- (int) { return C (b--); }
+};
+
+template void foo <E<C<A**> > > ();
+template void foo <D<C<A**> > > ();
diff --git a/gcc/testsuite/g++.dg/debug/debug3.C b/gcc/testsuite/g++.dg/debug/debug3.C
new file mode 100644 (file)
index 0000000..91ef35d
--- /dev/null
@@ -0,0 +1,47 @@
+// PR optimization/5547
+// This testcase caused ICE on IA-32, since DWARF-2 was unable
+// to emit location expression for parameter a of operator+.
+// { dg-do compile }
+// { dg-options "-fpic" }
+
+struct A { char *s; };
+
+inline A operator+ (char a, const A &b)
+{
+  A s;
+  s.s = new char[12];
+  s.s[0] = a;
+  return s;
+}
+
+int b (const A &);
+
+void test1 (const A &x, int y)
+{
+  int j = b ("012345"[y] + x);
+  for (int i = 0; i < y; i++);
+}
+
+void test2 (const A &x, int y)
+{
+  int j = b ("012345678"[y + 2] + x);
+  for (int i = 0; i < y; i++);
+}
+
+void test3 (const A &x, int y)
+{
+  int j = b ("012345678"[y - 6] + x);
+  for (int i = 0; i < y; i++);
+}
+
+void test4 (const A &x, int y)
+{
+  int j = b ("012345678"[2 * y - 10] + x);
+  for (int i = 0; i < y; i++);
+}
+
+void test5 (const A &x, int y)
+{
+  int j = b ("012345678"[4 * y] + x);
+  for (int i = 0; i < y; i++);
+}
diff --git a/gcc/testsuite/g++.dg/debug/trivial.C b/gcc/testsuite/g++.dg/debug/trivial.C
new file mode 100644 (file)
index 0000000..5b125ec
--- /dev/null
@@ -0,0 +1,6 @@
+/* { dg-do run } */
+
+int main(void)
+{
+  return 0;
+}
index 6667d672cfa100a8e08765a12256fdcc921af66a..169d7225446a02b0daa65e35dd9e5dc7f1b52142 100644 (file)
@@ -31,7 +31,7 @@ dg-init
 # Gather a list of all tests, excluding those in special/; those are handled
 # well, specially.
 set all [lsort [find $srcdir/$subdir *.C]]
-set tests [prune $all $srcdir/$subdir/special/*]
+set tests [prune [prune $all $srcdir/$subdir/special/*] $srcdir/$subdir/debug/*]
 
 # Main loop.
 dg-runtest $tests "" $DEFAULT_CXXFLAGS
diff --git a/gcc/testsuite/g++.dg/other/debug1.C b/gcc/testsuite/g++.dg/other/debug1.C
deleted file mode 100644 (file)
index c284e23..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-// Test whether dwarf2 debug info works with named return value optimization
-// { dg-do compile { target i?86-*-linux* } }
-// { dg-options "-O2 -gdwarf-2" }
-
-struct S
-{
-  virtual ~S();
-  S (const char *str);
-  S& operator= (const char *str);
-  operator const char *() const;
-  S& operator+= (const char *str);
-};
-inline S operator+ (const char *s1, const S &s2)
-{
-  S x (s1);
-  x += s2;
-  return x;
-}
-struct U
-{
-  U ();
-  U& operator= (const char *);
-  const char *foo() const;
-  operator const char *() const { return foo(); }
-};
-template <class T> struct V
-{
-  T v;
-};
-template <class T> struct W
-{
-  V<T> *w;
-  W() : w (0) {}
-  const T& operator* () const { return w->v; }
-  T& operator* () { return w->v; }
-};
-struct X {
-  X();
-};
-struct Y {
-  Y (const U &u);
-};
-X::X()
-{
-  W<U> a;
-  U b;
-  b = (*a) + "xx";
-  Y c (b);
-}
diff --git a/gcc/testsuite/g++.dg/other/debug2.C b/gcc/testsuite/g++.dg/other/debug2.C
deleted file mode 100644 (file)
index 6260f5b..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-/* Verify that sched re-inserts needed scopes properly.  */
-/* { dg-do compile } */
-/* { dg-options "-O2 -g" } */
-/* { dg-options "-O2 -g -mcpu=ev5" { target alpha*-*-* } } */
-
-template <class T>
-inline void foo()
-{
-  void (T::*x)() __attribute__ ((__unused__)) = &T::bar;
-}
-
-template <class T>
-struct D
-{
-  void bar() {
-  }
-  T i;
-};
-
-template <class T>
-struct E
-{
-  void bar() {
-    foo <D<T> > ();
-    *i-- = *i;
-  }
-  T i;
-};
-
-struct A {};
-template<typename T> struct B { typedef typename T::t t; };
-template<typename T> struct B<T*> { typedef T& t; };
-template<typename T>
-struct C
-{
-  T b;
-  explicit C (const T& i) : b (i) { }
-  typename B<T>::t operator* () const { return *b; }
-  C operator-- (int) { return C (b--); }
-};
-
-template void foo <E<C<A**> > > ();
-template void foo <D<C<A**> > > ();
diff --git a/gcc/testsuite/g++.dg/other/debug3.C b/gcc/testsuite/g++.dg/other/debug3.C
deleted file mode 100644 (file)
index 8525eef..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-// PR optimization/5547
-// This testcase caused ICE on IA-32, since DWARF-2 was unable
-// to emit location expression for parameter a of operator+.
-// { dg-do compile }
-// { dg-options "-O2 -g -fpic" }
-
-struct A { char *s; };
-
-inline A operator+ (char a, const A &b)
-{
-  A s;
-  s.s = new char[12];
-  s.s[0] = a;
-  return s;
-}
-
-int b (const A &);
-
-void test1 (const A &x, int y)
-{
-  int j = b ("012345"[y] + x);
-  for (int i = 0; i < y; i++);
-}
-
-void test2 (const A &x, int y)
-{
-  int j = b ("012345678"[y + 2] + x);
-  for (int i = 0; i < y; i++);
-}
-
-void test3 (const A &x, int y)
-{
-  int j = b ("012345678"[y - 6] + x);
-  for (int i = 0; i < y; i++);
-}
-
-void test4 (const A &x, int y)
-{
-  int j = b ("012345678"[2 * y - 10] + x);
-  for (int i = 0; i < y; i++);
-}
-
-void test5 (const A &x, int y)
-{
-  int j = b ("012345678"[4 * y] + x);
-  for (int i = 0; i < y; i++);
-}