In recent versions of glibc fopen has __attribute__((malloc)).
Since we can not detect wether this attribute is present or not,
we avoid including stdio.h and instead forward declare what we
need in each test.
Signed-off-by: Joel Teichroeb <joel@teichroeb.net>
gcc/testsuite/ChangeLog:
PR analyzer/101081
* gcc.dg/analyzer/analyzer-verbosity-2a.c: Replace #include of
stdio.h with declarations needed by the test.
* gcc.dg/analyzer/analyzer-verbosity-3a.c: Likewise.
* gcc.dg/analyzer/edges-1.c: Likewise.
* gcc.dg/analyzer/file-1.c: Likewise.
* gcc.dg/analyzer/file-2.c: Likewise.
* gcc.dg/analyzer/file-paths-1.c: Likewise.
* gcc.dg/analyzer/file-pr58237.c: Likewise.
* gcc.dg/analyzer/pr99716-1.c: Likewise.
Signed-off-by: David Malcolm <dmalcolm@redhat.com>
/* { dg-additional-options "-fanalyzer-verbosity=2" } */
-#include <stdio.h>
+typedef struct FILE FILE;
+
+FILE* fopen (const char*, const char*);
+int fclose (FILE*);
extern int foo ();
extern void bar ();
/* { dg-additional-options "-fanalyzer-verbosity=3" } */
-#include <stdio.h>
+typedef struct FILE FILE;
+
+FILE* fopen (const char*, const char*);
+int fclose (FILE*);
extern int foo ();
extern void bar ();
-#include <stdio.h>
+typedef struct FILE FILE;
+
+FILE* fopen (const char*, const char*);
+int fclose (FILE*);
extern int foo ();
extern void bar ();
-#include <stdio.h>
+typedef struct FILE FILE;
+
+FILE* fopen (const char*, const char*);
+int fclose (FILE*);
+#define SEEK_SET 0
+int fseek (FILE *, long int, int);
void
test_1 (const char *path)
-#include <stdio.h>
+typedef struct FILE FILE;
+
+FILE* fopen (const char*, const char*);
+int fclose (FILE*);
struct foo
{
/* { dg-additional-options "-fanalyzer-verbosity=3" } */
-#include <stdio.h>
+typedef struct FILE FILE;
+
+FILE* fopen (const char*, const char*);
+int fclose (FILE*);
+char *fgets (char *, int, FILE *);
+
+#define NULL ((void *)0)
+
/* Verify that we correctly emit CFG events in the face of buffers
being clobbered in these leak reports. */
-#include <stdio.h>
+typedef struct FILE FILE;
+
+FILE* fopen (const char*, const char*);
+int fclose (FILE*);
+char *fgets (char *, int, FILE *);
+
+#define NULL ((void *)0)
void f0(const char *str)
{
-#include <stdio.h>
-#include <stdlib.h>
+typedef struct FILE FILE;
+
+FILE* fopen (const char*, const char*);
+int fclose (FILE*);
+int fprintf (FILE *, const char *, ...);
+
+#define NULL ((void *)0)
void
test_1 (void)