From 7aa650153c254090ed3f393320471967ed71cb10 Mon Sep 17 00:00:00 2001 From: marxin Date: Tue, 31 Oct 2017 11:55:19 +0000 Subject: [PATCH] GCOV: document behavior of -fkeep-{static,inline}-functions (PR gcov-profile/82633). 2017-10-31 Martin Liska 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@254257 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 9 +++++++++ gcc/configure | 4 ++-- gcc/configure.ac | 4 ++-- gcc/doc/gcov.texi | 7 +++++++ 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b8140dd0e17..b15dc955dc5 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2017-10-31 Martin Liska + + 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 PR target/82772 diff --git a/gcc/configure b/gcc/configure index c49e665f1ca..c6297acf53c 100755 --- a/gcc/configure +++ b/gcc/configure @@ -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 diff --git a/gcc/configure.ac b/gcc/configure.ac index 7c0a903c4cd..0ff9dfe24a0 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -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 diff --git a/gcc/doc/gcov.texi b/gcc/doc/gcov.texi index 706aa6cf0b0..88b8d6d9071 100644 --- a/gcc/doc/gcov.texi +++ b/gcc/doc/gcov.texi @@ -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 -- 2.11.4.GIT