diff mbox series

[1/7] GCOV: document behavior of -fkeep-{static,inline}-functions (PR gcov-profile/82633).

Message ID 22f49725f56049abf9bf99edd7e79728b180fad1.1509005504.git.mliska@suse.cz
State New
Headers show
Series GCOV: another set of improvements | expand

Commit Message

Martin Liška Oct. 26, 2017, 8:11 a.m. UTC
gcc/ChangeLog:

2017-10-23  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.
---
 gcc/configure     | 4 ++--
 gcc/configure.ac  | 4 ++--
 gcc/doc/gcov.texi | 5 +++++
 3 files changed, 9 insertions(+), 4 deletions(-)

Comments

Nathan Sidwell Oct. 30, 2017, 12:15 p.m. UTC | #1
On 10/26/2017 04:11 AM, marxin wrote:
> gcc/ChangeLog:

> +++ b/gcc/doc/gcov.texi
> @@ -327,6 +327,11 @@ non-exceptional paths or only exceptional paths such as C++ exception
>   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 perform function removal for functions obviously not
> +used in a compilation unit.  Such functions are marked with @samp{-}
> +even though they contain a code.  Use @option{-fkeep-inline-functions} and
> +@option{-fkeep-static-functions} in order to properly
> +record @var{execution_count} of such functions.

This reads a little oddly.  How about:

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}.

Ok with that (or something approximating it).

nathan
Martin Liška Oct. 31, 2017, 11:02 a.m. UTC | #2
On 10/30/2017 01:15 PM, Nathan Sidwell wrote:
> On 10/26/2017 04:11 AM, marxin wrote:
>> gcc/ChangeLog:
> 
>> +++ b/gcc/doc/gcov.texi
>> @@ -327,6 +327,11 @@ non-exceptional paths or only exceptional paths such as C++ exception
>>   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 perform function removal for functions obviously not
>> +used in a compilation unit.  Such functions are marked with @samp{-}
>> +even though they contain a code.  Use @option{-fkeep-inline-functions} and
>> +@option{-fkeep-static-functions} in order to properly
>> +record @var{execution_count} of such functions.
> 
> This reads a little oddly.  How about:
> 
> 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}.

Hi.

Thanks for rewriting that. Native speakers always produce more readable documentation.
I'll install your version as it is.

Martin

> 
> Ok with that (or something approximating it).
> 
> nathan
diff mbox series

Patch

diff --git a/gcc/configure b/gcc/configure
index aa5937df84c..7f9d740e93c 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 d905d0d980a..46b4a80b9a1 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..c527b89f13b 100644
--- a/gcc/doc/gcov.texi
+++ b/gcc/doc/gcov.texi
@@ -327,6 +327,11 @@  non-exceptional paths or only exceptional paths such as C++ exception
 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 perform function removal for functions obviously not
+used in a compilation unit.  Such functions are marked with @samp{-}
+even though they contain a code.  Use @option{-fkeep-inline-functions} and
+@option{-fkeep-static-functions} in order to properly
+record @var{execution_count} of such functions.
 
 Some lines of information at the start have @var{line_number} of zero.
 These preamble lines are of the form