]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
* gcc.dg/format/format.h: New file.
authorjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 7 Jan 2001 10:44:59 +0000 (10:44 +0000)
committerjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 7 Jan 2001 10:44:59 +0000 (10:44 +0000)
* gcc.dg/format/array-1.c, gcc.dg/format/attr-1.c,
gcc.dg/format/branch-1.c, gcc.dg/format/c90-printf-1.c,
gcc.dg/format/c90-printf-2.c, gcc.dg/format/c90-printf-3.c,
gcc.dg/format/c90-scanf-1.c, gcc.dg/format/c90-scanf-2.c,
gcc.dg/format/c90-scanf-3.c, gcc.dg/format/c90-scanf-4.c,
gcc.dg/format/c90-strftime-1.c, gcc.dg/format/c90-strftime-2.c,
gcc.dg/format/c94-printf-1.c, gcc.dg/format/c94-scanf-1.c,
gcc.dg/format/c99-printf-1.c, gcc.dg/format/c99-printf-2.c,
gcc.dg/format/c99-printf-3.c, gcc.dg/format/c99-scanf-1.c,
gcc.dg/format/c99-scanf-2.c, gcc.dg/format/c99-scanf-3.c,
gcc.dg/format/c99-strftime-1.c, gcc.dg/format/c99-strftime-2.c,
gcc.dg/format/diag-1.c, gcc.dg/format/errmk-1.c,
gcc.dg/format/ext-1.c, gcc.dg/format/ext-2.c,
gcc.dg/format/ext-3.c, gcc.dg/format/ext-4.c,
gcc.dg/format/ext-5.c, gcc.dg/format/miss-1.c,
gcc.dg/format/miss-2.c, gcc.dg/format/no-exargs-1.c,
gcc.dg/format/no-y2k-1.c, gcc.dg/format/nonlit-1.c,
gcc.dg/format/nonlit-2.c, gcc.dg/format/nonlit-3.c,
gcc.dg/format/sec-1.c, gcc.dg/format/strfmon-1.c,
gcc.dg/format/va-1.c, gcc.dg/format/warnll-1.c,
gcc.dg/format/xopen-1.c, gcc.dg/format/z-1.c: Include "format.h"
instead of declaring standard types, macros and functions in each
test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@38767 138bc75d-0d04-0410-961f-82ee72b054a4

44 files changed:
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/format/array-1.c
gcc/testsuite/gcc.dg/format/attr-1.c
gcc/testsuite/gcc.dg/format/branch-1.c
gcc/testsuite/gcc.dg/format/c90-printf-1.c
gcc/testsuite/gcc.dg/format/c90-printf-2.c
gcc/testsuite/gcc.dg/format/c90-printf-3.c
gcc/testsuite/gcc.dg/format/c90-scanf-1.c
gcc/testsuite/gcc.dg/format/c90-scanf-2.c
gcc/testsuite/gcc.dg/format/c90-scanf-3.c
gcc/testsuite/gcc.dg/format/c90-scanf-4.c
gcc/testsuite/gcc.dg/format/c90-strftime-1.c
gcc/testsuite/gcc.dg/format/c90-strftime-2.c
gcc/testsuite/gcc.dg/format/c94-printf-1.c
gcc/testsuite/gcc.dg/format/c94-scanf-1.c
gcc/testsuite/gcc.dg/format/c99-printf-1.c
gcc/testsuite/gcc.dg/format/c99-printf-2.c
gcc/testsuite/gcc.dg/format/c99-printf-3.c
gcc/testsuite/gcc.dg/format/c99-scanf-1.c
gcc/testsuite/gcc.dg/format/c99-scanf-2.c
gcc/testsuite/gcc.dg/format/c99-scanf-3.c
gcc/testsuite/gcc.dg/format/c99-strftime-1.c
gcc/testsuite/gcc.dg/format/c99-strftime-2.c
gcc/testsuite/gcc.dg/format/diag-1.c
gcc/testsuite/gcc.dg/format/errmk-1.c
gcc/testsuite/gcc.dg/format/ext-1.c
gcc/testsuite/gcc.dg/format/ext-2.c
gcc/testsuite/gcc.dg/format/ext-3.c
gcc/testsuite/gcc.dg/format/ext-4.c
gcc/testsuite/gcc.dg/format/ext-5.c
gcc/testsuite/gcc.dg/format/format.h [new file with mode: 0644]
gcc/testsuite/gcc.dg/format/miss-1.c
gcc/testsuite/gcc.dg/format/miss-2.c
gcc/testsuite/gcc.dg/format/no-exargs-1.c
gcc/testsuite/gcc.dg/format/no-y2k-1.c
gcc/testsuite/gcc.dg/format/nonlit-1.c
gcc/testsuite/gcc.dg/format/nonlit-2.c
gcc/testsuite/gcc.dg/format/nonlit-3.c
gcc/testsuite/gcc.dg/format/sec-1.c
gcc/testsuite/gcc.dg/format/strfmon-1.c
gcc/testsuite/gcc.dg/format/va-1.c
gcc/testsuite/gcc.dg/format/warnll-1.c
gcc/testsuite/gcc.dg/format/xopen-1.c
gcc/testsuite/gcc.dg/format/z-1.c

