]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
analyzer: Fix tests for glibc 2.35 [PR101081]
authorJoel Teichroeb <joel@teichroeb.net>
Fri, 4 Feb 2022 16:35:08 +0000 (11:35 -0500)
committerDavid Malcolm <dmalcolm@redhat.com>
Wed, 9 Feb 2022 02:36:21 +0000 (21:36 -0500)
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>
gcc/testsuite/gcc.dg/analyzer/analyzer-verbosity-2a.c
gcc/testsuite/gcc.dg/analyzer/analyzer-verbosity-3a.c
gcc/testsuite/gcc.dg/analyzer/edges-1.c
gcc/testsuite/gcc.dg/analyzer/file-1.c
gcc/testsuite/gcc.dg/analyzer/file-2.c
gcc/testsuite/gcc.dg/analyzer/file-paths-1.c
gcc/testsuite/gcc.dg/analyzer/file-pr58237.c
gcc/testsuite/gcc.dg/analyzer/pr99716-1.c

index 9faf5da3a4fb15139050902cc21fcd0abedfed49..cf014b0a3c8fa01b04f2e9e062bd7c3711eeeb6d 100644 (file)
@@ -1,6 +1,9 @@
 /* { 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 ();
index 1b2b79836249f782e464d5b9a84b490ef68a44b1..b0ece203f56de1322672e87a084ab3be058cb816 100644 (file)
@@ -1,6 +1,9 @@
 /* { 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 ();
index 6b53ddddc057483ba454dd6a04955829256b706e..f08a6143d59b0aded87c052a9aedf28bfd424599 100644 (file)
@@ -1,4 +1,7 @@
-#include <stdio.h>
+typedef struct FILE   FILE;
+
+FILE* fopen (const char*, const char*);
+int   fclose (FILE*);
 
 extern int foo ();
 extern void bar ();
index 0f4bc5aa7af16440b6a2beb38eb9a3d9a82d9fc7..e8d934331fd473383335482e8c94af34cecf2a1e 100644 (file)
@@ -1,4 +1,9 @@
-#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)
index 8d34c7390841c865d492e0a7aeda2170139e8ac2..9c58108a5312b6e6f85a9a1a1d7dc6bdf0c8c34d 100644 (file)
@@ -1,4 +1,7 @@
-#include <stdio.h>
+typedef struct FILE   FILE;
+
+FILE* fopen (const char*, const char*);
+int   fclose (FILE*);
 
 struct foo
 {
index d346f7a7c9aa6aec5775e9da35276c7f685d518d..f35017835d49e7a6440d6deb7e269d7246ccb533 100644 (file)
@@ -1,6 +1,13 @@
 /* { 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.  */
index 68f49c25607ad169e10b79e265ff565762e23b73..ecc7144198b608ba05cdf8fce764504b2a432c51 100644 (file)
@@ -1,4 +1,10 @@
-#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)
 {
index 6720c3c198b9eb07e8f4cdf524b4b1e883587f2f..2ccdcc73a5c29a34977a3cc629596d43b21a24cc 100644 (file)
@@ -1,5 +1,10 @@
-#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)