public inbox for archer-commits@sourceware.org help / color / mirror / Atom feed
From: tromey@sourceware.org To: archer-commits@sourceware.org Subject: [SCM] tromey/operator-new-delete: update README.archer Date: Wed, 13 Mar 2013 19:34:00 -0000 [thread overview] Message-ID: <20130313193359.30214.qmail@sourceware.org> (raw) The branch, tromey/operator-new-delete has been updated via 46e210c07d4ffe7e7885032ac005bec2545c36f0 (commit) via af09cb52a2d6771475b1bc116ecacccb50b115c7 (commit) from fa32dc9d2276dd1602b2c296f768ffb533232ab3 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- commit 46e210c07d4ffe7e7885032ac005bec2545c36f0 Author: Tom Tromey <tromey@redhat.com> Date: Wed Mar 13 13:33:38 2013 -0600 update README.archer commit af09cb52a2d6771475b1bc116ecacccb50b115c7 Author: Tom Tromey <tromey@redhat.com> Date: Wed Mar 13 13:33:07 2013 -0600 add test to count number of destructor invocations ----------------------------------------------------------------------- Summary of changes: README.archer | 3 --- gdb/testsuite/gdb.cp/new.cc | 9 +++++++++ gdb/testsuite/gdb.cp/new.exp | 36 +++++++++++++++++++----------------- 3 files changed, 28 insertions(+), 20 deletions(-) First 500 lines of diff: diff --git a/README.archer b/README.archer index 6dfb9a9..32cd4c7 100644 --- a/README.archer +++ b/README.archer @@ -18,6 +18,3 @@ It is incomplete: * syntax for calling a destructor explicitly do we need to handle this specially? cannot be used with an implicit "this", must always be qualified -* needs a test for the number of times a destructor is called for - arrays (don't need this for constructor since we can just print the - array and see) diff --git a/gdb/testsuite/gdb.cp/new.cc b/gdb/testsuite/gdb.cp/new.cc index 9b78e25..99fa5f5 100644 --- a/gdb/testsuite/gdb.cp/new.cc +++ b/gdb/testsuite/gdb.cp/new.cc @@ -21,6 +21,9 @@ enum what_operator int whatop = WHATOP_INVALID; +// Number of times a destructor is invoked. +int dcount; + void *operator new (std::size_t size) { whatop = WHATOP_GLOBAL; @@ -50,6 +53,7 @@ struct Simple int x; Simple() : x (7) { } Simple (int y) : x (y) { } + ~Simple() { ++dcount; } }; struct Derived : public Simple @@ -133,6 +137,7 @@ struct Base virtual ~Base() { + ++dcount; } }; @@ -146,6 +151,7 @@ struct DerivedFromBase : public Base ~DerivedFromBase() { + ++dcount; } }; @@ -157,6 +163,7 @@ struct VDerived : public virtual Base ~VDerived() { + ++dcount; } }; @@ -168,6 +175,7 @@ struct VDerived2 : public VDerived, public virtual Base ~VDerived2() { + ++dcount; } }; @@ -179,6 +187,7 @@ int keep_stuff () delete new Base; delete new VDerived; delete new VDerived2; + delete new Simple; } int main () diff --git a/gdb/testsuite/gdb.cp/new.exp b/gdb/testsuite/gdb.cp/new.exp index d292b94..54e1b4d 100644 --- a/gdb/testsuite/gdb.cp/new.exp +++ b/gdb/testsuite/gdb.cp/new.exp @@ -32,22 +32,22 @@ if ![runto_main] then { gdb_breakpoint [gdb_get_line_number "Stop here"] gdb_continue_to_breakpoint Stop -set op_count 0 - -proc check_op {name value} { - global op_count - - gdb_test "print whatop == ($value)" " = true" "check settings - $name" - - # For debugging. - # gdb_test "print (enum what_operator) whatop" " = .*" \ - # "debug print whatop #$op_count" - - # Mildly lame that this ends up in the test results. - gdb_test_no_output "set variable whatop = WHATOP_INVALID" \ - "reset whatop #$op_count" - - incr op_count +proc check_op {name value {dcount ""}} { + with_test_prefix $name { + gdb_test "print whatop == ($value)" " = true" "check settings" + + if {$dcount != ""} { + gdb_test "print dcount" " = $dcount" "check destructor count" + } + + # For debugging. + # gdb_test "print (enum what_operator) whatop" " = .*" \ + # "debug print whatop" + + # Mildly lame that these end up in the test results. + gdb_test_no_output "set variable whatop = WHATOP_INVALID" "reset whatop" + gdb_test_no_output "set variable dcount = 0" "reset dcount" + } } gdb_test "print \$an_int = new int" " = .int .. $hex" @@ -138,7 +138,9 @@ gdb_test "print delete \$simple" " = void" check_op "delete Simple" {WHATOP_GLOBAL | WHATOP_DELETE} gdb_test "print delete\[\] \$simple_array" " = void" -check_op "delete Simple array" {WHATOP_GLOBAL | WHATOP_DELETE | WHATOP_ARRAY} +check_op "delete Simple array" \ + {WHATOP_GLOBAL | WHATOP_DELETE | WHATOP_ARRAY} \ + 7 gdb_test "print delete \$derived" " = void" check_op "delete Derived" {WHATOP_GLOBAL | WHATOP_DELETE} hooks/post-receive -- Repository for Project Archer.
reply other threads:[~2013-03-13 19:34 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20130313193359.30214.qmail@sourceware.org \ --to=tromey@sourceware.org \ --cc=archer-commits@sourceware.org \ /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: linkBe 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; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).