From 14b909b25dec8e68f7bcb35e89ce503c5f12967c Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 27 Aug 2010 19:55:14 +0200 Subject: Reimplement state stack not to move elements Add another recursive parsing test that forces second allocation in the stack. --- tests/cxx/parser/recursive/driver.cxx | 88 ++++++++++++++++++++++++++++++++++- 1 file changed, 87 insertions(+), 1 deletion(-) (limited to 'tests/cxx/parser/recursive/driver.cxx') diff --git a/tests/cxx/parser/recursive/driver.cxx b/tests/cxx/parser/recursive/driver.cxx index f961d76..bcbbd2e 100644 --- a/tests/cxx/parser/recursive/driver.cxx +++ b/tests/cxx/parser/recursive/driver.cxx @@ -91,6 +91,78 @@ struct indir_pimpl: indir_type_pskel } }; +struct a_pimpl: a_pskel +{ + virtual void + pre () + { + cout << "a::pre" << endl; + } + + virtual void + a () + { + cout << "a::a" << endl; + } + + virtual void + b () + { + cout << "a::b" << endl; + } + +#ifdef XSDE_STL + virtual void + name (string const& n) + { + cout << "a::name: " << n << endl; + } +#else + virtual void + name (char* n) + { + cout << "a::name: " << n << endl; + delete[] n; + } +#endif + + virtual void + post_a () + { + cout << "a::post" << endl; + } +}; + +struct b_pimpl: b_pskel +{ + virtual void + pre () + { + cout << "b::pre" << endl; + } + +#ifdef XSDE_STL + virtual void + name (string const& n) + { + cout << "b::name: " << n << endl; + } +#else + virtual void + name (char* n) + { + cout << "b::name: " << n << endl; + delete[] n; + } +#endif + + virtual void + post_b () + { + cout << "b::post" << endl; + } +}; + struct test_pimpl: test_type_pskel { virtual void @@ -105,6 +177,12 @@ struct test_pimpl: test_type_pskel cout << "test::sub" << endl; } + virtual void + a () + { + cout << "test::a" << endl; + } + #ifdef XSDE_STL virtual void name (string const& n) @@ -143,11 +221,19 @@ main (int argc, char* argv[]) sub_pimpl sub_p; indir_pimpl indir_p; + + a_pimpl a_p; + b_pimpl b_p; + test_pimpl test_p; sub_p.parsers (string_p, sub_p, indir_p, sub_p); indir_p.parsers (string_p, sub_p); - test_p.parsers (string_p, sub_p); + + a_p.parsers (string_p, a_p, b_p); + b_p.parsers (string_p); + + test_p.parsers (string_p, sub_p, a_p); xml_schema::document_pimpl doc_p (test_p, "test"); -- cgit v1.1