public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/marxin/heads/PR89961-fix-gcov-json-output-location)] gcov: fix output location for JSON mode.
@ 2021-08-17 14:25 Martin Liska
  0 siblings, 0 replies; only message in thread
From: Martin Liska @ 2021-08-17 14:25 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:81c7cdad334b2f77e658c1b30b2a2106c1eba168

commit 81c7cdad334b2f77e658c1b30b2a2106c1eba168
Author: Martin Liska <mliska@suse.cz>
Date:   Tue Aug 17 16:24:26 2021 +0200

    gcov: fix output location for JSON mode.

Diff:
---
 gcc/gcov.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/gcc/gcov.c b/gcc/gcov.c
index 5c651a9bdce..9bf5bdd8b9d 100644
--- a/gcc/gcov.c
+++ b/gcc/gcov.c
@@ -1144,17 +1144,20 @@ output_intermediate_json_line (json::array *object,
    input: a/b/foo.cc,   output: foo.cc.gcov  */
 
 static char *
-get_gcov_intermediate_filename (const char *file_name)
+get_gcov_intermediate_filename (const char *input_file_name)
 {
   const char *gcov = ".gcov.json.gz";
   char *result;
-  const char *cptr;
+  char *cptr;
 
-  /* Find the 'basename'.  */
-  cptr = lbasename (file_name);
+  char *file_name = xstrdup (input_file_name);
+  cptr = strrchr (file_name, '.');
+  if (cptr)
+    *cptr = '\0';
 
-  result = XNEWVEC (char, strlen (cptr) + strlen (gcov) + 1);
-  sprintf (result, "%s%s", cptr, gcov);
+  result = XNEWVEC (char, strlen (file_name) + strlen (gcov) + 1);
+  sprintf (result, "%s%s", file_name, gcov);
+  free (file_name);
 
   return result;
 }


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-08-17 14:25 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-17 14:25 [gcc(refs/users/marxin/heads/PR89961-fix-gcov-json-output-location)] gcov: fix output location for JSON mode Martin Liska

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