===================================================================
@@ -657,8 +657,7 @@ coverage_end_function (unsigned lineno_c
}
/* Build a coverage variable of TYPE for function FN_DECL. If COUNTER
- >= 0 it is a counter array, otherwise it is the function structure.
- Propagate appropriate linkage and visibility from the function decl. */
+ >= 0 it is a counter array, otherwise it is the function structure. */
static tree
build_var (tree fn_decl, tree type, int counter)
@@ -675,21 +674,6 @@ build_var (tree fn_decl, tree type, int
TREE_STATIC (var) = 1;
TREE_ADDRESSABLE (var) = 1;
DECL_ALIGN (var) = TYPE_ALIGN (type);
- DECL_WEAK (var) = DECL_WEAK (fn_decl);
- TREE_PUBLIC (var)
- = TREE_PUBLIC (fn_decl) && (counter < 0 || DECL_WEAK (fn_decl));
- if (DECL_ONE_ONLY (fn_decl))
- make_decl_one_only (var, DECL_COMDAT_GROUP (fn_decl));
-
- if (TREE_PUBLIC (var))
- {
- DECL_VISIBILITY (var) = DECL_VISIBILITY (fn_decl);
- DECL_VISIBILITY_SPECIFIED (var)
- = DECL_VISIBILITY_SPECIFIED (fn_decl);
-
- /* Initialize assembler name so we can stream out. */
- DECL_ASSEMBLER_NAME (var);
- }
return var;
}
===================================================================
@@ -39,19 +39,28 @@ proc clean-gcov { testcase } {
#
proc verify-lines { testcase file } {
#send_user "verify-lines\n"
+ global subdir
set failed 0
set fd [open $file r]
while { [gets $fd line] >= 0 } {
# We want to match both "-" and "#####" as count as well as numbers,
# since we want to detect lines that shouldn't be marked as covered.
- if [regexp "^ *(\[^:]*): *(\[0-9\\-#]+):.*count\\((\[0-9\\-#]+)\\)" \
- "$line" all is n shouldbe] {
+ if [regexp "^ *(\[^:]*): *(\[0-9\\-#]+):.*count\\((\[0-9\\-#]+)\\)(.*)" \
+ "$line" all is n shouldbe rest] {
+ if [regexp "^ *{(.*)}" $rest all xfailed] {
+ switch [dg-process-target $xfailed] {
+ "N" { continue }
+ "F" { setup_xfail "*-*-*" }
+ }
+ }
if { $is == "" } {
- fail "$n:no data available for this line"
+ fail "$subdir/$testcase:$n:no data available for this line"
incr failed
} elseif { $is != $shouldbe } {
- fail "$n:is $is:should be $shouldbe"
+ fail "$subdir/$testcase:$n:is $is:should be $shouldbe"
incr failed
+ } else {
+ pass "$subdir/$testcase:$n line count"
}
}
}
@@ -230,32 +239,36 @@ proc run-gcov { args } {
global GCOV
global srcdir subdir
- set gcov_args [lindex $args end]
-
+ set gcov_args ""
set gcov_verify_calls 0
set gcov_verify_branches 0
- set gcov_execute_xfail ""
- set gcov_verify_xfail ""
+ set xfailed 0
foreach a $args {
if { $a == "calls" } {
set gcov_verify_calls 1
} elseif { $a == "branches" } {
set gcov_verify_branches 1
+ } elseif { $gcov_args == "" } {
+ set gcov_args $a
+ } else {
+ switch [dg-process-target $a] {
+ "N" { return }
+ "F" { set xfailed 1 }
+ }
}
}
# Extract the test name from the arguments.
set testcase [lindex $gcov_args end]
- if { $gcov_execute_xfail != "" } {
- eval setup_xfail [split $gcov_execute_xfail]
- }
-
verbose "Running $GCOV $testcase" 2
set testcase [remote_download host $testcase]
set result [remote_exec host $GCOV $gcov_args]
if { [lindex $result 0] != 0 } {
+ if { $xfailed } {
+ setup_xfail "*-*-*"
+ }
fail "$subdir/$testcase gcov failed: [lindex $result 1]"
clean-gcov $testcase
return
@@ -264,16 +277,15 @@ proc run-gcov { args } {
# Get the gcov output file after making sure it exists.
set files [glob -nocomplain $testcase.gcov]
if { $files == "" } {
+ if { $xfailed } {
+ setup_xfail "*-*-*"
+ }
fail "$subdir/$testcase gcov failed: $testcase.gcov does not exist"
clean-gcov $testcase
return
}
remote_upload host $testcase.gcov $testcase.gcov
- if { $gcov_verify_xfail != "" } {
- eval setup_xfail [split $gcov_verify_xfail]
- }
-
# Check that line execution counts are as expected.
set lfailed [verify-lines $testcase $testcase.gcov]
@@ -293,6 +305,9 @@ proc run-gcov { args } {
# Report whether the gcov test passed or failed. If there were
# multiple failures then the message is a summary.
set tfailed [expr $lfailed + $bfailed + $cfailed]
+ if { $xfailed } {
+ setup_xfail "*-*-*"
+ }
if { $tfailed > 0 } {
fail "$subdir/$testcase gcov: $lfailed failures in line counts, $bfailed in branch percentages, $cfailed in return percentages"
} else {
===================================================================
@@ -7,7 +7,7 @@
int __attribute__ ((weak)) weak ()
{
- return 1; /* count(-) */
+ return 1; /* count(-) { xfail *-*-* } PR51113*/
}
int main ()
@@ -15,5 +15,6 @@ int main ()
return weak (); /* count(1) */
}
-/* { dg-final { run-gcov { -a gcov-13.c } } } */
+/* xfailed due to PR 51113 */
+/* { dg-final { run-gcov { -a gcov-13.c } { xfail *-*-* } } } */
/* { dg-final { run-gcov { -a gcovpart-13b.c } } } */
===================================================================
@@ -1,12 +0,0 @@
-/* Test visibility is copied */
-
-/* { dg-options "-fprofile-arcs -fvisibility=hidden" } */
-/* { dg-require-visibility "" } */
-/* { dg-require-weak "" } */
-
-void Foo ()
-{
-}
-
- /* { dg-final { scan-assembler "\\.hidden\t__gcov__Foo" { target { ! *-*-darwin* } } } } */
- /* { dg-final { scan-assembler "\\.private_extern ___gcov__Foo" { target *-*-darwin* } } } */
===================================================================
@@ -1,12 +0,0 @@
-/* Test visibility is copied */
-
-/* { dg-options "-fprofile-arcs" } */
-/* { dg-require-visibility "" } */
-/* { dg-require-weak "" } */
-
-void __attribute__ ((visibility ("hidden"), weak)) Foo ()
-{
-}
-
-/* { dg-final { scan-assembler "\\.hidden\t__gcov__Foo" { target { ! *-*-darwin* } } } } */
-/* { dg-final { scan-assembler "\\.private_extern ___gcov__Foo" { target *-*-darwin* } } } */
===================================================================
@@ -1,14 +0,0 @@
-/* { dg-options "-fprofile-arcs -fvisibility=hidden" } */
-/* { dg-require-visibility "" } */
-
-struct __attribute__((visibility ("hidden"))) X
-{
- void Fink ();
-};
-
-void X::Fink ()
-{
-}
-
-/* { dg-final { scan-assembler "\\.hidden\t__gcov___ZN1X4FinkEv" { target { ! *-*-darwin* } } } } */
-/* { dg-final { scan-assembler "\\.private_extern ___gcov___ZN1X4FinkEv" { target *-*-darwin* } } } */
===================================================================
@@ -1,17 +0,0 @@
-/* { dg-options "-fprofile-arcs -fvisibility-inlines-hidden" } */
-/* { dg-require-visibility "" } */
-
-inline void Boo ()
-{
-}
-
-extern "C" void (*Foo ()) ()
-{
- return Boo;
-}
-
-/* { dg-final { scan-assembler "\\.hidden\t__gcov___Z3Boov" { target { ! *-*-darwin* } } } } */
-/* { dg-final { scan-assembler "\\.private_extern ___gcov___Z3Boov" { target *-*-darwin* } } } */
-/* { dg-final { scan-assembler "__gcov__Foo:" } } */
-/* { dg-final { scan-assembler-not "\\.hidden\t__gcov__Foo" { target { ! *-*-darwin* } } } } */
-/* { dg-final { scan-assembler-not "\\.private_extern ___gcov__Foo" { target *-*-darwin* } } } */
===================================================================
@@ -0,0 +1,21 @@
+/* PR 51113 */
+/* { dg-options "-fprofile-arcs -ftest-coverage -fpic" } */
+/* { dg-do run { target native } } */
+/* { dg-additional-sources "gcovpart-12b.C" } */
+
+struct Foo {
+ Foo ()
+ {} /* count(1) */
+ virtual void Func () /* count(#####) */
+ {} /* count(#####) */
+};
+
+int main ()
+{
+ Foo b;
+
+ return 0; /* count (1) */
+}
+
+/* { dg-final { run-gcov gcov-12.C } } */
+/* { dg-final { run-gcov gcovpart-12b.C { xfail *-*-* } } } */
===================================================================
@@ -0,0 +1,5 @@
+struct Foo {
+ Foo () {}
+ virtual void Func () /* count(-) { xfail *-*-* } */
+ {} /* count(-) { xfail *-*-* } */
+};