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]

Re: [PATCH v5 11/11] [PR gdb/14441] gdb: testsuite: add rvalue reference tests


Thanks a lot for doing this.

On 06/06/2016 08:22 PM, Artemiy Volkov wrote:
> --- /dev/null
> +++ b/gdb/testsuite/gdb.cp/rvalue-ref-casts.cc
> @@ -0,0 +1,56 @@
> +#include <utility>

Please add a GPLv3+ header to all new testsuite files.
Some existing files don't have them, but all new files
are required to.  If you based the file on some pre-existing
file, them we should preserve the copyright year range.  If
that is the case, and the file does not currently have
a header, use the date the original file was first committed
to the sources (git blame/log and/or grepping ChangeLog files
should allow finding easily).

> +main (int argc, char **argv)
> +{
> +  A *a = new B(42, 1729);
> +  B *b = (B *) a;
> +  A &ar = *b;
> +  B &br = (B&)ar;
> +  A &&arr = std::move(A(42));
> +  B &&brr = std::move(B(42, 1729));

All new tests should follow GNU coding conventions too, unless
required otherwise for the particular issue being tested
(which doesn't seem to be the case here).

IOW, missing spaces before parentheses, & and casts:

  B &br = (B &) ar;
  A &&arr = std::move (A (42));
  B &&brr = std::move (B (42, 1729));

> +# Copyright 2016 Free Software Foundation, Inc.
> +
...
> +
> +# C++11 rvalue reference type casting tests, based on gdb.cp/casts.exp.
> +#

If there's copyrightable content in the file that came from gdb.cp/casts.exp,
then please preserve the copyright year range.

On 06/06/2016 08:22 PM, Artemiy Volkov wrote:
> +++ b/gdb/testsuite/gdb.cp/rvalue-ref-overload.exp
...
> +#
> +# This is hairy to begin with.  It is even more hairy because of the
> +# XX_* alternate patterns to catch the KFAIL and XFAIL cases.
> +
> +set re_class	"((struct|class) foo \{${ws}public:|struct foo \{)"
> +set re_fields   ""
> +set re_ctor	"foo\\(void\\);${ws}foo\\(foo_lval_ref\\);${ws}foo\\(foo_rval_ref\\);"
> +set re_dtor	"~foo\\((void|)\\);"
> +set XX_dtor	"~foo\\(int\\);"
> +set re_methods "${ws}int overload1arg\\(foo_lval_ref\\);"
> +append re_methods "${ws}int overload1arg\\(foo_rval_ref\\);"
> +set re_synth	"foo & operator=\\(foo const ?&\\);"
> +
> +gdb_test_multiple "ptype foo_rr_instance1" "ptype foo_rr_instance1" {
> +    -re "type = $re_class${ws}$re_synth${ws}$re_dtor${ws}$re_ctor${ws}$re_methods$nl\}$nl$gdb_prompt $" {
> +	# gcc 2.95.3 -gstabs+, no "const" on "const char *"
> +	# TODO: gdb.base/constvar.exp has XFAILed this kind of problem for a
> +	# long time, but an XFAIL really needs an external bug report.
> +	# -- chastain 2003-12-31
> +	# setup_xfail "*-*-*"
> +	# fail "ptype foo_rr_instance1"
> +	# TODO: this should be a KFAIL.
> +	pass "ptype foo_rr_instance1 (shorter match)"
> +    }
> +    -re "type = $re_class${ws}$re_synth${ws}$re_dtor${ws}$re_ctor${ws}$re_methods$nl\}$nl$gdb_prompt $" {
> +	# gcc 2.95.3 -gstabs+ if "const char *" ever gets fixed
> +	pass "ptype foo_rr_instance1"
> +    }
> +    -re "type = $re_class${ws}$re_fields${ws}$re_ctor${ws}$XX_dtor${ws}$re_methods$nl\}$nl$gdb_prompt $" {
> +	# gcc 3.3.2 -gdwarf-2, "~foo(int)"
> +	# TODO: kfail this
> +	# kfail "gdb/1113" "ptype foo_rr_instance1"
> +	pass "ptype foo_rr_instance1 (shorter match)"
> +    }
> +    -re "type = $re_class{ws}$re_ctor${ws}$re_dtor${ws}$re_methods$nl\}$nl$gdb_prompt $" {
> +	# gcc 3.3.2 -gdwarf-2, if the dtor bug gets fixed
> +	# gcc HEAD -gdwarf-2 (abi-2)
> +	# TODO: just pass this
> +	pass "ptype foo_rr_instance1 (shorter match)"
> +    }
> +    -re "type = $re_class${ws}$re_synth${ws}$re_ctor${ws}$re_dtor${ws}$re_methods$nl\}$nl$gdb_prompt $" {
> +	# gcc 3.3.2 -gstabs+
> +	# TODO: enough with the "shorter match"
> +	pass "ptype foo_rr_instance1 (shorter match)"
> +    }
> +    -re "type = $re_class${ws}$re_ctor${ws}$re_dtor${ws}$re_methods${ws}$re_synth$nl\}$nl$gdb_prompt $" {
> +	# gcc HEAD -gstabs+ (abi-2)
> +	pass "ptype foo_rr_instance1 (shorter match)"
> +    }


Several references to TODOs and kfails, etc. that are likely
not really relevant here.  Can we clean this up?

(same comments apply to the other files).

Thanks,
Pedro Alves


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