index e8051c8723952319d31a64f5fb2979cd660fe01f..e24ff842f0474f4fb979b0007f025579db85d484 100644 (file)
@@ -1,3 +1,30 @@
+2001-01-07  Joseph S. Myers  <jsm28@cam.ac.uk>
+
+       * gcc.dg/format/format.h: New file.
+       * gcc.dg/format/array-1.c, gcc.dg/format/attr-1.c,
+       gcc.dg/format/branch-1.c, gcc.dg/format/c90-printf-1.c,
+       gcc.dg/format/c90-printf-2.c, gcc.dg/format/c90-printf-3.c,
+       gcc.dg/format/c90-scanf-1.c, gcc.dg/format/c90-scanf-2.c,
+       gcc.dg/format/c90-scanf-3.c, gcc.dg/format/c90-scanf-4.c,
+       gcc.dg/format/c90-strftime-1.c, gcc.dg/format/c90-strftime-2.c,
+       gcc.dg/format/c94-printf-1.c, gcc.dg/format/c94-scanf-1.c,
+       gcc.dg/format/c99-printf-1.c, gcc.dg/format/c99-printf-2.c,
+       gcc.dg/format/c99-printf-3.c, gcc.dg/format/c99-scanf-1.c,
+       gcc.dg/format/c99-scanf-2.c, gcc.dg/format/c99-scanf-3.c,
+       gcc.dg/format/c99-strftime-1.c, gcc.dg/format/c99-strftime-2.c,
+       gcc.dg/format/diag-1.c, gcc.dg/format/errmk-1.c,
+       gcc.dg/format/ext-1.c, gcc.dg/format/ext-2.c,
+       gcc.dg/format/ext-3.c, gcc.dg/format/ext-4.c,
+       gcc.dg/format/ext-5.c, gcc.dg/format/miss-1.c,
+       gcc.dg/format/miss-2.c, gcc.dg/format/no-exargs-1.c,
+       gcc.dg/format/no-y2k-1.c, gcc.dg/format/nonlit-1.c,
+       gcc.dg/format/nonlit-2.c, gcc.dg/format/nonlit-3.c,
+       gcc.dg/format/sec-1.c, gcc.dg/format/strfmon-1.c,
+       gcc.dg/format/va-1.c, gcc.dg/format/warnll-1.c,
+       gcc.dg/format/xopen-1.c, gcc.dg/format/z-1.c: Include "format.h"
+       instead of declaring standard types, macros and functions in each
+       test.
+
 2001-01-06  Alexandre Oliva  <aoliva@redhat.com>
 
        * gcc.c-torture/execute/20010106-1.c: New test.
index 8d632a7f914a9405115953029f7c1d2bbd23b639..fa27abe1dee6774c9c1a943e4c777b96b11d3df7 100644 (file)
@@ -3,7 +3,7 @@
 /* { dg-do compile } */
 /* { dg-options "-std=gnu99 -Wformat=2" } */
 
-extern int printf (const char *, ...);
+#include "format.h"
 
 const char a1[] = "foo";
 const char a2[] = "foo%d";
index e6ebaf242f7b53a4c33c21b4aa0d15f5454fa3d0..b92c67a81e7bf9a11b7cb68713354055c48ced39 100644 (file)
@@ -3,5 +3,7 @@
 /* { dg-do compile } */
 /* { dg-options "-std=gnu99 -Wformat" } */
 
+#include "format.h"
+
 extern void foo0 (const char *) __attribute__((__format__(__strftime__, 1, 0)));
 extern void foo1 (const char *, ...) __attribute__((__format__(__strftime__, 1, 2))); /* { dg-error "cannot format" "strftime first_arg_num != 0" } */
index 6ff41311b75d2e0b0972be19f957fb3aae90b621..2d07104039000cc19937d47588a510d63ff543fc 100644 (file)
@@ -3,9 +3,7 @@
 /* { dg-do compile } */
 /* { dg-options "-std=gnu99 -Wformat" } */
 
-#define NULL ((void *)0)
-
-extern int printf (const char *, ...);
+#include "format.h"
 
 void
 foo (long l, int nfoo)
@@ -25,5 +23,5 @@ foo (long l, int nfoo)
   printf ((nfoo > 1) ? "%d foos" : ((nfoo > 0) ? "%ld foo" : "%d foos"), nfoo); /* { dg-warning "long int format" "wrong type" } */
   /* Extra arguments to NULL should be complained about.  */
   printf (NULL, "foo"); /* { dg-warning "too many" "NULL extra args" } */
-  /* { dg-warning "null" "null format arg" { target *-*-* } 27 } */
+  /* { dg-warning "null" "null format arg" { target *-*-* } 25 } */
 }
index 5058066b9466a4977701e44d8a3a7714a3f4cede..da7bb52e9c6d2af03d33b680b41448cd906f1572 100644 (file)
@@ -6,19 +6,7 @@
 /* { dg-do compile } */
 /* { dg-options "-std=iso9899:1990 -pedantic -Wformat" } */
 
