]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gcc.c-torture/execute/builtins/fputs.c: fputs_unlocked prototype
authorFlorian Weimer <fweimer@redhat.com>
Mon, 6 Nov 2023 11:57:12 +0000 (12:57 +0100)
committerFlorian Weimer <fweimer@redhat.com>
Mon, 6 Nov 2023 11:57:32 +0000 (12:57 +0100)
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.,
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

index 93fa9736449ce4f27c43c9262b2479611063b972..a94ea993364150b034f22f80e2d0636877ce0e6b 100644 (file)
@@ -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