This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

FYI: updates to temargs.exp


I'm checking this in on the trunk.

Dodji pointed out that gcc 4.6 has a fix for tests in temargs.exp that
are marked kfail.

Also, I noticed that gcc is still doing the wrong thing for
pointer-to-member-function here; this is GCC PR 49366.

This patch changes the kfails to follow the existing style in the
test -- xfail conditional on the compiler version.  It also adds some
new tests for the pointer-to-member-function case.

Tested with both an older and a newer gcc.

Tom

2011-06-10  Tom Tromey  <tromey@redhat.com>

	* gdb.cp/temargs.exp: Let tests pass if compiler bug is fixed.
	Add tests for pointer-to-member-function.
	* gdb.cp/temargs.cc (S::somefunc): New function.
	(K2): New class.
	(main): Instantiate K2; call method.

Index: gdb.cp/temargs.cc
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.cp/temargs.cc,v
retrieving revision 1.2
diff -u -r1.2 temargs.cc
--- gdb.cp/temargs.cc	1 Jan 2011 15:33:44 -0000	1.2
+++ gdb.cp/temargs.cc	10 Jun 2011 16:19:33 -0000
@@ -23,6 +23,7 @@
 struct S
 {
   int f;
+  void somefunc() { }
 };
 
 template<typename T, int I, int *P, int S::*MP>
@@ -55,17 +56,28 @@
   // Breakpoint 3.
 }
 
+template<void (S::*F) ()>
+struct K2
+{
+  void k2_m ()
+  {
+    // Breakpoint 5.
+  }
+};
+
 int main ()
 {
   Base<double, 23, &a_global, &S::f> base;
   // Note that instantiating with P==0 does not work with g++.
   // That would be worth testing, once g++ is fixed.
   Base<long, 47, &a_global, &S::f>::Inner<float> inner;
+  K2<&S::somefunc> k2;
 
   base.base_m ();
   inner.inner_m ();
   func<unsigned char, 91, &a_global, &S::f> ();
   base.templ_m<short> ();
+  k2.k2_m ();
 
   return 0;
 }
Index: gdb.cp/temargs.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.cp/temargs.exp,v
retrieving revision 1.3
diff -u -r1.3 temargs.exp
--- gdb.cp/temargs.exp	1 Jan 2011 15:33:44 -0000	1.3
+++ gdb.cp/temargs.exp	10 Jun 2011 16:19:33 -0000
@@ -41,9 +41,18 @@
 # gcc 4.4 and earlier don't emit enough info for some of our template tests.
 verbose -log "compiler_info: $compiler_info"
 set have_older_template_gcc 0
+set have_pr_41736_fixed 1
+set have_pr_45024_fixed 1
 if {[test_compiler_info {gcc-[0-3]-*}]
     || [test_compiler_info {gcc-4-[0-4]-*}]} {
     set have_older_template_gcc 1
+    set have_pr_41736_fixed 0
+    set have_pr_45024_fixed 0
+} elseif {[test_compiler_info {gcc-4-5-*}]} {
+    set have_pr_41736_fixed 0
+    set have_pr_45024_fixed 0
+} elseif {[test_compiler_info {gcc-4-6-*}]} {
+    set have_pr_45024_fixed 0
 }
 
 set line [gdb_get_line_number "Breakpoint 1" $srcfile]
@@ -62,6 +71,10 @@
 gdb_test "break $srcfile:$line" "Breakpoint 5.*" \
     "set fourth breakpoint for temargs"
 
+set line [gdb_get_line_number "Breakpoint 5" $srcfile]
+gdb_test "break $srcfile:$line" "Breakpoint 6.*" \
+    "set fifth breakpoint for temargs"
+
 #
 # Tests in Base::base_m.
 #
@@ -77,7 +90,7 @@
 if $have_older_template_gcc { setup_xfail "*-*-*" }
 gdb_test "print P == &a_global" " = true" "test value of P in base_m"
 
-setup_kfail "gcc/41736" *-*-*
+if {!$have_pr_41736_fixed} { setup_xfail *-*-* }
 gdb_test "print MP" "&S::f" "test value of MP in base_m"
 
 #
@@ -86,16 +99,17 @@
 
 gdb_continue_to_breakpoint "continue to second breakpoint for temargs"
 
-setup_kfail "gcc/45024" *-*-*
+
+if {!$have_pr_45024_fixed} { setup_xfail *-*-* }
 gdb_test "ptype T" "long" "test type of T in inner_m"
 
-setup_kfail "gcc/45024" *-*-*
+if {!$have_pr_45024_fixed} { setup_xfail *-*-* }
 gdb_test "print I" " = 47" "test value of I in inner_m"
 
 if $have_older_template_gcc { setup_xfail "*-*-*" }
 gdb_test "print P == &a_global" " = true" "test value of P in inner_m"
 
-setup_kfail "gcc/41736" *-*-*
+if {!$have_pr_41736_fixed} { setup_xfail *-*-* }
 gdb_test "print MP" "&S::f" "test value of MP in inner_m"
 
 if $have_older_template_gcc { setup_xfail "*-*-*" }
@@ -116,7 +130,7 @@
 if $have_older_template_gcc { setup_xfail "*-*-*" }
 gdb_test "print P == &a_global" " = true" "test value of P in func"
 
-setup_kfail "gcc/41736" *-*-*
+if {!$have_pr_41736_fixed} { setup_xfail *-*-* }
 gdb_test "print MP" "&S::f" "test value of MP in func"
 
 #
@@ -134,8 +148,21 @@
 if $have_older_template_gcc { setup_xfail "*-*-*" }
 gdb_test "print P == &a_global" " = true" "test value of P in templ_m"
 
-setup_kfail "gcc/41736" *-*-*
+if {!$have_pr_41736_fixed} { setup_xfail *-*-* }
 gdb_test "print MP" "&S::f" "test value of MP in templ_m"
 
 if $have_older_template_gcc { setup_xfail "*-*-*" }
 gdb_test "whatis Q" "short" "test type of Q in templ_m"
+
+#
+# Tests in K2::k2_m.
+#
+
+gdb_continue_to_breakpoint "continue to fifth breakpoint for temargs"
+
+if $have_older_template_gcc { setup_xfail "*-*-*" }
+gdb_test "ptype F" "type = void \\\(S::\\\*\\\)\\\(S \\\* const\\\)" \
+    "test type of F in k2_m"
+
+setup_kfail gcc/49366 "*-*-*"
+gdb_test "print F" "&S::somefunc" "test value of F in k2_m"


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]