-typedef __WCHAR_TYPE__ wchar_t;
-
-#ifndef __WINT_TYPE__
-#define __WINT_TYPE__ unsigned int
-#endif
-typedef __WINT_TYPE__ wint_t;
-
-__extension__ typedef long long int llong;
-__extension__ typedef unsigned long long int ullong;
-
-extern int printf (const char *, ...);
-
-#define NULL ((void *)0)
+#include "format.h"
 
 void
 foo (int i, int i1, int i2, unsigned int u, double d, char *s, void *p,
index 1f8c544b34ba53359612cf90471386ab81ac24b5..b9da764b60eb457fa1cced1d570b4a0e0ece1862 100644 (file)
@@ -5,33 +5,7 @@
 /* { dg-do compile } */
 /* { dg-options "-std=iso9899:1990 -pedantic -Wformat" } */
 
-typedef __SIZE_TYPE__ size_t;
-typedef __PTRDIFF_TYPE__ ptrdiff_t;
-
-__extension__ typedef long long int llong;
-
-/* This next definition is a kludge.  When GCC has a <stdint.h> it
-   should be used.
-*/
-/* (T *) if E is zero, (void *) otherwise.  */
-#define type_if_not(T, E) __typeof__(0 ? (T *)0 : (void *)(E))
-
-/* (T *) if E is nonzero, (void *) otherwise.  */
-#define type_if(T, E) type_if_not(T, !(E))
-
-/* Combine pointer types, all but one (void *).  */
-#define type_comb2(T1, T2) __typeof__(0 ? (T1)0 : (T2)0)
-#define type_comb3(T1, T2, T3) type_comb2(T1, type_comb2(T2, T3))
-
-#define maybe_int_ptr type_if(int, sizeof(int) == sizeof(llong))
-#define maybe_long_ptr type_if(long, sizeof(long) == sizeof(llong) && sizeof(long) > sizeof(int))
-#define maybe_long_long_ptr type_if(llong, sizeof(llong) > sizeof(long))
-
-#define intmax_type_ptr type_comb3(maybe_int_ptr, maybe_long_ptr, maybe_long_long_ptr)
-
-typedef __typeof__(*((intmax_type_ptr)0)) intmax_t;
-
-extern int printf (const char *, ...);
+#include "format.h"
 
 void
 foo (int i, double d, llong ll, intmax_t j, size_t z, ptrdiff_t t)
index 119cdeeffff815014649f064de098216d7393de9..78518a2b6599df2fae8eb0424b9eb7de4938018c 100644 (file)
@@ -6,28 +6,7 @@
 /* { dg-do compile } */
 /* { dg-options "-std=iso9899:1990 -pedantic -Wformat" } */
 
-/* This may not be correct in the particular case, but allows the
-   prototypes to be declared, and we don't try to link.
-*/
-typedef struct _FILE FILE;
-extern FILE *stdout;
-
-typedef __SIZE_TYPE__ size_t;
-typedef __builtin_va_list va_list;
-
-extern int fprintf (FILE *, const char *, ...);
-extern int printf (const char *, ...);
-extern int sprintf (char *, const char *, ...);
-extern int vfprintf (FILE *, const char *, va_list);
-extern int vprintf (const char *, va_list);
-extern int vsprintf (char *, const char *, va_list);
-
-extern int snprintf (char *, size_t, const char *, ...);
-extern int vsnprintf (char *, size_t, const char *, va_list);
-
-extern char *gettext (const char *);
-extern char *dgettext (const char *, const char *);
-extern char *dcgettext (const char *, const char *, int);
+#include "format.h"
 
 void
 foo (int i, char *s, size_t n, va_list v0, va_list v1, va_list v2, va_list v3,
index 922a7a782bd61311ce1d63224fa8f0e71a989772..813b79dd31191411914596704057fa9c033f22b3 100644 (file)
@@ -6,14 +6,7 @@
 /* { dg-do compile } */
 /* { dg-options "-std=iso9899:1990 -pedantic -Wformat" } */
 
-typedef __WCHAR_TYPE__ wchar_t;
-
-__extension__ typedef long long int llong;
-__extension__ typedef unsigned long long int ullong;
-
-extern int scanf (const char *, ...);
-
-#define NULL ((void *)0)
+#include "format.h"
 
 void
 foo (int *ip, unsigned int *uip, short int *hp, unsigned short int *uhp,
index 786acdde3790c2a762c5c839dde4a455d62078b9..52c08921ef9daf4b93ec5a7788af09cac5b501bb 100644 (file)
@@ -5,33 +5,7 @@
 /* { dg-do compile } */
 /* { dg-options "-std=iso9899:1990 -pedantic -Wformat" } */
 
-typedef __SIZE_TYPE__ size_t;
-typedef __PTRDIFF_TYPE__ ptrdiff_t;
-
-__extension__ typedef long long int llong;
-
-/* This next definition is a kludge.  When GCC has a <stdint.h> it
-   should be used.
-*/
-/* (T *) if E is zero, (void *) otherwise.  */
-#define type_if_not(T, E) __typeof__(0 ? (T *)0 : (void *)(E))
-
-/* (T *) if E is nonzero, (void *) otherwise.  */
-#define type_if(T, E) type_if_not(T, !(E))
-
-/* Combine pointer types, all but one (void *).  */
-#define type_comb2(T1, T2) __typeof__(0 ? (T1)0 : (T2)0)
-#define type_comb3(T1, T2, T3) type_comb2(T1, type_comb2(T2, T3))
-
-#define maybe_int_ptr type_if(int, sizeof(int) == sizeof(llong))
-#define maybe_long_ptr type_if(long, sizeof(long) == sizeof(llong) && sizeof(long) > sizeof(int))
-#define maybe_long_long_ptr type_if(llong, sizeof(llong) > sizeof(long))
-
-#define intmax_type_ptr type_comb3(maybe_int_ptr, maybe_long_ptr, maybe_long_long_ptr)
-
-typedef __typeof__(*((intmax_type_ptr)0)) intmax_t;
-
-extern int scanf (const char *, ...);
+#include "format.h"
 
 void
 foo (signed char *hhp, float *fp, llong *llp, intmax_t *jp,
index 147a22254f66897a82fc18e2692c7b92569560fe..9b6f29006f67d56f0399db96624e311905e1c366 100644 (file)
@@ -5,9 +5,7 @@
 /* { dg-do compile } */
 /* { dg-options "-std=iso9899:1990 -pedantic -Wformat" } */
 
-typedef __WCHAR_TYPE__ wchar_t;
-
-extern int scanf (const char *, ...);
+#include "format.h"
 
 void
 foo (char **sp, wchar_t **lsp)
index 3bbe66e598baad79e51ba57122b91e2d85cf9489..e15dbd22616f8127ddc39270528834d3dd480040 100644 (file)
@@ -6,25 +6,7 @@
 /* { dg-do compile } */
 /* { dg-options "-std=iso9899:1990 -pedantic -Wformat" } */
 
-/* This may not be correct in the particular case, but allows the
-   prototypes to be declared, and we don't try to link.
-*/
-typedef struct _FILE FILE;
-extern FILE *stdin;
-
-typedef __builtin_va_list va_list;
-
-extern int fscanf (FILE *, const char *, ...);
-extern int scanf (const char *, ...);
-extern int sscanf (const char *, const char *, ...);
-
-extern int vfscanf (FILE *, const char *, va_list);
-extern int vscanf (const char *, va_list);
-extern int vsscanf (const char *, const char *, va_list);
-
-extern char *gettext (const char *);
-extern char *dgettext (const char *, const char *);
-extern char *dcgettext (const char *, const char *, int);
+#include "format.h"
 
 void
 foo (int *ip, char *s, va_list v0, va_list v1, va_list v2, va_list v3,
index 6a13d5e321e6382611b7b8c2a82d5fb052a6e03a..0d75e9194dbd86277e0fba3b52c7ff2effa4e3be 100644 (file)
@@ -3,11 +3,7 @@
 /* { dg-do compile } */
 /* { dg-options "-std=iso9899:1990 -pedantic -Wformat" } */
 
-typedef __SIZE_TYPE__ size_t;
-
-struct tm;
-
-extern size_t strftime (char *, size_t, const char *, const struct tm *);
+#include "format.h"
 
 void
 foo (char *s, size_t m, const struct tm *tp)
index 4d6c2897bd14037f98c9268e5b836826f36bdbd1..9742e44d055aada95c013b5aab798ff55026bd28 100644 (file)
@@ -4,22 +4,18 @@
 /* { dg-do compile } */
 /* { dg-options "-std=iso9899:1990 -pedantic -Wformat" } */
 
-typedef __SIZE_TYPE__ size_t;
-
-struct tm;
-
-extern size_t strftime (char *, size_t, const char *, const struct tm *);
+#include "format.h"
 
 void
 foo (char *s, size_t m, const struct tm *tp)
 {
   strftime (s, m, "%C", tp); /* { dg-warning "C" "%C not in C90" } */
   strftime (s, m, "%D", tp); /* { dg-warning "C" "%D not in C90" } */
-  /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 17 } */
+  /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 13 } */
   strftime (s, m, "%e", tp); /* { dg-warning "C" "%e not in C90" } */
   strftime (s, m, "%F", tp); /* { dg-warning "C" "%F not in C90" } */
   strftime (s, m, "%g", tp); /* { dg-warning "C" "%g not in C90" } */
-  /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 21 } */
+  /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 17 } */
   strftime (s, m, "%G", tp); /* { dg-warning "C" "%G not in C90" } */
   strftime (s, m, "%h", tp); /* { dg-warning "C" "%h not in C90" } */
   strftime (s, m, "%n", tp); /* { dg-warning "C" "%n not in C90" } */
index 449a3427c155ebdc766295bdbaa29fe644990a53..9ffc8385e62120f6233f7675a5681860bf38fe36 100644 (file)
@@ -3,14 +3,7 @@
 /* { dg-do compile } */
 /* { dg-options "-std=iso9899:199409 -pedantic -Wformat" } */
 
-typedef __WCHAR_TYPE__ wchar_t;
-
-#ifndef __WINT_TYPE__
-#define __WINT_TYPE__ unsigned int
-#endif
-typedef __WINT_TYPE__ wint_t;
-
-extern int printf (const char *, ...);
+#include "format.h"
 
 void
 foo (wint_t lc, wchar_t *ls)
index 884cd288a0fb0e6d2869d0a1a33a8a4eccf975ea..1eaad7dbf26803aadd7cf5347d91db153886119f 100644 (file)
@@ -3,9 +3,7 @@
 /* { dg-do compile } */
 /* { dg-options "-std=iso9899:199409 -pedantic -Wformat" } */
 
-typedef __WCHAR_TYPE__ wchar_t;
-
-extern int scanf (const char *, ...);
+#include "format.h"
 
 void
 foo (wchar_t *ls)
index 179ea6e5516c22698fc07439e6868469e338fa78..e99015c9374579977d06483ff7b9fcd39085b81e 100644 (file)
@@ -6,38 +6,7 @@
 /* { dg-do compile } */
 /* { dg-options "-std=iso9899:1999 -pedantic -Wformat" } */
 
-typedef __WCHAR_TYPE__ wchar_t;
-typedef __WINT_TYPE__ wint_t;
-typedef __SIZE_TYPE__ size_t;
-typedef __PTRDIFF_TYPE__ ptrdiff_t;
-
-/* Kludge to get signed type corresponding to size_t.  */
-#define unsigned signed
-typedef __SIZE_TYPE__ signed_size_t;
-#undef unsigned
-
-/* These next definitions are kludges.  When GCC has a <stdint.h> it
-   should be used.
-*/
-#include <limits.h>
-#if INT_MAX == LLONG_MAX
-typedef int intmax_t;
-#elif LONG_MAX == LLONG_MAX
-typedef long intmax_t;
-#else
-typedef long long intmax_t;
-#endif
-#if UINT_MAX == ULLONG_MAX
-typedef unsigned int uintmax_t;
-#elif ULONG_MAX == ULLONG_MAX
-typedef unsigned long uintmax_t;
-#else
-typedef unsigned long long uintmax_t;
-#endif
-
-extern int printf (const char *, ...);
-
-#define NULL ((void *)0)
+#include "format.h"
 
 void
 foo (int i, unsigned int u, double d, char *s, void *p, int *n,
index 26b9de97f9274ca45a50d44a5469c82f7c06c3bb..9efcb0667c40e6eea0079d601d214c62c2fdd968 100644 (file)
@@ -5,11 +5,7 @@
 /* { dg-do compile } */
 /* { dg-options "-std=iso9899:1999 -pedantic -Wformat" } */
 
-typedef __SIZE_TYPE__ size_t;
-typedef __WCHAR_TYPE__ wchar_t;
-typedef __WINT_TYPE__ wint_t;
-
-extern int printf (const char *, ...);
+#include "format.h"
 
 void
 foo (int i, long long ll, size_t z, wint_t lc, wchar_t *ls)
index 26f76d7f830f09af71298d212d94ad5cdab426cb..23ef33d29d00922a578a0c8cf7212130444a58f5 100644 (file)
@@ -5,27 +5,7 @@
 /* { dg-do compile } */
 /* { dg-options "-std=iso9899:1999 -pedantic -Wformat" } */
 
-/* This may not be correct in the particular case, but allows the
-   prototypes to be declared, and we don't try to link.
-*/
-typedef struct _FILE FILE;
-extern FILE *stdout;
-
-typedef __SIZE_TYPE__ size_t;
-typedef __builtin_va_list va_list;
-
-extern int fprintf (FILE *restrict, const char *restrict, ...);
-extern int printf (const char *restrict, ...);
-extern int sprintf (char *restrict, const char *restrict, ...);
-extern int vfprintf (FILE *restrict, const char *restrict, va_list);
-extern int vprintf (const char *restrict, va_list);
-extern int vsprintf (char *restrict, const char *restrict, va_list);
-extern int snprintf (char *restrict, size_t, const char *restrict, ...);
-extern int vsnprintf (char *restrict, size_t, const char *restrict, va_list);
-
-extern char *gettext (const char *);
-extern char *dgettext (const char *, const char *);
-extern char *dcgettext (const char *, const char *, int);
+#include "format.h"
 
 void
 foo (int i, char *s, size_t n, va_list v0, va_list v1, va_list v2, va_list v3,
index 369f02e667bd277847ddb1f5f8f0a657a74555b5..7910ece7a70bd8a174b34d123fff67e068347c96 100644 (file)
@@ -6,38 +6,7 @@
 /* { dg-do compile } */
 /* { dg-options "-std=iso9899:1999 -pedantic -Wformat" } */
 
-typedef __WCHAR_TYPE__ wchar_t;
-typedef __SIZE_TYPE__ size_t;
-typedef __PTRDIFF_TYPE__ ptrdiff_t;
-
-/* Kludges to get types corresponding to size_t and ptrdiff_t.  */
-#define unsigned signed
-typedef __SIZE_TYPE__ signed_size_t;
-#undef unsigned
-#define signed /* Type might or might not have explicit 'signed'.  */
-typedef unsigned __PTRDIFF_TYPE__ unsigned_ptrdiff_t;
-#undef signed
-
-/* These next definitions are kludges.  When GCC has a <stdint.h> it
-   should be used.
-*/
-#include <limits.h>
-#if INT_MAX == LLONG_MAX
-typedef int intmax_t;
-#elif LONG_MAX == LLONG_MAX
-typedef long intmax_t;
-#else
-typedef long long intmax_t;
-#endif
-#if UINT_MAX == ULLONG_MAX
-typedef unsigned int uintmax_t;
-#elif ULONG_MAX == ULLONG_MAX
-typedef unsigned long uintmax_t;
-#else
-typedef unsigned long long uintmax_t;
-#endif
-
-extern int scanf (const char *, ...);
+#include "format.h"
 
 void
 foo (int *ip, unsigned int *uip, short int *hp, unsigned short int *uhp,
index a740a601c0e1904232a0b5c35060bf5fadc4b8fe..eedf3e57c103510a12f97bddfd2e8839b5a9ae25 100644 (file)
@@ -5,9 +5,7 @@
 /* { dg-do compile } */
 /* { dg-options "-std=iso9899:1999 -pedantic -Wformat" } */
 
-typedef __WCHAR_TYPE__ wchar_t;
-
-extern int scanf (const char *, ...);
+#include "format.h"
 
 void
 foo (int *ip, long long int *llp, wchar_t *ls)
index df30c05df46c0cf72a328fde84fae6bf75a1a5b2..091a3ea95466510ea643a90f34f07d3cac86eef2 100644 (file)
@@ -5,24 +5,7 @@
 /* { dg-do compile } */
 /* { dg-options "-std=iso9899:1999 -pedantic -Wformat" } */
 
-/* This may not be correct in the particular case, but allows the
-   prototypes to be declared, and we don't try to link.
-*/
-typedef struct _FILE FILE;
-extern FILE *stdin;
-
-typedef __builtin_va_list va_list;
-
-extern int fscanf (FILE *restrict, const char *restrict, ...);
-extern int scanf (const char *restrict, ...);
-extern int sscanf (const char *restrict, const char *restrict, ...);
-extern int vfscanf (FILE *restrict, const char *restrict, va_list);
-extern int vscanf (const char *restrict, va_list);
-extern int vsscanf (const char *restrict, const char *restrict, va_list);
-
-extern char *gettext (const char *);
-extern char *dgettext (const char *, const char *);
-extern char *dcgettext (const char *, const char *, int);
+#include "format.h"
 
 void
 foo (int *ip, char *s, va_list v0, va_list v1, va_list v2, va_list v3,
index 187fc7ceb492866415f66518e0bb1c25097fb2f0..a643d2999a6ea896f88295899a86c0b7f76fb9ed 100644 (file)
@@ -3,11 +3,7 @@
 /* { dg-do compile } */
 /* { dg-options "-std=iso9899:1999 -pedantic -Wformat" } */
 
-typedef __SIZE_TYPE__ size_t;
-
-struct tm;
-
-extern size_t strftime (char *, size_t, const char *, const struct tm *);
+#include "format.h"
 
 void
 foo (char *s, size_t m, const struct tm *tp)
@@ -35,19 +31,19 @@ foo (char *s, size_t m, const struct tm *tp)
   strftime (s, m, "%EOy", tp); /* { dg-warning "multiple|together" "multiple %E/%O" } */
   strftime (s, m, "%OEy", tp); /* { dg-warning "multiple|together" "multiple %E/%O" } */
   strftime (s, m, "%OOV", tp); /* { dg-warning "multiple|repeated" "multiple %E/%O" } */
-  /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 35 } */
-  /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 36 } */
+  /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 31 } */
+  /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 32 } */
   strftime (s, m, "%Ea", tp); /* { dg-warning "flag|modifier" "bad %Ea" } */
   strftime (s, m, "%EA", tp); /* { dg-warning "flag|modifier" "bad %EA" } */
   strftime (s, m, "%Eb", tp); /* { dg-warning "flag|modifier" "bad %Eb" } */
   strftime (s, m, "%EB", tp); /* { dg-warning "flag|modifier" "bad %EB" } */
   strftime (s, m, "%Ed", tp); /* { dg-warning "flag|modifier" "bad %Ed" } */
   strftime (s, m, "%ED", tp); /* { dg-warning "flag|modifier" "bad %ED" } */
-  /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 45 } */
+  /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 41 } */
   strftime (s, m, "%Ee", tp); /* { dg-warning "flag|modifier" "bad %Ee" } */
   strftime (s, m, "%EF", tp); /* { dg-warning "flag|modifier" "bad %EF" } */
   strftime (s, m, "%Eg", tp); /* { dg-warning "flag|modifier" "bad %Eg" } */
