From: David Carlton <carlton@math.stanford.edu>
To: gdb-patches@sources.redhat.com
Cc: Michael Elizabeth Chastain <mec@shout.net>
Subject: [patch] delete namespace __gnu_test from C++ testsuite
Date: Tue, 17 Dec 2002 15:34:00 -0000 [thread overview]
Message-ID: <ro1u1hcmdim.fsf@jackfruit.Stanford.EDU> (raw)
I've committed the following patches to delete the namespace
__gnu_test from the C++ testsuite files in which it occurs: it's
pointless, illegally-named, and turns those files into tests of
namespace support as well as tests of whatever they're trying to test.
(The patches look longer than they really are: most of them are just
whitespace changes.) I also updated try_catch to use marker comments
instead of hardwired line numbers, as I'd earlier done with m-data and
m-static.
David Carlton
carlton@math.stanford.edu
2002-12-17 David Carlton <carlton@math.stanford.edu>
* gdb.c++/try_catch.cc: Add marker comments.
* gdb.c++/try_catch.exp: Get line numbers from marker comments.
* gdb.c++/m-data.cc: Delete namespace __gnu_test.
* gdb.c++/m-static.cc: Ditto.
* gdb.c++/m-static1.cc: Ditto.
* gdb.c++/try_catch.cc: Ditto.
Index: m-data.cc
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.c++/m-data.cc,v
retrieving revision 1.2
diff -u -p -r1.2 m-data.cc
--- m-data.cc 11 Dec 2002 18:45:29 -0000 1.2
+++ m-data.cc 17 Dec 2002 23:20:25 -0000
@@ -1,47 +1,44 @@
// 2002-05-13
-namespace __gnu_test
+enum region { oriental, egyptian, greek, etruscan, roman };
+
+// Test one.
+class gnu_obj_1
{
- enum region { oriental, egyptian, greek, etruscan, roman };
+protected:
+ typedef region antiquities;
+ const bool test;
+ const int key1;
+ long key2;
+
+ antiquities value;
+
+public:
+ gnu_obj_1(antiquities a, long l): test(true), key1(5), key2(l), value(a) {}
+};
- // Test one.
- class gnu_obj_1
- {
- protected:
- typedef region antiquities;
- const bool test;
- const int key1;
- long key2;
-
- antiquities value;
-
- public:
- gnu_obj_1(antiquities a, long l): test(true), key1(5), key2(l), value(a) {}
- };
-
- // Test two.
- template<typename T>
- class gnu_obj_2: public virtual gnu_obj_1
- {
- protected:
- antiquities value_derived;
+// Test two.
+template<typename T>
+class gnu_obj_2: public virtual gnu_obj_1
+{
+protected:
+ antiquities value_derived;
- public:
- gnu_obj_2(antiquities b): gnu_obj_1(oriental, 7), value_derived(b) { }
- };
-
- // Test three.
- template<typename T>
- class gnu_obj_3
- {
- protected:
- typedef region antiquities;
- gnu_obj_2<int> data;
+public:
+ gnu_obj_2(antiquities b): gnu_obj_1(oriental, 7), value_derived(b) { }
+};
+
+// Test three.
+template<typename T>
+class gnu_obj_3
+{
+protected:
+ typedef region antiquities;
+ gnu_obj_2<int> data;
- public:
- gnu_obj_3(antiquities b): data(etruscan) { }
- };
-}
+public:
+ gnu_obj_3(antiquities b): data(etruscan) { }
+};
int shadow = 0;
@@ -56,7 +53,6 @@ private:
int main()
{
- using namespace __gnu_test;
gnu_obj_1 test1(egyptian, 4589);
gnu_obj_2<long> test2(roman);
gnu_obj_3<long> test3(greek);
Index: m-static.cc
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.c++/m-static.cc,v
retrieving revision 1.2
diff -u -p -r1.2 m-static.cc
--- m-static.cc 18 Sep 2002 18:48:43 -0000 1.2
+++ m-static.cc 17 Dec 2002 23:20:32 -0000
@@ -1,73 +1,68 @@
// 2002-05-13
-namespace __gnu_test
-{
- enum region { oriental, egyptian, greek, etruscan, roman };
+enum region { oriental, egyptian, greek, etruscan, roman };
- // Test one.
- class gnu_obj_1
- {
- protected:
- typedef region antiquities;
- static const bool test = true;
- static const int key1 = 5;
- static long key2;
-
- static antiquities value;
-
- public:
- gnu_obj_1(antiquities a, long l) {}
- };
-
- const bool gnu_obj_1::test;
- const int gnu_obj_1::key1;
- long gnu_obj_1::key2 = 77;
- gnu_obj_1::antiquities gnu_obj_1::value = oriental;
-
-
- // Test two.
- template<typename T>
- class gnu_obj_2: public virtual gnu_obj_1
- {
- public:
- static antiquities value_derived;
+// Test one.
+class gnu_obj_1
+{
+protected:
+ typedef region antiquities;
+ static const bool test = true;
+ static const int key1 = 5;
+ static long key2;
+
+ static antiquities value;
+
+public:
+ gnu_obj_1(antiquities a, long l) {}
+};
+
+const bool gnu_obj_1::test;
+const int gnu_obj_1::key1;
+long gnu_obj_1::key2 = 77;
+gnu_obj_1::antiquities gnu_obj_1::value = oriental;
+
+
+// Test two.
+template<typename T>
+class gnu_obj_2: public virtual gnu_obj_1
+{
+public:
+ static antiquities value_derived;
- public:
- gnu_obj_2(antiquities b): gnu_obj_1(oriental, 7) { }
- };
-
- template<typename T>
- typename gnu_obj_2<T>::antiquities gnu_obj_2<T>::value_derived = etruscan;
-
- // Test three.
- template<typename T>
- class gnu_obj_3
- {
- public:
- typedef region antiquities;
- static gnu_obj_2<int> data;
+public:
+ gnu_obj_2(antiquities b): gnu_obj_1(oriental, 7) { }
+};
+
+template<typename T>
+typename gnu_obj_2<T>::antiquities gnu_obj_2<T>::value_derived = etruscan;
+
+// Test three.
+template<typename T>
+class gnu_obj_3
+{
+public:
+ typedef region antiquities;
+ static gnu_obj_2<int> data;
- public:
- gnu_obj_3(antiquities b) { }
- };
+public:
+ gnu_obj_3(antiquities b) { }
+};
- template<typename T>
- gnu_obj_2<int> gnu_obj_3<T>::data(etruscan);
+template<typename T>
+gnu_obj_2<int> gnu_obj_3<T>::data(etruscan);
- // 2002-08-16
- // Test four.
+// 2002-08-16
+// Test four.
#include "m-static.h"
-}
// instantiate templates explicitly so their static members will exist
-template class __gnu_test::gnu_obj_2<int>;
-template class __gnu_test::gnu_obj_2<long>;
-template class __gnu_test::gnu_obj_3<long>;
+template class gnu_obj_2<int>;
+template class gnu_obj_2<long>;
+template class gnu_obj_3<long>;
int main()
{
- using namespace __gnu_test;
-
gnu_obj_1 test1(egyptian, 4589);
gnu_obj_2<long> test2(roman);
gnu_obj_3<long> test3(greek);
Index: m-static1.cc
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.c++/m-static1.cc,v
retrieving revision 1.1
diff -u -p -r1.1 m-static1.cc
--- m-static1.cc 18 Sep 2002 18:48:43 -0000 1.1
+++ m-static1.cc 17 Dec 2002 23:20:34 -0000
@@ -1,9 +1,5 @@
// 2002-08-16
-namespace __gnu_test {
#include "m-static.h"
-}
-
-using namespace __gnu_test;
const int gnu_obj_4::elsewhere = 221;
Index: try_catch.cc
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.c++/try_catch.cc,v
retrieving revision 1.1
diff -u -p -r1.1 try_catch.cc
--- try_catch.cc 27 May 2002 20:06:55 -0000 1.1
+++ try_catch.cc 17 Dec 2002 23:20:43 -0000
@@ -4,50 +4,45 @@
#include <stdexcept>
#include <string>
-namespace __gnu_test
-{
- enum region { oriental, egyptian, greek, etruscan, roman };
+enum region { oriental, egyptian, greek, etruscan, roman };
- // Test one.
- class gnu_obj_1
- {
- public:
- typedef region antiquities;
- const bool test;
- const int key1;
- long key2;
-
- antiquities value;
-
- gnu_obj_1(antiquities a, long l): test(true), key1(5), key2(l), value(a) {}
- };
-
- // Test two.
- template<typename T>
- class gnu_obj_2: public virtual gnu_obj_1
- {
- public:
- antiquities value_derived;
-
- gnu_obj_2(antiquities b): gnu_obj_1(oriental, 7), value_derived(b) { }
- };
-
- // Test three.
- template<typename T>
- class gnu_obj_3
- {
- public:
- typedef region antiquities;
- gnu_obj_2<int> data;
+// Test one.
+class gnu_obj_1
+{
+public:
+ typedef region antiquities;
+ const bool test;
+ const int key1;
+ long key2;
+
+ antiquities value;
+
+ gnu_obj_1(antiquities a, long l): test(true), key1(5), key2(l), value(a) {}
+};
+
+// Test two.
+template<typename T>
+class gnu_obj_2: public virtual gnu_obj_1
+{
+public:
+ antiquities value_derived;
+
+ gnu_obj_2(antiquities b): gnu_obj_1(oriental, 7), value_derived(b) { }
+};
+
+// Test three.
+template<typename T>
+class gnu_obj_3
+{
+public:
+ typedef region antiquities;
+ gnu_obj_2<int> data;
- gnu_obj_3(antiquities b): data(etruscan) { }
- };
-}
+ gnu_obj_3(antiquities b): data(etruscan) { }
+};
int main()
{
- using namespace __gnu_test;
-
bool test = true;
const int i = 5;
int j = i;
@@ -58,12 +53,12 @@ int main()
try
{
++j;
- throw gnu_obj_1(egyptian, 4589);
+ throw gnu_obj_1(egyptian, 4589); // marker 1-throw
}
catch (gnu_obj_1& obj)
{
++j;
- if (obj.value != egyptian)
+ if (obj.value != egyptian) // marker 1-catch
test &= false;
if (obj.key2 != 4589)
test &= false;
@@ -77,19 +72,19 @@ int main()
// 2
try
{
- ++j;
+ ++j; // marker 2-start
try
{
- ++j;
+ ++j; // marker 2-next
try
{
++j;
- throw gnu_obj_1(egyptian, 4589);
+ throw gnu_obj_1(egyptian, 4589); // marker 2-throw
}
catch (gnu_obj_1& obj)
{
++j;
- if (obj.value != egyptian)
+ if (obj.value != egyptian) // marker 2-catch
test &= false;
if (obj.key2 != 4589)
test &= false;
@@ -115,11 +110,11 @@ int main()
try
{
if (j < 100)
- throw invalid_argument("gdb.1");
+ throw invalid_argument("gdb.1"); // marker 3-throw
}
catch (exception& obj)
{
- if (obj.what() != "gdb.1")
+ if (obj.what() != "gdb.1") // marker 3-catch
test &= false;
}
return 0;
Index: try_catch.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.c++/try_catch.exp,v
retrieving revision 1.1
diff -u -p -r1.1 try_catch.exp
--- try_catch.exp 27 May 2002 20:06:55 -0000 1.1
+++ try_catch.exp 17 Dec 2002 23:20:45 -0000
@@ -54,31 +54,29 @@ if ![runto_main] then {
continue
}
-# One.
+gdb_breakpoint [gdb_get_line_number "marker 1-throw"]
+gdb_continue_to_breakpoint "marker 1-throw"
-gdb_test "break 61" "Breakpoint \[0-9\]*.*line 61\\."
-gdb_test "continue" "Continuing\\.\r\n\r\nBreakpoint.*at.*try_catch\\.cc:61\r\n.*" "continue to 61"
+gdb_breakpoint [gdb_get_line_number "marker 1-catch"]
+gdb_continue_to_breakpoint "marker 1-catch"
-gdb_test "break 66" "Breakpoint \[0-9\]*.*line 66\\."
-gdb_test "continue" "Continuing\\.\r\n\r\nBreakpoint.*at.*try_catch\\.cc:66\r\n.*" "continue to 66"
+gdb_breakpoint [gdb_get_line_number "marker 2-start"]
+gdb_continue_to_breakpoint "marker 2-start"
-gdb_test "break 80" "Breakpoint \[0-9\]*.*line 80\\."
-gdb_test "continue" "Continuing\\.\r\n\r\nBreakpoint.*at.*try_catch\\.cc:80\r\n.*" "continue to 80"
+gdb_breakpoint [gdb_get_line_number "marker 2-next"]
+gdb_continue_to_breakpoint "marker 2-next"
-gdb_test "break 83" "Breakpoint \[0-9\]*.*line 83\\."
-gdb_test "continue" "Continuing\\.\r\n\r\nBreakpoint.*at.*try_catch\\.cc:83\r\n.*" "continue to 83"
+gdb_breakpoint [gdb_get_line_number "marker 2-throw"]
+gdb_continue_to_breakpoint "marker 2-throw"
-gdb_test "break 87" "Breakpoint \[0-9\]*.*line 87\\."
-gdb_test "continue" "Continuing\\.\r\n\r\nBreakpoint.*at.*try_catch\\.cc:87\r\n.*" "continue to 87"
+gdb_breakpoint [gdb_get_line_number "marker 2-catch"]
+gdb_continue_to_breakpoint "marker 2-catch"
-gdb_test "break 92" "Breakpoint \[0-9\]*.*line 92\\."
-gdb_test "continue" "Continuing\\.\r\n\r\nBreakpoint.*at.*try_catch\\.cc:92\r\n.*" "continue to 92"
+gdb_breakpoint [gdb_get_line_number "marker 3-throw"]
+gdb_continue_to_breakpoint "marker 3-throw"
-gdb_test "break 118" "Breakpoint \[0-9\]*.*line 118\\."
-gdb_test "continue" "Continuing\\.\r\n\r\nBreakpoint.*at.*try_catch\\.cc:118\r\n.*" "continue to 118"
-
-gdb_test "break 122" "Breakpoint \[0-9\]*.*line 122\\."
-gdb_test "continue" "Continuing\\.\r\n\r\nBreakpoint.*at.*try_catch\\.cc:122\r\n.*" "continue to 122"
+gdb_breakpoint [gdb_get_line_number "marker 3-catch"]
+gdb_continue_to_breakpoint "marker 3-catch"
gdb_exit
return 0
next reply other threads:[~2002-12-17 23:28 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-12-17 15:34 David Carlton [this message]
2002-12-17 16:08 ` Daniel Jacobowitz
2002-12-18 3:11 ` David Carlton
2002-12-18 10:19 ` David Carlton
2002-12-18 11:16 Michael Elizabeth Chastain
2002-12-18 11:46 ` David Carlton
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ro1u1hcmdim.fsf@jackfruit.Stanford.EDU \
--to=carlton@math.stanford.edu \
--cc=gdb-patches@sources.redhat.com \
--cc=mec@shout.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox