The --coverage flag is a useful alias for -fprofile-arcs
-ftest-coverage where the latter makes gcc output the .gcno file.
While it makes sense to use -fprofile-arcs without a .gcno file (pgo,
maybe more), it never really makes sense to request -fpath-coverage or
-fcondition-coverage without also wanting the .gcno to interpret the
results.
gcc/ChangeLog:
* common.opt: ftest-coverage enabled by fpath-coverage or
fcondition-coverage
gcc/testsuite/ChangeLog:
* g++.dg/gcov/gcov-18.C: Remove --coverage.
* g++.dg/gcov/gcov-22.C: Likewise.
* gcc.misc-tests/gcov-19.c: Remove -ftest-coverage.
* gcc.misc-tests/gcov-29.c: Likewise.
---
gcc/common.opt | 2 +-
gcc/testsuite/g++.dg/gcov/gcov-18.C | 2 +-
gcc/testsuite/g++.dg/gcov/gcov-22.C | 2 +-
gcc/testsuite/gcc.misc-tests/gcov-19.c | 2 +-
gcc/testsuite/gcc.misc-tests/gcov-29.c | 2 +-
5 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/gcc/common.opt b/gcc/common.opt
index 4c73f51defa..88b79bbf8f5 100644
--- a/gcc/common.opt
+++ b/gcc/common.opt
@@ -3142,7 +3142,7 @@ Common Var(flag_syntax_only)
Check for syntax errors, then stop.
ftest-coverage
-Common Var(flag_test_coverage)
+Common Var(flag_test_coverage) EnabledBy(fpath-coverage || fcondition-coverage)
Create data files needed by \"gcov\".
fthread-jumps
diff --git a/gcc/testsuite/g++.dg/gcov/gcov-18.C
b/gcc/testsuite/g++.dg/gcov/gcov-18.C
index 10578ec1865..945728a35e7 100644
--- a/gcc/testsuite/g++.dg/gcov/gcov-18.C
+++ b/gcc/testsuite/g++.dg/gcov/gcov-18.C
@@ -1,4 +1,4 @@
-/* { dg-options "--coverage -fcondition-coverage -std=c++11" } */
+/* { dg-options "-fcondition-coverage -std=c++11" } */
/* { dg-do run } */
/* { dg-skip-if "requires hosted libstdc++ for vector" { ! hostedlib } } */
diff --git a/gcc/testsuite/g++.dg/gcov/gcov-22.C
b/gcc/testsuite/g++.dg/gcov/gcov-22.C
index 69e0728e3e4..892d59d8a71 100644
--- a/gcc/testsuite/g++.dg/gcov/gcov-22.C
+++ b/gcc/testsuite/g++.dg/gcov/gcov-22.C
@@ -1,4 +1,4 @@
-/* { dg-options "--coverage -fpath-coverage" } */
+/* { dg-options "-fpath-coverage" } */
/* { dg-do compile } */
#include <stdexcept>
diff --git a/gcc/testsuite/gcc.misc-tests/gcov-19.c
b/gcc/testsuite/gcc.misc-tests/gcov-19.c
index 17d6dde87c6..f555fede4fc 100644
--- a/gcc/testsuite/gcc.misc-tests/gcov-19.c
+++ b/gcc/testsuite/gcc.misc-tests/gcov-19.c
@@ -1,4 +1,4 @@
-/* { dg-options "-fcondition-coverage -ftest-coverage" } */
+/* { dg-options "-fcondition-coverage" } */
/* { dg-do run } */
/* Some side effect to stop branches from being pruned. */
diff --git a/gcc/testsuite/gcc.misc-tests/gcov-29.c
b/gcc/testsuite/gcc.misc-tests/gcov-29.c
index 5e3f0a914e5..ced21db8316 100644
--- a/gcc/testsuite/gcc.misc-tests/gcov-29.c
+++ b/gcc/testsuite/gcc.misc-tests/gcov-29.c
@@ -1,4 +1,4 @@
-/* { dg-options "--coverage -fpath-coverage" } */
+/* { dg-options "-fpath-coverage" } */
/* { dg-do run } */
void
--
2.47.3