https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108675

--- Comment #8 from nightstrike <nightstrike at gmail dot com> ---
(In reply to LIU Hao from comment #7)
> (In reply to nightstrike from comment #5)
> > (In reply to LIU Hao from comment #4)
> > > Does it make any sense to remove `#include <stdio.h>` from
> > > 'gcc.c-torture/execute/builtins/lib/fprintf.c' ?
> > 
> > That will prevent the FILE type from existing, so the replacement functions
> > won't compile.
> 
> That file never uses any fields of `FILE` directly. `FILE*` is always passed
> as a pointer to `vfprintf()`, so it is perfectly valid to declare
> 
>    typedef struct _iobuf FILE;
> 
> or even 
> 
>    int fprintf (void* fp, const char* fmt, ...);

Removing "include stdio" and changing both FILE*'s to void*'s does in fact make
the test pass.  Is this an acceptable way to pass the test?

diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/fprintf.c
b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/fprintf.c
index 853a705e86d..75406298856 100644
--- a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/fprintf.c
+++ b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/fprintf.c
@@ -1,11 +1,11 @@
-#include <stdio.h>
+//#include <stdio.h>
 #include <stdarg.h>
 extern void abort (void);
 extern int inside_main;

 __attribute__ ((__noinline__))
 int
-fprintf (FILE *fp, const char *string, ...)
+fprintf (void *fp, const char *string, ...)
 {
   va_list ap;
   int r;
@@ -22,7 +22,7 @@ fprintf (FILE *fp, const char *string, ...)
 /* Locking stdio doesn't matter for the purposes of this test.  */
 __attribute__ ((__noinline__))
 int
-fprintf_unlocked (FILE *fp, const char *string, ...)
+fprintf_unlocked (void *fp, const char *string, ...)
 {
   va_list ap;
   int r;

Reply via email to