From patchwork Thu Mar 31 11:35:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Huber X-Patchwork-Id: 1611691 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4KTh8h3TxNz9sGH for ; Thu, 31 Mar 2022 22:36:36 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 5719F3838024 for ; Thu, 31 Mar 2022 11:36:34 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from dedi548.your-server.de (dedi548.your-server.de [85.10.215.148]) by sourceware.org (Postfix) with ESMTPS id 7CEA03864842 for ; Thu, 31 Mar 2022 11:35:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 7CEA03864842 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=embedded-brains.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=embedded-brains.de Received: from sslproxy01.your-server.de ([78.46.139.224]) by dedi548.your-server.de with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1nZt5F-000OPj-Id; Thu, 31 Mar 2022 13:35:21 +0200 Received: from [82.100.198.138] (helo=mail.embedded-brains.de) by sslproxy01.your-server.de with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nZt5F-000Fiv-Fh; Thu, 31 Mar 2022 13:35:21 +0200 Received: from localhost (localhost [127.0.0.1]) by mail.embedded-brains.de (Postfix) with ESMTP id 16FE6480125; Thu, 31 Mar 2022 13:35:21 +0200 (CEST) Received: from mail.embedded-brains.de ([127.0.0.1]) by localhost (zimbra.eb.localhost [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id TfwlnqCglNNY; Thu, 31 Mar 2022 13:35:20 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by mail.embedded-brains.de (Postfix) with ESMTP id B9B63480114; Thu, 31 Mar 2022 13:35:20 +0200 (CEST) X-Virus-Scanned: amavisd-new at zimbra.eb.localhost Received: from mail.embedded-brains.de ([127.0.0.1]) by localhost (zimbra.eb.localhost [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id o1uMcKiZPQE2; Thu, 31 Mar 2022 13:35:20 +0200 (CEST) Received: from zimbra.eb.localhost (unknown [192.168.96.242]) by mail.embedded-brains.de (Postfix) with ESMTPSA id 9552F48010D; Thu, 31 Mar 2022 13:35:20 +0200 (CEST) From: Sebastian Huber 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 Message-Id: <20220331113515.35764-3-sebastian.huber@embedded-brains.de> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220331113515.35764-1-sebastian.huber@embedded-brains.de> References: <20220331113515.35764-1-sebastian.huber@embedded-brains.de> MIME-Version: 1.0 X-Authenticated-Sender: smtp-embedded@poldinet.de X-Virus-Scanned: Clear (ClamAV 0.103.5/26498/Thu Mar 31 10:19:05 2022) X-Spam-Status: No, score=-11.0 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" 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;