This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH 2/2] Merge "print recursive static member" unit test into classes.exp
- From: Patrick Frants <osscontribute at gmail dot com>
- To: gdb-patches at sourceware dot org
- Cc: Patrick Frants <osscontribute at gmail dot com>
- Date: Wed, 25 Oct 2017 09:08:20 +0200
- Subject: [PATCH 2/2] Merge "print recursive static member" unit test into classes.exp
- Authentication-results: sourceware.org; auth=none
- References: <20171025070820.5004-1-osscontribute@gmail.com>
---
gdb/testsuite/gdb.cp/classes.cc | 13 ++++++++++
gdb/testsuite/gdb.cp/classes.exp | 4 +++
gdb/testsuite/gdb.cp/printstaticrecursion.cc | 18 -------------
gdb/testsuite/gdb.cp/printstaticrecursion.exp | 37 ---------------------------
4 files changed, 17 insertions(+), 55 deletions(-)
delete mode 100644 gdb/testsuite/gdb.cp/printstaticrecursion.cc
delete mode 100644 gdb/testsuite/gdb.cp/printstaticrecursion.exp
diff --git a/gdb/testsuite/gdb.cp/classes.cc b/gdb/testsuite/gdb.cp/classes.cc
index 50f0740abe..a6508462b7 100644
--- a/gdb/testsuite/gdb.cp/classes.cc
+++ b/gdb/testsuite/gdb.cp/classes.cc
@@ -665,6 +665,19 @@ void use_methods ()
base1 b (3);
}
+struct Inner
+{
+ static Inner instance;
+};
+
+struct Outer
+{
+ Inner inner;
+ static Outer instance;
+};
+
+Inner Inner::instance;
+Outer Outer::instance;
int
main()
diff --git a/gdb/testsuite/gdb.cp/classes.exp b/gdb/testsuite/gdb.cp/classes.exp
index 9e2630acef..b268fb192a 100644
--- a/gdb/testsuite/gdb.cp/classes.exp
+++ b/gdb/testsuite/gdb.cp/classes.exp
@@ -602,6 +602,10 @@ proc test_static_members {} {
gdb_test "print cnsi" \
"{x = 30, y = 40, static null = {x = 0, y = 0, static null = <same as static member of an already seen type>, static yy = {z = 5, static xx = {x = 1, y = 2, static null = <same as static member of an already seen type>, static yy = <same as static member of an already seen type>}}}, static yy = <same as static member of an already seen type>}" \
"print cnsi with static members"
+
+ gdb_test "print Outer::instance" \
+ "{inner = {static instance = {static instance = <same as static member of an already seen type>}}, static instance = {inner = {static instance = {static instance = <same as static member of an already seen type>}}, static instance = <same as static member of an already seen type>}}" \
+ "print recursive static member"
}
proc do_tests {} {
diff --git a/gdb/testsuite/gdb.cp/printstaticrecursion.cc b/gdb/testsuite/gdb.cp/printstaticrecursion.cc
deleted file mode 100644
index 40fd3c0c27..0000000000
--- a/gdb/testsuite/gdb.cp/printstaticrecursion.cc
+++ /dev/null
@@ -1,18 +0,0 @@
-struct Inner
-{
- static Inner instance;
-};
-
-struct Outer
-{
- Inner inner;
- static Outer instance;
-};
-
-Inner Inner::instance;
-Outer Outer::instance;
-
-int main()
-{
- return 0; /* break-here */
-}
\ No newline at end of file
diff --git a/gdb/testsuite/gdb.cp/printstaticrecursion.exp b/gdb/testsuite/gdb.cp/printstaticrecursion.exp
deleted file mode 100644
index a71adc7d03..0000000000
--- a/gdb/testsuite/gdb.cp/printstaticrecursion.exp
+++ /dev/null
@@ -1,37 +0,0 @@
-# Copyright 2008-2017 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 this program. If not, see <http://www.gnu.org/licenses/>.
-
-
-if { [skip_cplus_tests] } { continue }
-
-standard_testfile printstaticrecursion.cc
-
-# Create and source the file that provides information about the compiler
-# used to compile the test case.
-if [get_compiler_info "c++"] {
- untested "couldn't find a valid c++ compiler"
- return -1
-}
-
-if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug c++}]} {
- return -1
-}
-
-if ![runto_main] then {
- perror "couldn't run to main"
- continue
-}
-
-gdb_test "print Outer::instance" "{inner = {static instance = {static instance = <same as static member of an already seen type>}}, static instance = {inner = {static instance = {static instance = <same as static member of an already seen type>}}, static instance = <same as static member of an already seen type>}}" "print recursive static member"
--
2.14.0