public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-16] gcov: Move gcov_open() to caller of read_gcda_file()
@ 2022-04-28 19:41 Sebastian Huber
0 siblings, 0 replies; only message in thread
From: Sebastian Huber @ 2022-04-28 19:41 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:c190b0e65fe62e9fe58a8a04c6695a263da90161
commit r13-16-gc190b0e65fe62e9fe58a8a04c6695a263da90161
Author: Sebastian Huber <sebastian.huber@embedded-brains.de>
Date: Wed Mar 30 21:59:43 2022 +0200
gcov: Move gcov_open() to caller of read_gcda_file()
This allows to reuse read_gcda_file() to read multiple objects from a single
file.
libgcc/
* libgcov-util.c (read_gcda_file): Do not open file.
(ftw_read_file): Open file here.
Diff:
---
libgcc/libgcov-util.c | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)
diff --git a/libgcc/libgcov-util.c b/libgcc/libgcov-util.c
index 906ea645547..6093a74531d 100644
--- a/libgcc/libgcov-util.c
+++ b/libgcc/libgcov-util.c
@@ -268,17 +268,10 @@ read_gcda_file (const char *filename)
k_ctrs_mask[i] = 0;
k_ctrs_types = 0;
- if (!gcov_open (filename, 1))
- {
- fnotice (stderr, "%s:cannot open\n", filename);
- return NULL;
- }
-
/* Read magic. */
if (!gcov_magic (gcov_read_unsigned (), GCOV_DATA_MAGIC))
{
fnotice (stderr, "%s:not a gcov data file\n", filename);
- gcov_close ();
return NULL;
}
@@ -287,7 +280,6 @@ read_gcda_file (const char *filename)
if (version != GCOV_VERSION)
{
fnotice (stderr, "%s:incorrect gcov version %d vs %d \n", filename, version, GCOV_VERSION);
- gcov_close ();
return NULL;
}
@@ -379,7 +371,6 @@ read_gcda_file (const char *filename)
}
read_gcda_finalize (obj_info);
- gcov_close ();
return obj_info;
}
@@ -412,7 +403,14 @@ ftw_read_file (const char *filename,
if (verbose)
fnotice (stderr, "reading file: %s\n", filename);
+ if (!gcov_open (filename, 1))
+ {
+ fnotice (stderr, "%s:cannot open\n", filename);
+ return 0;
+ }
+
(void)read_gcda_file (xstrdup (filename));
+ gcov_close ();
return 0;
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-04-28 19:41 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-28 19:41 [gcc r13-16] gcov: Move gcov_open() to caller of read_gcda_file() Sebastian Huber
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).