-  /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 49 } */
+  /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 45 } */
   strftime (s, m, "%EG", tp); /* { dg-warning "flag|modifier" "bad %EG" } */
   strftime (s, m, "%Eh", tp); /* { dg-warning "flag|modifier" "bad %Eh" } */
   strftime (s, m, "%EH", tp); /* { dg-warning "flag|modifier" "bad %EH" } */
@@ -75,13 +71,13 @@ foo (char *s, size_t m, const struct tm *tp)
   strftime (s, m, "%Ob", tp); /* { dg-warning "flag|modifier" "bad %Ob" } */
   strftime (s, m, "%OB", tp); /* { dg-warning "flag|modifier" "bad %OB" } */
   strftime (s, m, "%Oc", tp); /* { dg-warning "flag|modifier" "bad %Oc" } */
-  /* { dg-warning "in some locales" "2-digit year" { target *-*-* } 77 } */
+  /* { dg-warning "in some locales" "2-digit year" { target *-*-* } 73 } */
   strftime (s, m, "%OC", tp); /* { dg-warning "flag|modifier|C" "bad %OC" } */
   strftime (s, m, "%OD", tp); /* { dg-warning "flag|modifier" "bad %OD" } */
-  /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 80 } */
+  /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 76 } */
   strftime (s, m, "%OF", tp); /* { dg-warning "flag|modifier" "bad %OF" } */
   strftime (s, m, "%Og", tp); /* { dg-warning "flag|modifier|C" "bad %Og" } */
