From: Sebastian Huber <sebastian.huber@embedded-brains.de>
To: gcc-patches@gcc.gnu.org
Subject: [RFC/gcov 02/12] gcov: Add mode to all gcov_open()
Date: Thu, 31 Mar 2022 13:35:05 +0200 [thread overview]
Message-ID: <20220331113515.35764-3-sebastian.huber@embedded-brains.de> (raw)
In-Reply-To: <20220331113515.35764-1-sebastian.huber@embedded-brains.de>
gcc/
* gcov-io.cc (gcov_open): Always use the mode parameter.
* gcov-io.h (gcov_open): Declare it unconditionally.
libgcc/
* libgcov-driver-system.c (gcov_exit_open_gcda_file): Open file for
reading and writing.
* libgcov-util.c (read_gcda_file): Open file for reading.
* libgcov.h (gcov_open): Delete declaration.
---
gcc/gcov-io.cc | 7 -------
gcc/gcov-io.h | 5 +----
libgcc/libgcov-driver-system.c | 4 ++--
libgcc/libgcov-util.c | 2 +-
libgcc/libgcov.h | 1 -
5 files changed, 4 insertions(+), 15 deletions(-)
diff --git a/gcc/gcov-io.cc b/gcc/gcov-io.cc
index 72c40f8eaa0..017a6e32a5d 100644
--- a/gcc/gcov-io.cc
+++ b/gcc/gcov-io.cc
@@ -89,15 +89,8 @@ from_file (gcov_unsigned_t value)
Return zero on failure, non-zero on success. */
GCOV_LINKAGE int
-#if IN_LIBGCOV
-gcov_open (const char *name)
-#else
gcov_open (const char *name, int mode)
-#endif
{
-#if IN_LIBGCOV
- int mode = 0;
-#endif
#if GCOV_LOCKED
struct flock s_flock;
int fd;
diff --git a/gcc/gcov-io.h b/gcc/gcov-io.h
index 99ce7dbccc8..afe74b002f1 100644
--- a/gcc/gcov-io.h
+++ b/gcc/gcov-io.h
@@ -347,15 +347,12 @@ struct gcov_summary
functions for writing. Your file may become corrupted if you break
these invariants. */
-#if !IN_LIBGCOV
-GCOV_LINKAGE int gcov_open (const char */*name*/, int /*direction*/);
-#endif
-
#if !IN_LIBGCOV || defined (IN_GCOV_TOOL)
GCOV_LINKAGE int gcov_magic (gcov_unsigned_t, gcov_unsigned_t);
#endif
/* Available everywhere. */
+GCOV_LINKAGE int gcov_open (const char *, int) ATTRIBUTE_HIDDEN;
GCOV_LINKAGE int gcov_close (void) ATTRIBUTE_HIDDEN;
GCOV_LINKAGE gcov_unsigned_t gcov_read_unsigned (void) ATTRIBUTE_HIDDEN;
GCOV_LINKAGE gcov_type gcov_read_counter (void) ATTRIBUTE_HIDDEN;
diff --git a/libgcc/libgcov-driver-system.c b/libgcc/libgcov-driver-system.c
index eef6e3cbda1..9abb2fe7f74 100644
--- a/libgcc/libgcov-driver-system.c
+++ b/libgcc/libgcov-driver-system.c
@@ -309,7 +309,7 @@ gcov_exit_open_gcda_file (struct gcov_info *gi_ptr,
gf->filename = replace_filename_variables (gf->filename);
- if (!gcov_open (gf->filename))
+ if (!gcov_open (gf->filename, 0))
{
/* Open failed likely due to missed directory.
Create directory and retry to open file. */
@@ -318,7 +318,7 @@ gcov_exit_open_gcda_file (struct gcov_info *gi_ptr,
fprintf (stderr, "profiling:%s:Skip\n", gf->filename);
return -1;
}
- if (!gcov_open (gf->filename))
+ if (!gcov_open (gf->filename, 0))
{
fprintf (stderr, "profiling:%s:Cannot open\n", gf->filename);
return -1;
diff --git a/libgcc/libgcov-util.c b/libgcc/libgcov-util.c
index 100f1b19f1a..db157220c9d 100644
--- a/libgcc/libgcov-util.c
+++ b/libgcc/libgcov-util.c
@@ -268,7 +268,7 @@ read_gcda_file (const char *filename)
k_ctrs_mask[i] = 0;
k_ctrs_types = 0;
- if (!gcov_open (filename))
+ if (!gcov_open (filename, 1))
{
fnotice (stderr, "%s:cannot open\n", filename);
return NULL;
diff --git a/libgcc/libgcov.h b/libgcc/libgcov.h
index 40e845ce3ea..f190547e819 100644
--- a/libgcc/libgcov.h
+++ b/libgcc/libgcov.h
@@ -343,7 +343,6 @@ extern int __gcov_execve (const char *, char *const [], char *const [])
ATTRIBUTE_HIDDEN;
/* Functions that only available in libgcov. */
-GCOV_LINKAGE int gcov_open (const char */*name*/) ATTRIBUTE_HIDDEN;
GCOV_LINKAGE void gcov_write_summary (gcov_unsigned_t /*tag*/,
const struct gcov_summary *)
ATTRIBUTE_HIDDEN;
--
2.34.1
next prev parent reply other threads:[~2022-03-31 11:35 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-31 11:35 [RFC/gcov 00/12] Add merge-stream subcommand to gcov-tool Sebastian Huber
2022-03-31 11:35 ` [RFC/gcov 01/12] gcov-tool: Allow merging of empty profile lists Sebastian Huber
2022-03-31 11:35 ` Sebastian Huber [this message]
2022-03-31 11:35 ` [RFC/gcov 03/12] gcov: Add open mode parameter to gcov_do_dump() Sebastian Huber
2022-03-31 11:35 ` [RFC/gcov 04/12] gcov: Make gcov_seek() static Sebastian Huber
2022-03-31 11:35 ` [RFC/gcov 05/12] gcov: Add __gcov_filename_to_gcfn() Sebastian Huber
2022-03-31 11:35 ` [RFC/gcov 06/12] gcov-tool: Support file input from stdin Sebastian Huber
2022-04-07 8:32 ` Martin Liška
2022-03-31 11:35 ` [RFC/gcov 07/12] gcov: Use xstrdup() Sebastian Huber
2022-03-31 11:35 ` [RFC/gcov 08/12] gcov: Move prepend to list to read_gcda_file() Sebastian Huber
2022-04-07 8:33 ` Martin Liška
2022-03-31 11:35 ` [RFC/gcov 09/12] gcov: Move gcov_open() to caller of read_gcda_file() Sebastian Huber
2022-03-31 11:35 ` [RFC/gcov 10/12] gcov: Fix integer types in ftw_read_file() Sebastian Huber
2022-03-31 11:35 ` [RFC/gcov 11/12] gcov: Record EOF error during read Sebastian Huber
2022-04-07 8:34 ` Martin Liška
2022-03-31 11:35 ` [RFC/gcov 12/12] gcov-tool: Add merge-stream subcommand Sebastian Huber
2022-04-07 8:36 ` Martin Liška
2022-04-07 8:38 ` [RFC/gcov 00/12] Add merge-stream subcommand to gcov-tool Martin Liška
2022-04-07 9:05 ` Sebastian Huber
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=20220331113515.35764-3-sebastian.huber@embedded-brains.de \
--to=sebastian.huber@embedded-brains.de \
--cc=gcc-patches@gcc.gnu.org \
/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).