Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1079)

Issue 4434055: PR 47793 - Support relative paths using -fprofile-generate

Can't Edit
Can't Publish+Mail
Start Review
Created:
13 years ago by martint
Modified:
8 years, 8 months ago
Reviewers:
CC:
gcc-patches_gcc.gnu.org
Base URL:
svn://gcc.gnu.org/svn/gcc/trunk/
Visibility:
Public.

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+16 lines, -3 lines) Patch
M gcc/doc/invoke.texi View 1 chunk +1 line, -1 line 0 comments Download
M gcc/libgcov.c View 1 chunk +3 lines, -2 lines 0 comments Download
A gcc/testsuite/gcc.dg/pr47793.c View 1 chunk +12 lines, -0 lines 0 comments Download

Messages

Total messages: 2
martint
This is slightly updated from my previous patch proposal. The test now correctly work if ...
13 years ago (2011-04-18 17:48:52 UTC) #1
martint
13 years ago (2011-04-18 18:52:15 UTC) #2
On Mon, Apr 18, 2011 at 10:48 AM, Martin Thuresson <martint@google.com> wrote:
> This is slightly updated from my previous patch proposal. The test now
> correctly work if multiple tests are executed in parallell.

Forgot to mention that this patch has been bootstrapped without
regression on x86_64 and should be considered for GCC trunk.

Thanks!
Martin

>
> 2011-04-17  Martin Thuresson  <martint@google.com>
>
>        * gcc/doc/invoke.tex: Document support for relative profile paths.
>        * gcc/testsuite/gcc.dg/pr47793.c: New test.
>        * gcc/libgcov.c (gcov_exit): Support relative profile paths.
>
> Index: gcc/doc/invoke.texi
> ===================================================================
> --- gcc/doc/invoke.texi (revision 172439)
> +++ gcc/doc/invoke.texi (working copy)
> @@ -7751,7 +7751,7 @@ Set the directory to search for the prof
>  This option affects only the profile data generated by
>  @option{-fprofile-generate}, @option{-ftest-coverage},
@option{-fprofile-arcs}
>  and used by @option{-fprofile-use} and @option{-fbranch-probabilities}
> -and its related options.
> +and its related options.  Both absolute and relative paths can be used.
>  By default, GCC will use the current directory as @var{path}, thus the
>  profile data file will appear in the same directory as the object file.
>
> Index: gcc/testsuite/gcc.dg/pr47793.c
> ===================================================================
> --- gcc/testsuite/gcc.dg/pr47793.c      (revision 0)
> +++ gcc/testsuite/gcc.dg/pr47793.c      (revision 0)
> @@ -0,0 +1,12 @@
> +/* Bug pr47793: Allow relative paths in profile-generate.  */
> +/* { dg-do run } */
> +/* { dg-options "-O -fprofile-generate=./" } */
> +/* { dg-final { scan-file pr47793.gcda "."} } */
> +
> +int
> +main(void)
> +{
> +  return 0;
> +}
> +
> +/* { dg-final { cleanup-coverage-files } } */
> Index: gcc/libgcov.c
> ===================================================================
> --- gcc/libgcov.c       (revision 172439)
> +++ gcc/libgcov.c       (working copy)
> @@ -283,8 +283,9 @@ gcov_exit (void)
>              }
>         }
>       /* Update complete filename with stripped original. */
> -      if (!IS_DIR_SEPARATOR (*fname) && !HAS_DRIVE_SPEC(fname))
> -       {
> +      if (prefix_length != 0 && !IS_DIR_SEPARATOR (*fname))
> +        {
> +          /* If prefix is given, add directory separator.  */
>          strcpy (gi_filename_up, "/");
>          strcpy (gi_filename_up + 1, fname);
>        }
>
> --
> This patch is available for review at http://codereview.appspot.com/4434055
>
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b