-  /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 83 } */
+  /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 79 } */
   strftime (s, m, "%OG", tp); /* { dg-warning "flag|modifier|C" "bad %OG" } */
   strftime (s, m, "%Oh", tp); /* { dg-warning "flag|modifier" "bad %Oh" } */
   strftime (s, m, "%Oj", tp); /* { dg-warning "flag|modifier|C" "bad %Oj" } */
@@ -92,7 +88,7 @@ foo (char *s, size_t m, const struct tm *tp)
   strftime (s, m, "%Ot", tp); /* { dg-warning "flag|modifier" "bad %Ot" } */
   strftime (s, m, "%OT", tp); /* { dg-warning "flag|modifier" "bad %OT" } */
   strftime (s, m, "%Ox", tp); /* { dg-warning "flag|modifier" "bad %Ox" } */
-  /* { dg-warning "in some locales" "2-digit year" { target *-*-* } 94 } */
+  /* { dg-warning "in some locales" "2-digit year" { target *-*-* } 90 } */
   strftime (s, m, "%OX", tp); /* { dg-warning "flag|modifier" "bad %OX" } */
   strftime (s, m, "%OY", tp); /* { dg-warning "flag|modifier|C" "bad %OY" } */
   strftime (s, m, "%Oz", tp); /* { dg-warning "flag|modifier|C" "bad %Oz" } */
