GCOV: document behavior of -fkeep-{static,inline}-functions (PR gcov-profile/82633).
authorMartin Liska <mliska@suse.cz>
Tue, 31 Oct 2017 11:55:19 +0000 (12:55 +0100)
committerMartin Liska <marxin@gcc.gnu.org>
Tue, 31 Oct 2017 11:55:19 +0000 (11:55 +0000)
2017-10-31  Martin Liska  <mliska@suse.cz>

PR gcov-profile/82633
* doc/gcov.texi: Document -fkeep-{static,inline}-functions and
their interaction with GCOV infrastructure.
* configure.ac: Add -fkeep-{inline,static}-functions to
coverage_flags.
* configure: Regenerate.

From-SVN: r254257

gcc/ChangeLog
gcc/configure
gcc/configure.ac
gcc/doc/gcov.texi

index b8140dd0e17c7a087f30c7080ebd0adccc1c2d69..b15dc955dc5d9042d53828684025de7540a59208 100644 (file)
@@ -1,3 +1,12 @@
+2017-10-31  Martin Liska  <mliska@suse.cz>
+
+       PR gcov-profile/82633
+       * doc/gcov.texi: Document -fkeep-{static,inline}-functions and
+       their interaction with GCOV infrastructure.
+       * configure.ac: Add -fkeep-{inline,static}-functions to
+       coverage_flags.
+       * configure: Regenerate.
+
 2017-10-31  Uros Bizjak  <ubizjak@gmail.com>
 
        PR target/82772
index c49e665f1ca47bb754d49dc1db4ae6b6d4aa10fa..c6297acf53c3ba50a6af04cb4bdb30d04cfb5d0c 100755 (executable)
@@ -7321,10 +7321,10 @@ fi
 if test "${enable_coverage+set}" = set; then :
   enableval=$enable_coverage; case "${enableval}" in
   yes|noopt)
-    coverage_flags="-fprofile-arcs -ftest-coverage -frandom-seed=\$@ -O0"
+    coverage_flags="-fprofile-arcs -ftest-coverage -frandom-seed=\$@ -O0 -fkeep-inline-functions -fkeep-static-functions"
     ;;
   opt)
-    coverage_flags="-fprofile-arcs -ftest-coverage -frandom-seed=\$@ -O2"
+    coverage_flags="-fprofile-arcs -ftest-coverage -frandom-seed=\$@ -O2 -fkeep-inline-functions -fkeep-static-functions"
     ;;
   no)
     # a.k.a. --disable-coverage
index 7c0a903c4cdb00e7135a305df60a8c8e88a11ae4..0ff9dfe24a00c27f569ac4295f65dcdb8b22ae77 100644 (file)
@@ -728,10 +728,10 @@ AC_ARG_ENABLE(coverage,
                 default is noopt])],
 [case "${enableval}" in
   yes|noopt)
-    coverage_flags="-fprofile-arcs -ftest-coverage -frandom-seed=\$@ -O0"
+    coverage_flags="-fprofile-arcs -ftest-coverage -frandom-seed=\$@ -O0 -fkeep-inline-functions -fkeep-static-functions"
     ;;
   opt)
-    coverage_flags="-fprofile-arcs -ftest-coverage -frandom-seed=\$@ -O2"
+    coverage_flags="-fprofile-arcs -ftest-coverage -frandom-seed=\$@ -O2 -fkeep-inline-functions -fkeep-static-functions"
     ;;
   no)
     # a.k.a. --disable-coverage
index 706aa6cf0b0ce48bcff8aa8a3442ad8177cebe8f..88b8d6d9071181cc35aad458867703a8e61dc6b5 100644 (file)
@@ -328,6 +328,13 @@ handlers, respectively. Given @samp{-a} option, unexecuted blocks are
 marked @samp{$$$$$} or @samp{%%%%%}, depending on whether a basic block
 is reachable via non-exceptional or exceptional paths.
 
+Note that GCC can completely remove the bodies of functions that are
+not needed -- for instance if they are inlined everywhere.  Such functions
+are marked with @samp{-}, which can be confusing.
+Use the @option{-fkeep-inline-functions} and @option{-fkeep-static-functions}
+options to retain these functions and
+allow gcov to properly show their @var{execution_count}.
+
 Some lines of information at the start have @var{line_number} of zero.
 These preamble lines are of the form