testsuite, cp: add expected failures to pass-by-ref tests for certain compilers

There exist expected failures in the pass-by-ref.exp and
pass-by-ref-2.exp tests based on the GCC and Clang version.

* GCC version <= 6 and Clang do not emit DW_AT_deleted and
  DW_AT_defaulted.

* Clang version >= 7 emits DW_AT_calling_convention, which helps the
  debugger make the right calling convention decision in some cases
  despite lacking the 'defaulted' and 'deleted' attributes.

Mark the related tests as XFAIL based on the compiler version.

Tested on X86_64 using GCC 5.5.0, 6.5.0, 7.4.0, 8.3.0, 9.2.1;
and Clang 5.0.1, 6.0.0, 7.0.0, 8.0.0, 9.0.1, 10.0.0.

gdb/testsuite/ChangeLog:
2020-01-29  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

	* gdb.cp/pass-by-ref-2.exp: Mark some tests as XFAIL based on the
	GCC/Clang version.
	* gdb.cp/pass-by-ref.exp: Ditto.

Change-Id: I1d8440aa438049f7c4da7f4f76f201c48550f1e4
This commit is contained in:
Tankut Baris Aktemur 2020-01-29 09:05:20 +01:00
parent ee2a6fc604
commit 5f440116e8
3 changed files with 38 additions and 0 deletions

View File

@ -1,3 +1,9 @@
2020-01-29 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
* gdb.cp/pass-by-ref-2.exp: Mark some tests as XFAIL based on the
GCC/Clang version.
* gdb.cp/pass-by-ref.exp: Ditto.
2020-01-29 Tom de Vries <tdevries@suse.de>
* gdb.threads/watchpoint-fork-child.c: Guard prints with #if DEBUG.

View File

@ -42,6 +42,10 @@ if {![runto_main]} {
return -1
}
# GCC version <= 6 and Clang do not emit DW_AT_defaulted and DW_AT_deleted.
set is_gcc_6_or_older [test_compiler_info {gcc-[0-6]-*}]
set is_clang [test_compiler_info {clang-*}]
set bp_location [gdb_get_line_number "stop here"]
gdb_breakpoint $bp_location
gdb_continue_to_breakpoint "end of main" ".*return .*;"
@ -65,6 +69,7 @@ set sig "\"Inlined\:\:Inlined\\(.*Inlined const\&\\)\""
gdb_test "print cbvInlined (inlined)" \
"expression cannot be evaluated .* \\(maybe inlined\\?\\)"
if {$is_gcc_6_or_older || $is_clang} {setup_xfail "*-*-*"}
gdb_test "print cbvDtorDel (*dtorDel)" \
".* cannot be evaluated .* 'DtorDel' is not destructible" \
"type not destructible"
@ -94,6 +99,7 @@ gdb_test "print cbvTwoMCtor (twoMctor)" \
".* cannot be evaluated .* 'TwoMCtor' is not copy constructible" \
"copy ctor is implicitly deleted"
if {$is_gcc_6_or_older || $is_clang} {setup_xfail "*-*-*"}
gdb_test "print cbvTwoMCtorAndCCtor (twoMctorAndCctor)" "12" \
"call cbvTwoMCtorAndCCtor"
gdb_test "print twoMctorAndCctor.x" "2" \

View File

@ -369,6 +369,12 @@ proc test_for_class { prefix states cbvfun data_field length} {
global ADDED
global TRACE
# GCC version <= 6 and Clang do not emit DW_AT_defaulted and DW_AT_deleted.
set is_gcc_6_or_older [test_compiler_info {gcc-[0-6]-*}]
set is_clang [test_compiler_info {clang-*}]
# But Clang version >= 7 emits DW_AT_calling_convention for types.
set is_clang_6_or_older [test_compiler_info {clang-[0-6]-*}]
with_test_prefix $name {
if {[is_copy_constructible $states]} {
set expected [expr {$ORIGINAL + $ADDED}]
@ -378,6 +384,19 @@ proc test_for_class { prefix states cbvfun data_field length} {
if {$dtor == "explicit"} {
gdb_test "print tracer = 0" " = 0" "reset the tracer"
}
if {$cctor == "defaultedIn" || $dtor == "defaultedIn"} {
if {$is_gcc_6_or_older || $is_clang_6_or_older} {
setup_xfail "*-*-*"
} elseif {$is_clang} {
# If this is a pass-by-value case, Clang >= 7's
# DW_AT_calling_convention leads to the right decision.
# Otherwise, it is expected to fail.
if {"defaultedOut" in $states || "explicit" in $states} {
setup_xfail "*-*-*"
}
}
}
gdb_test "print ${cbvfun}<$name> (${name}_var)" " = $expected" \
"call '$cbvfun'"
gdb_test "print ${name}_var.${data_field}\[0\]" " = $ORIGINAL" \
@ -389,10 +408,17 @@ proc test_for_class { prefix states cbvfun data_field length} {
"cbv argument should not change (item $last_index)"
}
if {$dtor == "explicit"} {
if {$cctor == "defaultedIn"
&& ($is_gcc_6_or_older || $is_clang)} {
setup_xfail "*-*-*"
}
gdb_test "print tracer" " = $TRACE" \
"destructor should be called"
}
} else {
if {$cctor == "deleted" && ($is_gcc_6_or_older || $is_clang)} {
setup_xfail "*-*-*"
}
gdb_test "print ${cbvfun}<$name> (${name}_var)" \
".* cannot be evaluated .* '${name}' is not copy constructible" \
"calling '$cbvfun' should be refused"