public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Florian Weimer <fweimer@redhat.com>
To: gcc-patches@gcc.gnu.org
Subject: [PATCH v2] gcc.c-torture/execute/builtins/fputs.c: fputs_unlocked prototype
Date: Mon, 23 Oct 2023 10:37:21 +0200	[thread overview]
Message-ID: <874jihybsu.fsf@oldenburg.str.redhat.com> (raw)

Current glibc headers only declare fputs_unlocked for _GNU_SOURCE,
so define it to obtain an official prototype.

Add a fallback prototype declaration for other systems that do not
have fputs_unlocked.  This seems to the most straightforward approach
to avoid an implicit function declaration, without reducing test
coverage and introducing ongoing maintenance requirements (e.g.g,
FreeBSD added fputs_unlocked support fairly recently).

gcc/testsuite/

	* gcc.c-torture/execute/builtins/fputs.c (_GNU_SOURCE):
	Define.
	(fputs_unlocked): Declare.

---
 gcc/testsuite/gcc.c-torture/execute/builtins/fputs.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/fputs.c b/gcc/testsuite/gcc.c-torture/execute/builtins/fputs.c
index 93fa9736449..a94ea993364 100644
--- a/gcc/testsuite/gcc.c-torture/execute/builtins/fputs.c
+++ b/gcc/testsuite/gcc.c-torture/execute/builtins/fputs.c
@@ -5,9 +5,13 @@
 
    Written by Kaveh R. Ghazi, 10/30/2000.  */
 
+#define _GNU_SOURCE /* For fputs_unlocked.  */
 #include <stdio.h>
 extern void abort(void);
 
+/* Not all systems have fputs_unlocked.  See fputs-lib.c.  */
+extern int (fputs_unlocked) (const char *, FILE *);
+
 int i;
 
 void

base-commit: 0e29c6f65523dad20068ba69cd03d8f6f82cab41


             reply	other threads:[~2023-10-23  8:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-23  8:37 Florian Weimer [this message]
2023-10-27 19:50 ` Jeff Law

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=874jihybsu.fsf@oldenburg.str.redhat.com \
    --to=fweimer@redhat.com \
    --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).