From: martint@google.com (Martin Thuresson)
To: reply@codereview.appspotmail.com, gcc-patches@gcc.gnu.org
Subject: PR 47793 - Support relative paths using -fprofile-generate (issue4434055)
Date: Mon, 18 Apr 2011 18:13:00 -0000 [thread overview]
Message-ID: <20110418174849.D2B231EE08E@martint2.mtv.corp.google.com> (raw)
This is slightly updated from my previous patch proposal. The test now
correctly work if multiple tests are executed in parallell.
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
next reply other threads:[~2011-04-18 17:49 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-18 18:13 Martin Thuresson [this message]
2011-04-18 19:01 ` Martin Thuresson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20110418174849.D2B231EE08E@martint2.mtv.corp.google.com \
--to=martint@google.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=reply@codereview.appspotmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).