index 45d8ef423f351de3b3c4f0b8b385f1f11cee2955..747faa2c22caa73cf2a24d071630c54ed64d5069 100644 (file)
@@ -3,11 +3,7 @@
 /* { dg-do compile } */
 /* { dg-options "-std=iso9899:1999 -pedantic -Wformat" } */
 
-typedef __SIZE_TYPE__ size_t;
-
-struct tm;
-
-extern size_t strftime (char *, size_t, const char *, const struct tm *);
+#include "format.h"
 
 void
 foo (char *s, size_t m, const struct tm *tp)
index 33364d75159178704005dde0051258d91f10c0e4..1c9a246165b354c9556ad4d22819164a6740676a 100644 (file)
@@ -3,7 +3,7 @@
 /* { dg-do compile } */
 /* { dg-options "-std=gnu99 -Wformat" } */
 
-extern int printf (const char *, ...);
+#include "format.h"
 
 void
 foo (double d)
index bf05f4eebbc0d8487d757e11cc4b943f94ef013a..77630ab0a093dbdc10fad2264092e97919f52f89 100644 (file)
@@ -3,7 +3,7 @@
 /* { dg-do compile } */
 /* { dg-options "-Wformat" } */
 
-extern int printf (const char *, ...);
+#include "format.h"
 
 void
 foo (int t)
index 238a47802be5c40e17b2e22d18f3077c6b81a3bd..dd780321c0a261c730ae2e7fc9f962b315796c7a 100644 (file)
@@ -5,15 +5,7 @@
 /* { dg-do compile } */
 /* { dg-options "-std=gnu99 -Wformat" } */
 
-/* %q formats want a "quad"; GCC considers this to be a long long.  */
-typedef long long int quad_t;
-typedef unsigned long long int u_quad_t;
-
-typedef __WCHAR_TYPE__ wchar_t;
-typedef __WINT_TYPE__ wint_t;
-typedef __SIZE_TYPE__ size_t;
-
-extern int printf (const char *, ...);
+#include "format.h"
 
 void
 foo (quad_t q, u_quad_t uq, quad_t *qn, size_t z, size_t *zn, long long int ll,
index 68c1b03447044b41cb178cdb9fb0f63835c8e0f3..466991b5959a16d97d46cdb88a204147964ef08b 100644 (file)
@@ -5,13 +5,7 @@
 /* { dg-do compile } */
 /* { dg-options "-std=gnu99 -Wformat" } */
 
-/* %q formats want a "quad"; GCC considers this to be a long long.  */
-typedef long long int quad_t;
-typedef unsigned long long int u_quad_t;
-
-typedef __WCHAR_TYPE__ wchar_t;
-
-extern int scanf (const char *, ...);
+#include "format.h"
 
 void
 foo (quad_t *qp, u_quad_t *uqp, quad_t *qn, long long int *llp,
index ea9f2e02910d2a10e1e0740f8150c98a082e2dd1..e71731ed987f81563c1ec970ad80efb1d3e21c54 100644 (file)
@@ -5,11 +5,7 @@
 /* { dg-do compile } */
 /* { dg-options "-std=gnu99 -Wformat" } */
 
-typedef __SIZE_TYPE__ size_t;
-
-struct tm;
-
-extern size_t strftime (char *, size_t, const char *, const struct tm *);
+#include "format.h"
 
 void
 foo (char *s, size_t m, const struct tm *tp)
@@ -102,6 +98,10 @@ foo (char *s, size_t m, const struct tm *tp)
   strftime (s, m, "%-x", tp); /* { dg-warning "flag" "bad %x" } */
   strftime (s, m, "%_x", tp); /* { dg-warning "flag" "bad %x" } */
   strftime (s, m, "%0x", tp); /* { dg-warning "flag" "bad %x" } */
+  /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 89 } */
+  /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 90 } */
+  /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 91 } */
+  /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 92 } */
   /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 93 } */
   /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 94 } */
   /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 95 } */
@@ -110,10 +110,6 @@ foo (char *s, size_t m, const struct tm *tp)
   /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 98 } */
   /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 99 } */
   /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 100 } */
-  /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 101 } */
-  /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 102 } */
-  /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 103 } */
-  /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 104 } */
   /* Incorrect usages with GNU extension conversion characters.  */
   strftime (s, m, "%5P", tp); /* { dg-warning "width" "bad %P" } */
   strftime (s, m, "%-P", tp); /* { dg-warning "flag" "bad %P" } */
@@ -193,16 +189,16 @@ foo (char *s, size_t m, const struct tm *tp)
   strftime (s, m, "%#x", tp); /* { dg-warning "flag" "bad %x" } */
   strftime (s, m, "%^y", tp); /* { dg-warning "flag" "bad %y" } */
   strftime (s, m, "%#y", tp); /* { dg-warning "flag" "bad %y" } */
+  /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 182 } */
+  /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 183 } */
+  /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 184 } */
+  /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 185 } */
   /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 186 } */
   /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 187 } */
   /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 188 } */
   /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 189 } */
   /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 190 } */
   /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 191 } */
-  /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 192 } */
-  /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 193 } */
-  /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 194 } */
-  /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 195 } */
   /* GCC also accepts the glibc format extensions %P, %k, %l, %s.  */
   strftime (s, m, "%P%k%l%s", tp);
   /* GCC also accepts the glibc extension of the "O" modifier on some
index c0cf740a9e604a5bbf7f5a9ea7fe61fdb26e8e4e..db8250067b057445ca4550f93c2340769ac91727 100644 (file)
@@ -3,9 +3,7 @@
 /* { dg-do compile } */
 /* { dg-options "-std=gnu89 -Wformat" } */
 
-typedef __WCHAR_TYPE__ wchar_t;
-
-extern int scanf (const char *, ...);
+#include "format.h"
 
 void
 foo (char **sp, wchar_t **lsp)
index e3cce44b4463f5a1329ac50bff016fb2f5333989..eebc7faa38c542ccb15178a8c11e3302877c40a7 100644 (file)
@@ -3,11 +3,7 @@
 /* { dg-do compile } */
 /* { dg-options "-std=gnu99 -Wformat" } */
 
-extern int printf (const char *, ...);
-
-extern char *gettext (const char *);
-extern char *dgettext (const char *, const char *);
-extern char *dcgettext (const char *, const char *, int);
+#include "format.h"
 
 void
 foo (int i, long l)
diff --git a/gcc/testsuite/gcc.dg/format/format.h b/gcc/testsuite/gcc.dg/format/format.h
new file mode 100644 (file)
index 0000000..b41ebd9
--- /dev/null
@@ -0,0 +1,93 @@
+/* Format checking tests: common header.  */
+/* Origin: Joseph Myers <jsm28@cam.ac.uk> */
+
+#include <stdarg.h>
+#include <stddef.h>
+
+#ifndef _WINT_T
+#ifndef __WINT_TYPE__
+#define __WINT_TYPE__ unsigned int
+#endif
+typedef __WINT_TYPE__ wint_t;
+#endif
+
+/* Kludges to get types corresponding to size_t and ptrdiff_t.  */
+#define unsigned signed
+typedef __SIZE_TYPE__ signed_size_t;
+/* We also use this type to approximate ssize_t.  */
+typedef __SIZE_TYPE__ ssize_t;
+#undef unsigned
+#define signed /* Type might or might not have explicit 'signed'.  */
+typedef unsigned __PTRDIFF_TYPE__ unsigned_ptrdiff_t;
+#undef signed
+
+__extension__ typedef long long int llong;
+__extension__ typedef unsigned long long int ullong;
+
+/* %q formats want a "quad"; GCC considers this to be a long long.  */
+typedef llong quad_t;
+typedef ullong u_quad_t;
+
+/* This next definition is a kludge.  When GCC has a <stdint.h> it
+   should be used.
+*/
+/* (T *) if E is zero, (void *) otherwise.  */
+#define type_if_not(T, E) __typeof__(0 ? (T *)0 : (void *)(E))
+
+/* (T *) if E is nonzero, (void *) otherwise.  */
+#define type_if(T, E) type_if_not(T, !(E))
+
+/* Combine pointer types, all but one (void *).  */
+#define type_comb2(T1, T2) __typeof__(0 ? (T1)0 : (T2)0)
+#define type_comb3(T1, T2, T3) type_comb2(T1, type_comb2(T2, T3))
+
+#define maybe_int_ptr type_if(int, sizeof(int) == sizeof(llong))
+#define maybe_uint_ptr type_if(unsigned int, sizeof(unsigned int) == sizeof(ullong))
+#define maybe_long_ptr type_if(long, sizeof(long) == sizeof(llong) && sizeof(long) > sizeof(int))
+#define maybe_ulong_ptr type_if(unsigned long, sizeof(unsigned long) == sizeof(ullong) && sizeof(unsigned long) > sizeof(unsigned int))
+#define maybe_long_long_ptr type_if(llong, sizeof(llong) > sizeof(long))
+#define maybe_ulong_long_ptr type_if(ullong, sizeof(ullong) > sizeof(unsigned long))
+
+#define intmax_type_ptr type_comb3(maybe_int_ptr, maybe_long_ptr, maybe_long_long_ptr)
+#define uintmax_type_ptr type_comb3(maybe_uint_ptr, maybe_ulong_ptr, maybe_ulong_long_ptr)
+
+typedef __typeof__(*((intmax_type_ptr)0)) intmax_t;
+typedef __typeof__(*((uintmax_type_ptr)0)) uintmax_t;
+
+#if __STDC_VERSION__ < 199901L
+#define restrict /* "restrict" not in old C standard.  */
+#endif
+
+/* This may not be correct in the particular case, but allows the
+   prototypes to be declared, and we don't try to link.
+*/
+typedef struct _FILE FILE;
+extern FILE *stdin;
+extern FILE *stdout;
+
+extern int fprintf (FILE *restrict, const char *restrict, ...);
+extern int printf (const char *restrict, ...);
+extern int sprintf (char *restrict, const char *restrict, ...);
+extern int vfprintf (FILE *restrict, const char *restrict, va_list);
+extern int vprintf (const char *restrict, va_list);
+extern int vsprintf (char *restrict, const char *restrict, va_list);
+extern int snprintf (char *restrict, size_t, const char *restrict, ...);
+extern int vsnprintf (char *restrict, size_t, const char *restrict, va_list);
+
+extern int fscanf (FILE *restrict, const char *restrict, ...);
+extern int scanf (const char *restrict, ...);
+extern int sscanf (const char *restrict, const char *restrict, ...);
+extern int vfscanf (FILE *restrict, const char *restrict, va_list);
+extern int vscanf (const char *restrict, va_list);
+extern int vsscanf (const char *restrict, const char *restrict, va_list);
+
+extern char *gettext (const char *);
+extern char *dgettext (const char *, const char *);
+extern char *dcgettext (const char *, const char *, int);
+
+struct tm;
+
+extern size_t strftime (char *restrict, size_t, const char *restrict,
+                       const struct tm *restrict);
+
+extern ssize_t strfmon (char *restrict, size_t, const char *restrict, ...);
index a5d467adc352e4f5e56b365d3bcc6fc6cdd0c26e..234578535aa687475fac83a663fde5e4fb379b09 100644 (file)
@@ -3,10 +3,7 @@
 /* { dg-do compile } */
 /* { dg-options "-std=gnu99 -Wformat -Wmissing-format-attribute" } */
 
-#include <stdarg.h>
-
-extern int vprintf (const char *restrict, va_list);
-extern int vscanf (const char *restrict, va_list);
+#include "format.h"
 
 void
 foo (const char *fmt, ...)
index b7c55019e3e7c9859d1d569f83e07c9d878fd431..f3afe2472ebed31a353400f73dcfc595999fe215 100644 (file)
@@ -4,9 +4,7 @@
 /* { dg-do compile } */
 /* { dg-options "-std=gnu99 -Wformat -Wmissing-format-attribute" } */
 
-#include <stdarg.h>
-
-extern int vprintf (const char *restrict, va_list);
+#include "format.h"
 
 void
 foo (int i, ...)
index bbf5a8a75e0c16204fe0430c5a579bc22174120a..75247087f28ad7d3aa35209b7da489d28f29f115 100644 (file)
@@ -4,7 +4,7 @@
 /* { dg-do compile } */
 /* { dg-options "-std=gnu99 -Wformat -Wno-format-extra-args" } */
 
-extern int printf (const char *, ...);
+#include "format.h"
 
 void
 foo (int i)
index e41d26d004cd0e86d496329161fe4cbc72299590..ee68cd6db9faa189e9796016c4f39a668fe31d51 100644 (file)
@@ -3,11 +3,7 @@
 /* { dg-do compile } */
 /* { dg-options "-std=gnu99 -Wformat -Wno-format-y2k" } */
 
-typedef __SIZE_TYPE__ size_t;
-
-struct tm;
-
-extern size_t strftime (char *, size_t, const char *, const struct tm *);
+#include "format.h"
 
 void
 foo (char *s, size_t m, const struct tm *tp)
index e40bf088bbcede4a35d2d3514ed8f17703e357c4..af0cd372381fd6761c3c8cb43bd5f6cfd7568889 100644 (file)
@@ -3,10 +3,10 @@
 /* { dg-do compile } */
 /* { dg-options "-std=gnu99 -Wformat -Wformat-nonliteral" } */
 
-extern int printf (const char *, ...);
+#include "format.h"
 
 void
-foo (char *s, __SIZE_TYPE__ i)
+foo (char *s, size_t i)
 {
   printf ((const char *)i, i); /* { dg-warning "argument types" "non-literal" } */
   printf (s, i); /* { dg-warning "argument types" "non-literal" } */
index 9c3eee8ced66699cfe5b3655945fd08d7d54b94b..2ca2e4803754baae61f79dd28f0236942d09312f 100644 (file)
@@ -3,10 +3,10 @@
 /* { dg-do compile } */
 /* { dg-options "-std=gnu99 -Wformat=2" } */
 
-extern int printf (const char *, ...);
+#include "format.h"
 
 void
-foo (char *s, __SIZE_TYPE__ i)
+foo (char *s, size_t i)
 {
   printf ((const char *)i, i); /* { dg-warning "argument types" "non-literal" } */
   printf (s, i); /* { dg-warning "argument types" "non-literal" } */
index 4423151b4c136bb33fd1fc92d823daa45aa9f4f0..ce94c8c36683f965acc59d0a82c65ababab35e1a 100644 (file)
@@ -3,11 +3,7 @@
 /* { dg-do compile } */
 /* { dg-options "-std=gnu99 -Wformat -Wformat-nonliteral" } */
 
-typedef __SIZE_TYPE__ size_t;
-
-struct tm;
-
-extern size_t strftime (char *, size_t, const char *, const struct tm *);
+#include "format.h"
 
 void
 foo (char *s, size_t m, const struct tm *tp, char *fmt)
index 5ca4905d1be477a93252e641788507396082984b..9189b51e10d03a10285942aeabe65c9b0840dba9 100644 (file)
@@ -3,7 +3,7 @@
 /* { dg-do compile } */
 /* { dg-options "-std=gnu99 -Wformat -Wformat-security" } */
 
-extern int printf (const char *, ...);
+#include "format.h"
 
 void
 foo (char *s)
index 40d44c14a71e728bf714830ddb73a1b645645747..cf381b87d2defa658c43949e5145fede584fdc5c 100644 (file)
@@ -3,16 +3,7 @@
 /* { dg-do compile } */
 /* { dg-options "-std=gnu99 -Wformat" } */
 
-typedef __SIZE_TYPE__ size_t;
-
-/* Kludge to get something that may be ssize_t.  */
-#define unsigned signed
-typedef __SIZE_TYPE__ ssize_t;
-#undef unsigned
-
-#define NULL ((void *)0)
-
-extern ssize_t strfmon (char *restrict, size_t, const char *restrict, ...);
+#include "format.h"
 
 void
 foo (char *s, size_t m, double d, long double ld)
index 9538e2b328686ad1d8a733dafb0f31ce8df59828..5f5eeab4e84736ba4062c33ea83851c005033217 100644 (file)
@@ -3,7 +3,7 @@
 /* { dg-do compile } */
 /* { dg-options "-Wformat" } */
 
-extern int printf (const char *, ...);
+#include "format.h"
 
 void
 foo (void *p)
index 71a749b71a8d743313437adabba820d4214b66bd..2d22776937add211ece82456a4fa0dfcc716232b 100644 (file)
@@ -5,8 +5,7 @@
 /* { dg-do compile } */
 /* { dg-options "-std=iso9899:1990 -pedantic -Wformat -Wno-long-long" } */
 
-extern int printf (const char *, ...);
-extern int scanf (const char *, ...);
+#include "format.h"
 
 void
 foo (long long ll, unsigned long long ull, long long *lln,
index 99d571bb0061504046485d215df89406a710a31f..38cba1eb7353238dd7d2e094ba37526031976c3f 100644 (file)
@@ -6,13 +6,7 @@
 /* { dg-do compile } */
 /* { dg-options "-std=gnu99 -Wformat" } */
 
-typedef __WCHAR_TYPE__ wchar_t;
-typedef __WINT_TYPE__ wint_t;
-typedef __builtin_va_list va_list;
-
-extern int printf (const char *, ...);
-extern int vprintf (const char *, va_list);
-extern int scanf (const char *, ...);
+#include "format.h"
 
 void
 foo (int i, unsigned int u, wint_t lc, wchar_t *ls, int *ip, double d,
index 4125d54592c6933148da8a532fee6e68ce23ca79..7916201ff7d4eef17849523dcd1408c8ad006d30 100644 (file)
@@ -3,10 +3,7 @@
 /* { dg-do compile } */
 /* { dg-options "-Wformat" } */
 
-typedef __SIZE_TYPE__ size_t;
-
-extern int printf (const char *, ...);
-extern int scanf (const char *, ...);
+#include "format.h"
 
 size_t
 foo (void)