diff options
Diffstat (limited to 'gcc-4.8.1/gcc/testsuite/gcc.dg/format')
161 files changed, 0 insertions, 6202 deletions
diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/array-1.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/array-1.c deleted file mode 100644 index 14db56e03..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/array-1.c +++ /dev/null @@ -1,41 +0,0 @@ -/* Test for format checking of constant arrays. */ -/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ -/* { dg-do compile } */ -/* { dg-options "-std=gnu99 -Wformat=2" } */ - -#include "format.h" - -const char a1[] = "foo"; -const char a2[] = "foo%d"; -const char b1[3] = "foo"; -const char b2[1] = "1"; -static const char c1[] = "foo"; -static const char c2[] = "foo%d"; -char d[] = "foo"; -volatile const char e[] = "foo"; - -void -foo (int i, long l) -{ - const char p1[] = "bar"; - const char p2[] = "bar%d"; - static const char q1[] = "bar"; - static const char q2[] = "bar%d"; - printf (a1); - printf (a2, i); - printf (a2, l); /* { dg-warning "format" "wrong type with array" } */ - printf (b1); /* { dg-warning "unterminated" "unterminated array" } */ - printf (b2); /* { dg-warning "unterminated" "unterminated array" } */ - printf (c1); - printf (c2, i); - printf (c2, l); /* { dg-warning "format" "wrong type with array" } */ - printf (p1); - printf (p2, i); - printf (p2, l); /* { dg-warning "format" "wrong type with array" } */ - printf (q1); - printf (q2, i); - printf (q2, l); /* { dg-warning "format" "wrong type with array" } */ - /* Volatile or non-constant arrays must not be checked. */ - printf (d); /* { dg-warning "not a string literal" "non-const" } */ - printf ((const char *)e); /* { dg-warning "not a string literal" "volatile" } */ -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/asm_fprintf-1.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/asm_fprintf-1.c deleted file mode 100644 index d71834af7..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/asm_fprintf-1.c +++ /dev/null @@ -1,80 +0,0 @@ -/* Test for asm_fprintf formats. */ -/* Origin: Kaveh Ghazi <ghazi@caip.rutgers.edu> */ -/* { dg-do compile } */ -/* { dg-options "-Wformat" } */ - -#include "format.h" - -/* Magic identifier must be set before the attribute is used. */ -typedef long long __gcc_host_wide_int__; - -extern int asm_fprintf (const char *, ...) __attribute__ ((__format__ (__asm_fprintf__, 1, 2))) __attribute__ ((__nonnull__)); - -void -foo (int i, int i1, int i2, unsigned int u, double d, char *s, void *p, - int *n, short int *hn, long int l, unsigned long int ul, - long int *ln, long double ld, wint_t lc, wchar_t *ls, llong ll, - ullong ull, unsigned int *un, const int *cn, signed char *ss, - unsigned char *us, const signed char *css, unsigned int u1, - unsigned int u2) -{ - /* Acceptable C90 specifiers, flags and modifiers. */ - asm_fprintf ("%%"); - asm_fprintf ("%d%i%o%u%x%X%c%s%%", i, i, u, u, u, u, i, s); - asm_fprintf ("%ld%li%lo%lu%lx%lX", l, l, ul, ul, ul, ul); - asm_fprintf ("%lld%lli%llo%llu%llx%llX", ll, ll, ull, ull, ull, ull); - asm_fprintf ("%-d%-i%-o%-u%-x%-X%-c%-s", i, i, u, u, u, u, i, s); - asm_fprintf ("% d% i\n", i, i); - asm_fprintf ("%#o%#x%#X", u, u, u); - asm_fprintf ("%08d%08i%08o%08u%08x%08X", i, i, u, u, u, u); - asm_fprintf ("%d\n", i); - asm_fprintf ("%+d\n", i); - asm_fprintf ("%3d\n", i); - asm_fprintf ("%-3d\n", i); - asm_fprintf ("%.7d\n", i); - asm_fprintf ("%+9.4d\n", i); - asm_fprintf ("%.3ld\n", l); - asm_fprintf ("%d %lu\n", i, ul); - - /* Extensions provided in asm_fprintf. */ - asm_fprintf ("%O%R%I%L%U%@"); - asm_fprintf ("%r", i); - asm_fprintf ("%wd%wi%wo%wu%wx%wX", ll, ll, ull, ull, ull, ull); - - /* Standard specifiers not accepted in asm_fprintf. */ - asm_fprintf ("%f\n", d); /* { dg-warning "format" "float" } */ - asm_fprintf ("%e\n", d); /* { dg-warning "format" "float" } */ - asm_fprintf ("%E\n", d); /* { dg-warning "format" "float" } */ - asm_fprintf ("%g\n", d); /* { dg-warning "format" "float" } */ - asm_fprintf ("%G\n", d); /* { dg-warning "format" "float" } */ - asm_fprintf ("%p\n", p); /* { dg-warning "format" "pointer" } */ - asm_fprintf ("%n\n", n); /* { dg-warning "format" "counter" } */ - asm_fprintf ("%hd\n", i); /* { dg-warning "format" "conversion" } */ - - /* Various tests of bad argument types. */ - asm_fprintf ("%d", l); /* { dg-warning "format" "bad argument types" } */ - asm_fprintf ("%wd", l); /* { dg-warning "format" "bad argument types" } */ - asm_fprintf ("%d", ll); /* { dg-warning "format" "bad argument types" } */ - asm_fprintf ("%*d\n", i1, i); /* { dg-warning "format" "bad * argument types" } */ - asm_fprintf ("%.*d\n", i2, i); /* { dg-warning "format" "bad * argument types" } */ - asm_fprintf ("%*.*ld\n", i1, i2, l); /* { dg-warning "format" "bad * argument types" } */ - asm_fprintf ("%ld", i); /* { dg-warning "format" "bad argument types" } */ - asm_fprintf ("%s", n); /* { dg-warning "format" "bad argument types" } */ - - /* Wrong number of arguments. */ - asm_fprintf ("%d%d", i); /* { dg-warning "matching" "wrong number of args" } */ - asm_fprintf ("%d", i, i); /* { dg-warning "arguments" "wrong number of args" } */ - /* Miscellaneous bogus constructions. */ - asm_fprintf (""); /* { dg-warning "zero-length" "warning for empty format" } */ - asm_fprintf ("\0"); /* { dg-warning "embedded" "warning for embedded NUL" } */ - asm_fprintf ("%d\0", i); /* { dg-warning "embedded" "warning for embedded NUL" } */ - asm_fprintf ("%d\0%d", i, i); /* { dg-warning "embedded|too many" "warning for embedded NUL" } */ - asm_fprintf (NULL); /* { dg-warning "null" "null format string warning" } */ - asm_fprintf ("%"); /* { dg-warning "trailing" "trailing % warning" } */ - asm_fprintf ("%++d", i); /* { dg-warning "repeated" "repeated flag warning" } */ - asm_fprintf ((const char *)L"foo"); /* { dg-warning "wide" "wide string" } */ - asm_fprintf ("%s", (char *)0); /* { dg-warning "null" "%s with NULL" } */ - - /* Make sure we still get warnings for regular printf. */ - printf ("%d\n", ll); /* { dg-warning "format" "bad argument types" } */ -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/asm_fprintf-2.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/asm_fprintf-2.c deleted file mode 100644 index 0cdd5abc7..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/asm_fprintf-2.c +++ /dev/null @@ -1,9 +0,0 @@ -/* Test for ICE handling internal formats: bug 20740. The code did - not check that, if the required typedef names had been used as - identifiers, they were defined to suitable types. Test - "__gcc_host_wide_int__", not used at all, asm_fprintf format. */ -/* Origin: Joseph Myers <joseph@codesourcery.com> */ -/* { dg-do compile } */ -/* { dg-options "-Wformat" } */ - -void bar (const char *, ...) __attribute__ ((__format__ (__asm_fprintf__, 1, 2))); /* { dg-error "'__gcc_host_wide_int__' is not defined as a type" } */ diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/asm_fprintf-3.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/asm_fprintf-3.c deleted file mode 100644 index c4cd39297..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/asm_fprintf-3.c +++ /dev/null @@ -1,10 +0,0 @@ -/* Test for ICE handling internal formats: bug 20740. The code did - not check that, if the required typedef names had been used as - identifiers, they were defined to suitable types. Test - "__gcc_host_wide_int__", not defined, asm_fprintf format. */ -/* Origin: Joseph Myers <joseph@codesourcery.com> */ -/* { dg-do compile } */ -/* { dg-options "-Wformat" } */ - -void foo (int __gcc_host_wide_int__); -void bar (const char *, ...) __attribute__ ((__format__ (__asm_fprintf__, 1, 2))); /* { dg-error "'__gcc_host_wide_int__' is not defined as a type" } */ diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/asm_fprintf-4.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/asm_fprintf-4.c deleted file mode 100644 index 111d1f275..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/asm_fprintf-4.c +++ /dev/null @@ -1,10 +0,0 @@ -/* Test for ICE handling internal formats: bug 20740. The code did - not check that, if the required typedef names had been used as - identifiers, they were defined to suitable types. Test - "__gcc_host_wide_int__", not a type, asm_fprintf. */ -/* Origin: Joseph Myers <joseph@codesourcery.com> */ -/* { dg-do compile } */ -/* { dg-options "-Wformat" } */ - -int __gcc_host_wide_int__; -void bar (const char *, ...) __attribute__ ((__format__ (__asm_fprintf__, 1, 2))); /* { dg-error "'__gcc_host_wide_int__' is not defined as a type" } */ diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/asm_fprintf-5.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/asm_fprintf-5.c deleted file mode 100644 index bb0e41c6d..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/asm_fprintf-5.c +++ /dev/null @@ -1,10 +0,0 @@ -/* Test for ICE handling internal formats: bug 20740. The code did - not check that, if the required typedef names had been used as - identifiers, they were defined to suitable types. Test - "__gcc_host_wide_int__", bad type, asm_fprintf format. */ -/* Origin: Joseph Myers <joseph@codesourcery.com> */ -/* { dg-do compile } */ -/* { dg-options "-Wformat" } */ - -typedef int __gcc_host_wide_int__; -void bar (const char *, ...) __attribute__ ((__format__ (__asm_fprintf__, 1, 2))); /* { dg-error "'__gcc_host_wide_int__' is not defined as 'long' or 'long long'" } */ diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/attr-1.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/attr-1.c deleted file mode 100644 index 8b2f5b7a3..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/attr-1.c +++ /dev/null @@ -1,10 +0,0 @@ -/* Test for strftime format attributes: can't have first_arg_num != 0. */ -/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ -/* { dg-do compile } */ -/* { dg-options "-std=gnu99 -Wformat" } */ - -#define DONT_GNU_PROTOTYPE -#include "format.h" - -extern void foo0 (const char *) __attribute__((__format__(gnu_attr___strftime__, 1, 0))); -extern void foo1 (const char *, ...) __attribute__((__format__(gnu_attr___strftime__, 1, 2))); /* { dg-error "cannot format" "strftime first_arg_num != 0" } */ diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/attr-2.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/attr-2.c deleted file mode 100644 index f560ed06b..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/attr-2.c +++ /dev/null @@ -1,68 +0,0 @@ -/* Test for format attributes: test use of __attribute__. */ -/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ -/* { dg-do compile } */ -/* { dg-options "-std=gnu99 -Wformat" } */ - -#define DONT_GNU_PROTOTYPE -#include "format.h" - -extern void tformatprintf (const char *, ...) __attribute__((format(gnu_attr_printf, 1, 2))); -extern void tformat__printf__ (const char *, ...) __attribute__((format(gnu_attr___printf__, 1, 2))); -extern void tformatscanf (const char *, ...) __attribute__((format(gnu_attr_scanf, 1, 2))); -extern void tformat__scanf__ (const char *, ...) __attribute__((format(gnu_attr___scanf__, 1, 2))); -extern void tformatstrftime (const char *) __attribute__((format(gnu_attr_strftime, 1, 0))); -extern void tformat__strftime__ (const char *) __attribute__((format(gnu_attr___strftime__, 1, 0))); -extern void tformatstrfmon (const char *, ...) __attribute__((format(strfmon, 1, 2))); -extern void tformat__strfmon__ (const char *, ...) __attribute__((format(__strfmon__, 1, 2))); -extern void t__format__printf (const char *, ...) __attribute__((__format__(gnu_attr_printf, 1, 2))); -extern void t__format____printf__ (const char *, ...) __attribute__((__format__(gnu_attr___printf__, 1, 2))); -extern void t__format__scanf (const char *, ...) __attribute__((__format__(gnu_attr_scanf, 1, 2))); -extern void t__format____scanf__ (const char *, ...) __attribute__((__format__(gnu_attr___scanf__, 1, 2))); -extern void t__format__strftime (const char *) __attribute__((__format__(gnu_attr_strftime, 1, 0))); -extern void t__format____strftime__ (const char *) __attribute__((__format__(gnu_attr___strftime__, 1, 0))); -extern void t__format__strfmon (const char *, ...) __attribute__((__format__(strfmon, 1, 2))); -extern void t__format____strfmon__ (const char *, ...) __attribute__((__format__(__strfmon__, 1, 2))); - -extern char *tformat_arg (const char *) __attribute__((format_arg(1))); -extern char *t__format_arg__ (const char *) __attribute__((__format_arg__(1))); - -void -foo (int i, int *ip, double d) -{ - tformatprintf ("%d", i); - tformatprintf ("%"); /* { dg-warning "format" "attribute format printf" } */ - tformat__printf__ ("%d", i); - tformat__printf__ ("%"); /* { dg-warning "format" "attribute format __printf__" } */ - tformatscanf ("%d", ip); - tformatscanf ("%"); /* { dg-warning "format" "attribute format scanf" } */ - tformat__scanf__ ("%d", ip); - tformat__scanf__ ("%"); /* { dg-warning "format" "attribute format __scanf__" } */ - tformatstrftime ("%a"); - tformatstrftime ("%"); /* { dg-warning "format" "attribute format strftime" } */ - tformat__strftime__ ("%a"); - tformat__strftime__ ("%"); /* { dg-warning "format" "attribute format __strftime__" } */ - tformatstrfmon ("%n", d); - tformatstrfmon ("%"); /* { dg-warning "format" "attribute format strfmon" } */ - tformat__strfmon__ ("%n", d); - tformat__strfmon__ ("%"); /* { dg-warning "format" "attribute format __strfmon__" } */ - t__format__printf ("%d", i); - t__format__printf ("%"); /* { dg-warning "format" "attribute __format__ printf" } */ - t__format____printf__ ("%d", i); - t__format____printf__ ("%"); /* { dg-warning "format" "attribute __format__ __printf__" } */ - t__format__scanf ("%d", ip); - t__format__scanf ("%"); /* { dg-warning "format" "attribute __format__ scanf" } */ - t__format____scanf__ ("%d", ip); - t__format____scanf__ ("%"); /* { dg-warning "format" "attribute __format__ __scanf__" } */ - t__format__strftime ("%a"); - t__format__strftime ("%"); /* { dg-warning "format" "attribute __format__ strftime" } */ - t__format____strftime__ ("%a"); - t__format____strftime__ ("%"); /* { dg-warning "format" "attribute __format__ __strftime__" } */ - t__format__strfmon ("%n", d); - t__format__strfmon ("%"); /* { dg-warning "format" "attribute __format__ strfmon" } */ - t__format____strfmon__ ("%n", d); - t__format____strfmon__ ("%"); /* { dg-warning "format" "attribute __format__ __strfmon__" } */ - tformatprintf (tformat_arg ("%d"), i); - tformatprintf (tformat_arg ("%")); /* { dg-warning "format" "attribute format_arg" } */ - tformatprintf (t__format_arg__ ("%d"), i); - tformatprintf (t__format_arg__ ("%")); /* { dg-warning "format" "attribute __format_arg__" } */ -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/attr-3.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/attr-3.c deleted file mode 100644 index bee5ff484..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/attr-3.c +++ /dev/null @@ -1,71 +0,0 @@ -/* Test for format attributes: test bad uses of __attribute__. */ -/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ -/* { dg-do compile } */ -/* { dg-options "-std=gnu99 -Wformat" } */ - -#define DONT_GNU_PROTOTYPE -#include "format.h" - -/* Proper uses of the attributes. */ -extern void fa0 (const char *, ...) __attribute__((format(gnu_attr_printf, 1, 2))); -extern void fa1 (char *, ...) __attribute__((format(gnu_attr_printf, 1, 2))); -extern char *fa2 (const char *) __attribute__((format_arg(1))); -extern char *fa3 (char *) __attribute__((format_arg(1))); - -/* Uses with too few or too many arguments. */ -extern void fb0 (const char *, ...) __attribute__((format)); /* { dg-error "wrong number of arguments" "bad format" } */ -extern void fb1 (const char *, ...) __attribute__((format())); /* { dg-error "wrong number of arguments" "bad format" } */ -extern void fb2 (const char *, ...) __attribute__((format(gnu_attr_printf))); /* { dg-error "wrong number of arguments" "bad format" } */ -extern void fb3 (const char *, ...) __attribute__((format(gnu_attr_printf, 1))); /* { dg-error "wrong number of arguments" "bad format" } */ -extern void fb4 (const char *, ...) __attribute__((format(gnu_attr_printf, 1, 2, 3))); /* { dg-error "wrong number of arguments" "bad format" } */ - -extern void fc1 (const char *) __attribute__((format_arg)); /* { dg-error "wrong number of arguments" "bad format_arg" } */ -extern void fc2 (const char *) __attribute__((format_arg())); /* { dg-error "wrong number of arguments" "bad format_arg" } */ -extern void fc3 (const char *) __attribute__((format_arg(1, 2))); /* { dg-error "wrong number of arguments" "bad format_arg" } */ - -/* These attributes presently only apply to declarations, not to types. - Eventually, they should be usable with declarators for function types - anywhere, but still not with structure/union/enum types. */ -struct s0 { int i; } __attribute__((format(gnu_attr_printf, 1, 2))); /* { dg-error "does not apply|only applies" "format on struct" } */ -union u0 { int i; } __attribute__((format(gnu_attr_printf, 1, 2))); /* { dg-error "does not apply|only applies" "format on union" } */ -enum e0 { E0V0 } __attribute__((format(gnu_attr_printf, 1, 2))); /* { dg-error "does not apply|only applies" "format on enum" } */ - -struct s1 { int i; } __attribute__((format_arg(1))); /* { dg-error "does not apply|only applies" "format_arg on struct" } */ -union u1 { int i; } __attribute__((format_arg(1))); /* { dg-error "does not apply|only applies" "format_arg on union" } */ -enum e1 { E1V0 } __attribute__((format_arg(1))); /* { dg-error "does not apply|only applies" "format_arg on enum" } */ - -/* The format type must be an identifier, one of those recognized. */ -extern void fe0 (const char *, ...) __attribute__((format(12345, 1, 2))); /* { dg-error "format specifier" "non-id format" } */ -extern void fe1 (const char *, ...) __attribute__((format(nosuch, 1, 2))); /* { dg-warning "format function type" "unknown format" } */ - -/* Both the numbers must be integer constant expressions. */ -extern void ff0 (const char *, ...) __attribute__((format(gnu_attr_printf, 3-2, (long long)(10/5)))); -int foo; -extern void ff1 (const char *, ...) __attribute__((format(gnu_attr_printf, foo, 10/5))); /* { dg-error "invalid operand" "bad number" } */ -extern void ff2 (const char *, ...) __attribute__((format(gnu_attr_printf, 3-2, foo))); /* { dg-error "invalid operand" "bad number" } */ -extern char *ff3 (const char *) __attribute__((format_arg(3-2))); -extern char *ff4 (const char *) __attribute__((format_arg(foo))); /* { dg-error "invalid operand" "bad format_arg number" } */ - -/* The format string argument must precede the arguments to be formatted. - This includes if no parameter types are specified (which is not valid ISO - C for variadic functions). */ -extern void fg0 () __attribute__((format(gnu_attr_printf, 1, 2))); -extern void fg1 () __attribute__((format(gnu_attr_printf, 1, 0))); -extern void fg2 () __attribute__((format(gnu_attr_printf, 1, 1))); /* { dg-error "follows" "bad number order" } */ -extern void fg3 () __attribute__((format(gnu_attr_printf, 2, 1))); /* { dg-error "follows" "bad number order" } */ - -/* The format string argument must be a string type, and the arguments to - be formatted must be the "...". */ -extern void fh0 (int, ...) __attribute__((format(gnu_attr_printf, 1, 2))); /* { dg-error "not a string" "format int string" } */ -extern void fh1 (signed char *, ...) __attribute__((format(gnu_attr_printf, 1, 2))); /* { dg-error "not a string" "signed char string" } */ -extern void fh2 (unsigned char *, ...) __attribute__((format(gnu_attr_printf, 1, 2))); /* { dg-error "not a string" "unsigned char string" } */ -extern void fh3 (const char *, ...) __attribute__((format(gnu_attr_printf, 1, 3))); /* { dg-error "is not" "not ..." } */ -extern void fh4 (const char *, int, ...) __attribute__((format(gnu_attr_printf, 1, 2))); /* { dg-error "is not" "not ..." } */ - -/* format_arg formats must take and return a string. */ -extern char *fi0 (int) __attribute__((format_arg(1))); /* { dg-error "not a string" "format_arg int string" } */ -extern char *fi1 (signed char *) __attribute__((format_arg(1))); /* { dg-error "not a string" "format_arg signed char string" } */ -extern char *fi2 (unsigned char *) __attribute__((format_arg(1))); /* { dg-error "not a string" "format_arg unsigned char string" } */ -extern int fi3 (const char *) __attribute__((format_arg(1))); /* { dg-error "not return string" "format_arg ret int string" } */ -extern signed char *fi4 (const char *) __attribute__((format_arg(1))); /* { dg-error "not return string" "format_arg ret signed char string" } */ -extern unsigned char *fi5 (const char *) __attribute__((format_arg(1))); /* { dg-error "not return string" "format_arg ret unsigned char string" } */ diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/attr-4.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/attr-4.c deleted file mode 100644 index caeed93a7..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/attr-4.c +++ /dev/null @@ -1,26 +0,0 @@ -/* Test for format attributes: test use of __attribute__ - in prefix attributes. */ -/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ -/* { dg-do compile } */ -/* { dg-options "-std=gnu99 -Wformat" } */ - -#define DONT_GNU_PROTOTYPE -#include "format.h" - -extern __attribute__((format(gnu_attr_printf, 1, 2))) void tformatprintf0 (const char *, ...); -extern void __attribute__((format(gnu_attr_printf, 1, 2))) tformatprintf1 (const char *, ...); -extern void foo (void), __attribute__((format(gnu_attr_printf, 1, 2))) tformatprintf2 (const char *, ...); -extern __attribute__((noreturn)) void bar (void), __attribute__((format(gnu_attr_printf, 1, 2))) tformatprintf3 (const char *, ...); - -void -baz (int i, int *ip, double d) -{ - tformatprintf0 ("%d", i); - tformatprintf0 ("%"); /* { dg-warning "format" "attribute format printf case 0" } */ - tformatprintf1 ("%d", i); - tformatprintf1 ("%"); /* { dg-warning "format" "attribute format printf case 1" } */ - tformatprintf2 ("%d", i); - tformatprintf2 ("%"); /* { dg-warning "format" "attribute format printf case 2" } */ - tformatprintf3 ("%d", i); - tformatprintf3 ("%"); /* { dg-warning "format" "attribute format printf case 3" } */ -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/attr-5.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/attr-5.c deleted file mode 100644 index 36b119896..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/attr-5.c +++ /dev/null @@ -1,28 +0,0 @@ -/* Test for format attributes: test default attributes are silently ignored - when a function is redeclared in an inappropriate manner. */ -/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ -/* { dg-do compile } */ -/* { dg-options "-std=gnu99 -Wformat" } */ - -/* We can't #include "format.h" here. */ - -/* This scanf declaration is static, so can't be the system function. */ -static int scanf(const char *restrict, ...); - -/* This sscanf declaration doesn't have variable arguments, so isn't - compatible with a format attribute. */ -extern int sscanf(const char *restrict, const char *restrict, int *); /* { dg-warning "conflict" "conflict" } */ - -void -foo (const char *s, int *p) -{ - scanf("%ld", p); /* { dg-bogus "format" "static" } */ - sscanf(s, "%ld", p); /* { dg-bogus "format" "wrong type" } */ -} - -/* Dummy definition of scanf. */ -static int -scanf (const char *restrict fmt, ...) -{ - return 0; -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/attr-6.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/attr-6.c deleted file mode 100644 index 0f683223d..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/attr-6.c +++ /dev/null @@ -1,22 +0,0 @@ -/* Test for format attributes: test default attributes are applied - to implicit declarations. */ -/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ -/* { dg-do compile } */ -/* { dg-options "-std=gnu89 -Wformat" } */ - -/* We can't #include "format.h" here. */ - -/* Technically, none of the format functions should be implicitly declared; - either the implicit type is wrong, the function has variable arguments - or it requires a type declared in a header. However, some bad programming - practice uses implicit declarations of some of these functions. - - Note that printf is not used in this test because of the declaration - of it as a built-in function. */ - -void -foo (const char *s, int *p) -{ - scanf("%ld", p); /* { dg-warning "format" "implicit scanf" } */ - /* { dg-warning "implicit" "implicit decl warning" { target *-*-* } 20 } */ -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/attr-7.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/attr-7.c deleted file mode 100644 index c37044819..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/attr-7.c +++ /dev/null @@ -1,35 +0,0 @@ -/* Test for format attributes: test applying them to types. */ -/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ -/* { dg-do compile } */ -/* { dg-options "-std=gnu99 -Wformat" } */ - -#define DONT_GNU_PROTOTYPE -#include "format.h" - -__attribute__((format(gnu_attr_printf, 1, 2))) void (*tformatprintf0) (const char *, ...); -void (*tformatprintf1) (const char *, ...) __attribute__((format(gnu_attr_printf, 1, 2))); -void (__attribute__((format(gnu_attr_printf, 1, 2))) *tformatprintf2) (const char *, ...); -void (__attribute__((format(gnu_attr_printf, 1, 2))) ****tformatprintf3) (const char *, ...); - -char * (__attribute__((format_arg(1))) *tformat_arg) (const char *); - -void -baz (int i) -{ - (*tformatprintf0) ("%d", i); - (*tformatprintf0) ((*tformat_arg) ("%d"), i); - (*tformatprintf0) ("%"); /* { dg-warning "format" "prefix" } */ - (*tformatprintf0) ((*tformat_arg) ("%")); /* { dg-warning "format" "prefix" } */ - (*tformatprintf1) ("%d", i); - (*tformatprintf1) ((*tformat_arg) ("%d"), i); - (*tformatprintf1) ("%"); /* { dg-warning "format" "postfix" } */ - (*tformatprintf1) ((*tformat_arg) ("%")); /* { dg-warning "format" "postfix" } */ - (*tformatprintf2) ("%d", i); - (*tformatprintf2) ((*tformat_arg) ("%d"), i); - (*tformatprintf2) ("%"); /* { dg-warning "format" "nested" } */ - (*tformatprintf2) ((*tformat_arg) ("%")); /* { dg-warning "format" "nested" } */ - (****tformatprintf3) ("%d", i); - (****tformatprintf3) ((*tformat_arg) ("%d"), i); - (****tformatprintf3) ("%"); /* { dg-warning "format" "nested 2" } */ - (****tformatprintf3) ((*tformat_arg) ("%")); /* { dg-warning "format" "nested 2" } */ -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/bitfld-1.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/bitfld-1.c deleted file mode 100644 index e828ad97c..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/bitfld-1.c +++ /dev/null @@ -1,51 +0,0 @@ -/* Test for printf formats and bit-fields: bug 22421. */ -/* Origin: Joseph Myers <joseph@codesourcery.com> */ -/* { dg-do compile } */ -/* { dg-options "-std=gnu99 -Wformat" } */ -/* { dg-require-effective-target int32plus } */ - -#include "format.h" - -struct s { - unsigned int u1 : 1; - signed int s1 : 1; - unsigned int u15 : 15; - signed int s15 : 15; - unsigned int u16 : 16; - signed int s16 : 16; - unsigned long u31 : 31; - signed long s31 : 31; - unsigned long u32 : 32; - signed long s32 : 32; - unsigned long long u48 : 48; -} x; - -void -foo (void) -{ - printf ("%d%u", x.u1, x.u1); - printf ("%d%u", x.s1, x.s1); - printf ("%d%u", x.u15, x.u15); - printf ("%d%u", x.s15, x.s15); - printf ("%d%u", x.u16, x.u16); - printf ("%d%u", x.s16, x.s16); -#if __INT_MAX__ > 32767 - /* If integers are 16 bits, there doesn't seem to be a way of - printing these without getting an error. */ - printf ("%d%u", x.u31, x.u31); - printf ("%d%u", x.s31, x.s31); -#endif -#if __LONG_MAX__ > 2147483647 && __INT_MAX__ >= 2147483647 - /* If long is wider than 32 bits, the 32-bit bit-fields are int or - unsigned int or promote to those types. Otherwise, long is 32 - bits and the bit-fields are of type plain long or unsigned - long. */ - printf ("%d%u", x.u32, x.u32); - printf ("%d%u", x.s32, x.s32); -#else - printf ("%ld%lu", x.u32, x.u32); - printf ("%ld%lu", x.s32, x.s32); -#endif - printf ("%llu", x.u48); /* { dg-warning "has type '.*unsigned int:48'" } */ - printf ("%llu", (unsigned long long)x.u48); -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/branch-1.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/branch-1.c deleted file mode 100644 index cdff92762..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/branch-1.c +++ /dev/null @@ -1,27 +0,0 @@ -/* Test for format checking of conditional expressions. */ -/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ -/* { dg-do compile } */ -/* { dg-options "-std=gnu99 -Wformat" } */ - -#include "format.h" - -void -foo (long l, int nfoo) -{ - printf ((nfoo > 1) ? "%d foos" : "%d foo", nfoo); - printf ((l > 1) ? "%d foos" : "%d foo", l); /* { dg-warning "int" "wrong type in conditional expr" } */ - printf ((l > 1) ? "%ld foos" : "%d foo", l); /* { dg-warning "int" "wrong type in conditional expr" } */ - printf ((l > 1) ? "%d foos" : "%ld foo", l); /* { dg-warning "int" "wrong type in conditional expr" } */ - /* Should allow one case to have extra arguments. */ - printf ((nfoo > 1) ? "%d foos" : "1 foo", nfoo); - printf ((nfoo > 1) ? "many foos" : "1 foo", nfoo); /* { dg-warning "too many" "too many args in all branches" } */ - printf ((nfoo > 1) ? "%d foos" : "", nfoo); - printf ((nfoo > 1) ? "%d foos" : ((nfoo > 0) ? "1 foo" : "no foos"), nfoo); - printf ((nfoo > 1) ? "%d foos" : ((nfoo > 0) ? "%d foo" : "%d foos"), nfoo); - printf ((nfoo > 1) ? "%d foos" : ((nfoo > 0) ? "%d foo" : "%ld foos"), nfoo); /* { dg-warning "long int" "wrong type" } */ - printf ((nfoo > 1) ? "%ld foos" : ((nfoo > 0) ? "%d foo" : "%d foos"), nfoo); /* { dg-warning "long int" "wrong type" } */ - printf ((nfoo > 1) ? "%d foos" : ((nfoo > 0) ? "%ld foo" : "%d foos"), nfoo); /* { dg-warning "long int" "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 *-*-* } 25 } */ -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/builtin-1.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/builtin-1.c deleted file mode 100644 index ba1cab647..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/builtin-1.c +++ /dev/null @@ -1,22 +0,0 @@ -/* Test for format extensions. Test that the __builtin functions get their - default attributes even with -ffreestanding. -*/ -/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ -/* { dg-do compile } */ -/* { dg-options "-std=gnu99 -Wformat -ffreestanding" } */ - -#include "format.h" - -void -foo (int i) -{ - __builtin_fprintf (stdout, "%d", i); - __builtin_fprintf (stdout, "%ld", i); /* { dg-warning "format" "__builtin_fprintf" } */ - __builtin_printf ("%d", i); - __builtin_printf ("%ld", i); /* { dg-warning "format" "__builtin_printf" } */ - - __builtin_fprintf_unlocked (stdout, "%d", i); - __builtin_fprintf_unlocked (stdout, "%ld", i); /* { dg-warning "format" "__builtin_fprintf_unlocked" } */ - __builtin_printf_unlocked ("%d", i); - __builtin_printf_unlocked ("%ld", i); /* { dg-warning "format" "__builtin_printf_unlocked" } */ -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/c90-printf-1.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/c90-printf-1.c deleted file mode 100644 index 586e4af6a..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/c90-printf-1.c +++ /dev/null @@ -1,237 +0,0 @@ -/* Test for printf formats. Formats using C90 features, including cases - where C90 specifies some aspect of the format to be ignored or where - the behavior is undefined. -*/ -/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ -/* { dg-do compile } */ -/* { dg-options "-std=iso9899:1990 -pedantic -Wformat" } */ - -#include "format.h" - -void -foo (int i, int i1, int i2, unsigned int u, double d, char *s, void *p, - int *n, short int *hn, long int l, unsigned long int ul, - long int *ln, long double ld, wint_t lc, wchar_t *ls, llong ll, - ullong ull, unsigned int *un, const int *cn, signed char *ss, - unsigned char *us, const signed char *css, unsigned int u1, - unsigned int u2) -{ - /* See ISO/IEC 9899:1990 (E) subclause 7.9.6.1 (pages 131-134). */ - /* Basic sanity checks for the different components of a format. */ - printf ("%d\n", i); - printf ("%+d\n", i); - printf ("%3d\n", i); - printf ("%-3d\n", i); - printf ("%.7d\n", i); - printf ("%+9.4d\n", i); - printf ("%.3ld\n", l); - printf ("%*d\n", i1, i); - printf ("%.*d\n", i2, i); - printf ("%*.*ld\n", i1, i2, l); - printf ("%d %lu\n", i, ul); - /* GCC has objected to the next one in the past, but it is a valid way - of specifying zero precision. - */ - printf ("%.e\n", d); /* { dg-bogus "precision" "bogus precision warning" } */ - /* Bogus use of width. */ - printf ("%5n\n", n); /* { dg-warning "width" "width with %n" } */ - /* Erroneous, ignored or pointless constructs with precision. */ - /* Whether negative values for precision may be included in the format - string is not entirely clear; presume not, following Clive Feather's - proposed resolution to DR#220 against C99. In any case, such a - construct should be warned about. - */ - printf ("%.-5d\n", i); /* { dg-warning "format|precision" "negative precision warning" } */ - printf ("%.-*d\n", i); /* { dg-warning "format" "broken %.-*d format" } */ - printf ("%.3c\n", i); /* { dg-warning "precision" "precision with %c" } */ - printf ("%.3p\n", p); /* { dg-warning "precision" "precision with %p" } */ - printf ("%.3n\n", n); /* { dg-warning "precision" "precision with %n" } */ - /* Valid and invalid %% constructions. Some of the warning messages - are non-optimal, but they do detect the errorneous nature of the - format string. - */ - printf ("%%"); - printf ("%.3%"); /* { dg-warning "format" "bogus %%" } */ - printf ("%-%"); /* { dg-warning "format" "bogus %%" } */ - printf ("%-%\n"); /* { dg-warning "format" "bogus %%" } */ - printf ("%5%\n"); /* { dg-warning "format" "bogus %%" } */ - printf ("%h%\n"); /* { dg-warning "format" "bogus %%" } */ - /* Valid and invalid %h, %l, %L constructions. */ - printf ("%hd", i); - printf ("%hi", i); - /* Strictly, these parameters should be int or unsigned int according to - what unsigned short promotes to. However, GCC ignores sign - differences in format checking here, and this is relied on to get the - correct checking without print_char_table needing to know whether - int and short are the same size. - */ - printf ("%ho%hu%hx%hX", u, u, u, u); - printf ("%hn", hn); - printf ("%hf", d); /* { dg-warning "length" "bad use of %h" } */ - printf ("%he", d); /* { dg-warning "length" "bad use of %h" } */ - printf ("%hE", d); /* { dg-warning "length" "bad use of %h" } */ - printf ("%hg", d); /* { dg-warning "length" "bad use of %h" } */ - printf ("%hG", d); /* { dg-warning "length" "bad use of %h" } */ - printf ("%hc", i); /* { dg-warning "length" "bad use of %h" } */ - printf ("%hs", s); /* { dg-warning "length" "bad use of %h" } */ - printf ("%hp", p); /* { dg-warning "length" "bad use of %h" } */ - printf ("%h"); /* { dg-warning "conversion lacks type" "bare %h" } */ - printf ("%h."); /* { dg-warning "conversion" "bogus %h." } */ - printf ("%ld%li%lo%lu%lx%lX", l, l, ul, ul, ul, ul); - printf ("%ln", ln); - printf ("%lf", d); /* { dg-warning "length|C" "bad use of %l" } */ - printf ("%le", d); /* { dg-warning "length|C" "bad use of %l" } */ - printf ("%lE", d); /* { dg-warning "length|C" "bad use of %l" } */ - printf ("%lg", d); /* { dg-warning "length|C" "bad use of %l" } */ - printf ("%lG", d); /* { dg-warning "length|C" "bad use of %l" } */ - printf ("%lp", p); /* { dg-warning "length|C" "bad use of %l" } */ - /* These next two were added in C94, but should be objected to in C90. - For the first one, GCC has wanted wchar_t instead of the correct C94 - and C99 wint_t. - */ - printf ("%lc", lc); /* { dg-warning "length|C" "C90 bad use of %l" } */ - printf ("%ls", ls); /* { dg-warning "length|C" "C90 bad use of %l" } */ - /* These uses of %L are legitimate, though GCC has wrongly warned for - them in the past. - */ - printf ("%Le%LE%Lf%Lg%LG", ld, ld, ld, ld, ld); - /* These next six are accepted by GCC as referring to long long, - but -pedantic correctly warns. - */ - printf ("%Ld", ll); /* { dg-warning "does not support" "bad use of %L" } */ - printf ("%Li", ll); /* { dg-warning "does not support" "bad use of %L" } */ - printf ("%Lo", ull); /* { dg-warning "does not support" "bad use of %L" } */ - printf ("%Lu", ull); /* { dg-warning "does not support" "bad use of %L" } */ - printf ("%Lx", ull); /* { dg-warning "does not support" "bad use of %L" } */ - printf ("%LX", ull); /* { dg-warning "does not support" "bad use of %L" } */ - printf ("%Lc", i); /* { dg-warning "length" "bad use of %L" } */ - printf ("%Ls", s); /* { dg-warning "length" "bad use of %L" } */ - printf ("%Lp", p); /* { dg-warning "length" "bad use of %L" } */ - printf ("%Ln", n); /* { dg-warning "length" "bad use of %L" } */ - /* Valid uses of each bare conversion. */ - printf ("%d%i%o%u%x%X%f%e%E%g%G%c%s%p%n%%", i, i, u, u, u, u, d, d, d, d, d, - i, s, p, n); - /* Uses of the - flag (valid on all non-%, non-n conversions). */ - printf ("%-d%-i%-o%-u%-x%-X%-f%-e%-E%-g%-G%-c%-s%-p", i, i, u, u, u, u, - d, d, d, d, d, i, s, p); - printf ("%-n", n); /* { dg-warning "flag" "bad use of %-n" } */ - /* Uses of the + flag (valid on signed conversions only). */ - printf ("%+d%+i%+f%+e%+E%+g%+G\n", i, i, d, d, d, d, d); - printf ("%+o", u); /* { dg-warning "flag" "bad use of + flag" } */ - printf ("%+u", u); /* { dg-warning "flag" "bad use of + flag" } */ - printf ("%+x", u); /* { dg-warning "flag" "bad use of + flag" } */ - printf ("%+X", u); /* { dg-warning "flag" "bad use of + flag" } */ - printf ("%+c", i); /* { dg-warning "flag" "bad use of + flag" } */ - printf ("%+s", s); /* { dg-warning "flag" "bad use of + flag" } */ - printf ("%+p", p); /* { dg-warning "flag" "bad use of + flag" } */ - printf ("%+n", n); /* { dg-warning "flag" "bad use of + flag" } */ - /* Uses of the space flag (valid on signed conversions only, and ignored - with +). - */ - printf ("% +d", i); /* { dg-warning "use of both|ignored" "use of space and + flags" } */ - printf ("%+ d", i); /* { dg-warning "use of both|ignored" "use of space and + flags" } */ - printf ("% d% i% f% e% E% g% G\n", i, i, d, d, d, d, d); - printf ("% o", u); /* { dg-warning "flag" "bad use of space flag" } */ - printf ("% u", u); /* { dg-warning "flag" "bad use of space flag" } */ - printf ("% x", u); /* { dg-warning "flag" "bad use of space flag" } */ - printf ("% X", u); /* { dg-warning "flag" "bad use of space flag" } */ - printf ("% c", i); /* { dg-warning "flag" "bad use of space flag" } */ - printf ("% s", s); /* { dg-warning "flag" "bad use of space flag" } */ - printf ("% p", p); /* { dg-warning "flag" "bad use of space flag" } */ - printf ("% n", n); /* { dg-warning "flag" "bad use of space flag" } */ - /* Uses of the # flag. */ - printf ("%#o%#x%#X%#e%#E%#f%#g%#G", u, u, u, d, d, d, d, d); - printf ("%#d", i); /* { dg-warning "flag" "bad use of # flag" } */ - printf ("%#i", i); /* { dg-warning "flag" "bad use of # flag" } */ - printf ("%#u", u); /* { dg-warning "flag" "bad use of # flag" } */ - printf ("%#c", i); /* { dg-warning "flag" "bad use of # flag" } */ - printf ("%#s", s); /* { dg-warning "flag" "bad use of # flag" } */ - printf ("%#p", p); /* { dg-warning "flag" "bad use of # flag" } */ - printf ("%#n", n); /* { dg-warning "flag" "bad use of # flag" } */ - /* Uses of the 0 flag. */ - printf ("%08d%08i%08o%08u%08x%08X%08e%08E%08f%08g%08G", i, i, u, u, u, u, - d, d, d, d, d); - printf ("%0c", i); /* { dg-warning "flag" "bad use of 0 flag" } */ - printf ("%0s", s); /* { dg-warning "flag" "bad use of 0 flag" } */ - printf ("%0p", p); /* { dg-warning "flag" "bad use of 0 flag" } */ - printf ("%0n", n); /* { dg-warning "flag" "bad use of 0 flag" } */ - /* 0 flag ignored with precision for certain types, not others. */ - printf ("%08.5d", i); /* { dg-warning "ignored" "0 flag ignored with precision" } */ - printf ("%08.5i", i); /* { dg-warning "ignored" "0 flag ignored with precision" } */ - printf ("%08.5o", u); /* { dg-warning "ignored" "0 flag ignored with precision" } */ - printf ("%08.5u", u); /* { dg-warning "ignored" "0 flag ignored with precision" } */ - printf ("%08.5x", u); /* { dg-warning "ignored" "0 flag ignored with precision" } */ - printf ("%08.5X", u); /* { dg-warning "ignored" "0 flag ignored with precision" } */ - printf ("%08.5f%08.5e%08.5E%08.5g%08.5G", d, d, d, d, d); - /* 0 flag ignored with - flag. */ - printf ("%-08d", i); /* { dg-warning "flags|ignored" "0 flag ignored with - flag" } */ - printf ("%-08i", i); /* { dg-warning "flags|ignored" "0 flag ignored with - flag" } */ - printf ("%-08o", u); /* { dg-warning "flags|ignored" "0 flag ignored with - flag" } */ - printf ("%-08u", u); /* { dg-warning "flags|ignored" "0 flag ignored with - flag" } */ - printf ("%-08x", u); /* { dg-warning "flags|ignored" "0 flag ignored with - flag" } */ - printf ("%-08X", u); /* { dg-warning "flags|ignored" "0 flag ignored with - flag" } */ - printf ("%-08e", d); /* { dg-warning "flags|ignored" "0 flag ignored with - flag" } */ - printf ("%-08E", d); /* { dg-warning "flags|ignored" "0 flag ignored with - flag" } */ - printf ("%-08f", d); /* { dg-warning "flags|ignored" "0 flag ignored with - flag" } */ - printf ("%-08g", d); /* { dg-warning "flags|ignored" "0 flag ignored with - flag" } */ - printf ("%-08G", d); /* { dg-warning "flags|ignored" "0 flag ignored with - flag" } */ - /* Various tests of bad argument types. */ - printf ("%d", l); /* { dg-warning "format" "bad argument types" } */ - printf ("%*.*d", l, i2, i); /* { dg-warning "field" "bad * argument types" } */ - printf ("%*.*d", i1, l, i); /* { dg-warning "field" "bad * argument types" } */ - printf ("%ld", i); /* { dg-warning "format" "bad argument types" } */ - printf ("%s", n); /* { dg-warning "format" "bad argument types" } */ - printf ("%p", i); /* { dg-warning "format" "bad argument types" } */ - printf ("%n", p); /* { dg-warning "format" "bad argument types" } */ - /* With -pedantic, we want some further checks for pointer targets: - %p should allow only pointers to void (possibly qualified) and - to character types (possibly qualified), but not function pointers - or pointers to other types. (Whether, in fact, character types are - allowed here is unclear; see thread on comp.std.c, July 2000 for - discussion of the requirements of rules on identical representation, - and of the application of the as if rule with the new va_arg - allowances in C99 to printf.) Likewise, we should warn if - pointer targets differ in signedness, except in some circumstances - for character pointers. (In C99 we should consider warning for - char * or unsigned char * being passed to %hhn, even if strictly - legitimate by the standard.) - */ - printf ("%p", foo); /* { dg-warning "format" "bad argument types" } */ - printf ("%n", un); /* { dg-warning "format" "bad argument types" } */ - printf ("%p", n); /* { dg-warning "format" "bad argument types" } */ - /* Allow character pointers with %p. */ - printf ("%p%p%p%p", s, ss, us, css); - /* %s allows any character type. */ - printf ("%s%s%s%s", s, ss, us, css); - /* Warning for void * arguments for %s is GCC's historical behavior, - and seems useful to keep, even if some standard versions might be - read to permit it. - */ - printf ("%s", p); /* { dg-warning "format" "bad argument types" } */ - /* The historical behavior is to allow signed / unsigned types - interchangably as arguments. For values representable in both types, - such usage may be correct. For now preserve the behavior of GCC - in such cases. - */ - printf ("%d", u); - /* Also allow the same for width and precision arguments. In the past, - GCC has been inconsistent and allowed unsigned for width but not - precision. - */ - printf ("%*.*d", u1, u2, i); - /* Wrong number of arguments. */ - printf ("%d%d", i); /* { dg-warning "matching" "wrong number of args" } */ - printf ("%d", i, i); /* { dg-warning "arguments" "wrong number of args" } */ - /* Miscellaneous bogus constructions. */ - printf (""); /* { dg-warning "zero-length" "warning for empty format" } */ - printf ("\0"); /* { dg-warning "embedded" "warning for embedded NUL" } */ - printf ("%d\0", i); /* { dg-warning "embedded" "warning for embedded NUL" } */ - printf ("%d\0%d", i, i); /* { dg-warning "embedded|too many" "warning for embedded NUL" } */ - printf (NULL); /* { dg-warning "null" "null format string warning" } */ - printf ("%"); /* { dg-warning "trailing" "trailing % warning" } */ - printf ("%++d", i); /* { dg-warning "repeated" "repeated flag warning" } */ - printf ("%n", cn); /* { dg-warning "constant" "%n with const" } */ - printf ((const char *)L"foo"); /* { dg-warning "wide" "wide string" } */ - printf ("%n", (int *)0); /* { dg-warning "null" "%n with NULL" } */ - printf ("%s", (char *)0); /* { dg-warning "null" "%s with NULL" } */ -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/c90-printf-2.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/c90-printf-2.c deleted file mode 100644 index b9da764b6..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/c90-printf-2.c +++ /dev/null @@ -1,24 +0,0 @@ -/* Test for printf formats. Formats using C99 features should be rejected - outside of C99 mode. -*/ -/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ -/* { dg-do compile } */ -/* { dg-options "-std=iso9899:1990 -pedantic -Wformat" } */ - -#include "format.h" - -void -foo (int i, double d, llong ll, intmax_t j, size_t z, ptrdiff_t t) -{ - /* Some tests already in c90-printf-1.c, e.g. %lf. */ - /* The widths hh, ll, j, z, t are new. */ - printf ("%hhd", i); /* { dg-warning "length|C" "%hh in C90" } */ - printf ("%lld", ll); /* { dg-warning "length|C" "%ll in C90" } */ - printf ("%jd", j); /* { dg-warning "length|C" "%j in C90" } */ - printf ("%zu", z); /* { dg-warning "length|C" "%z in C90" } */ - printf ("%td", t); /* { dg-warning "length|C" "%t in C90" } */ - /* The formats F, a, A are new. */ - printf ("%F", d); /* { dg-warning "C" "%F in C90" } */ - printf ("%a", d); /* { dg-warning "C" "%a in C90" } */ - printf ("%A", d); /* { dg-warning "C" "%A in C90" } */ -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/c90-printf-3.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/c90-printf-3.c deleted file mode 100644 index bf48f3114..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/c90-printf-3.c +++ /dev/null @@ -1,42 +0,0 @@ -/* Test for printf formats. Test that the C90 functions get their default - attributes in strict C90 mode, but the C99 and gettext functions - do not. -*/ -/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ -/* { dg-do compile { target { ! *-*-mingw* } } } */ -/* { dg-options "-std=iso9899:1990 -pedantic -Wformat" } */ - -#include "format.h" - -void -foo (int i, char *s, size_t n, va_list v0, va_list v1, va_list v2, va_list v3, - va_list v4, va_list v5, va_list v6, va_list v7, va_list v8) -{ - fprintf (stdout, "%d", i); - fprintf (stdout, "%ld", i); /* { dg-warning "format" "fprintf" } */ - printf ("%d", i); - printf ("%ld", i); /* { dg-warning "format" "printf" } */ - /* The "unlocked" functions shouldn't warn in c90 mode. */ - fprintf_unlocked (stdout, "%ld", i); /* { dg-bogus "format" "fprintf_unlocked" } */ - printf_unlocked ("%ld", i); /* { dg-bogus "format" "printf_unlocked" } */ - sprintf (s, "%d", i); - sprintf (s, "%ld", i); /* { dg-warning "format" "sprintf" } */ - vfprintf (stdout, "%d", v0); - vfprintf (stdout, "%Y", v1); /* { dg-warning "format" "vfprintf" } */ - vprintf ("%d", v2); - vprintf ("%Y", v3); /* { dg-warning "format" "vprintf" } */ - /* The following used to give a bogus warning. */ - vprintf ("%*.*d", v8); - vsprintf (s, "%d", v4); - vsprintf (s, "%Y", v5); /* { dg-warning "format" "vsprintf" } */ - snprintf (s, n, "%d", i); - snprintf (s, n, "%ld", i); - vsnprintf (s, n, "%d", v6); - vsnprintf (s, n, "%Y", v7); - printf (gettext ("%d"), i); - printf (gettext ("%ld"), i); - printf (dgettext ("", "%d"), i); - printf (dgettext ("", "%ld"), i); - printf (dcgettext ("", "%d", 0), i); - printf (dcgettext ("", "%ld", 0), i); -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/c90-scanf-1.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/c90-scanf-1.c deleted file mode 100644 index e4803f1f4..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/c90-scanf-1.c +++ /dev/null @@ -1,119 +0,0 @@ -/* Test for scanf formats. Formats using C90 features, including cases - where C90 specifies some aspect of the format to be ignored or where - the behavior is undefined. -*/ -/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ -/* { dg-do compile } */ -/* { dg-options "-std=iso9899:1990 -pedantic -Wformat" } */ - -#include "format.h" - -void -foo (int *ip, unsigned int *uip, short int *hp, unsigned short int *uhp, - long int *lp, unsigned long int *ulp, float *fp, double *dp, - long double *ldp, char *s, signed char *ss, unsigned char *us, - void **pp, int *n, llong *llp, ullong *ullp, wchar_t *ls, - const int *cip, const int *cn, const char *cs, const void **ppc, - void *const *pcp, short int *hn, long int *ln, void *p, char **sp, - volatile void *ppv) -{ - /* See ISO/IEC 9899:1990 (E) subclause 7.9.6.2 (pages 134-138). */ - /* Basic sanity checks for the different components of a format. */ - scanf ("%d", ip); - scanf ("%*d"); - scanf ("%3d", ip); - scanf ("%hd", hp); - scanf ("%3ld", lp); - scanf ("%*3d"); - scanf ("%d %ld", ip, lp); - /* Valid and invalid %% constructions. */ - scanf ("%%"); - scanf ("%*%"); /* { dg-warning "format" "bogus %%" } */ - scanf ("%*%\n"); /* { dg-warning "format" "bogus %%" } */ - scanf ("%4%"); /* { dg-warning "format" "bogus %%" } */ - scanf ("%4%\n"); /* { dg-warning "format" "bogus %%" } */ - scanf ("%h%"); /* { dg-warning "format" "bogus %%" } */ - scanf ("%h%\n"); /* { dg-warning "format" "bogus %%" } */ - /* Valid, invalid and silly assignment-suppression constructions. */ - scanf ("%*d%*i%*o%*u%*x%*X%*e%*E%*f%*g%*G%*s%*[abc]%*c%*p"); - scanf ("%*2d%*8s%*3c"); - scanf ("%*n", n); /* { dg-warning "suppress" "suppression of %n" } */ - scanf ("%*hd"); /* { dg-warning "together" "suppression with length" } */ - /* Valid, invalid and silly width constructions. */ - scanf ("%2d%3i%4o%5u%6x%7X%8e%9E%10f%11g%12G%13s%14[abc]%15c%16p", - ip, ip, uip, uip, uip, uip, fp, fp, fp, fp, fp, s, s, s, pp); - scanf ("%0d", ip); /* { dg-warning "width" "warning for zero width" } */ - scanf ("%3n", n); /* { dg-warning "width" "width with %n" } */ - /* Valid and invalid %h, %l, %L constructions. */ - scanf ("%hd%hi%ho%hu%hx%hX%hn", hp, hp, uhp, uhp, uhp, uhp, hn); - scanf ("%he", fp); /* { dg-warning "length" "bad use of %h" } */ - scanf ("%hE", fp); /* { dg-warning "length" "bad use of %h" } */ - scanf ("%hf", fp); /* { dg-warning "length" "bad use of %h" } */ - scanf ("%hg", fp); /* { dg-warning "length" "bad use of %h" } */ - scanf ("%hG", fp); /* { dg-warning "length" "bad use of %h" } */ - scanf ("%hs", s); /* { dg-warning "length" "bad use of %h" } */ - scanf ("%h[ac]", s); /* { dg-warning "length" "bad use of %h" } */ - scanf ("%hc", s); /* { dg-warning "length" "bad use of %h" } */ - scanf ("%hp", pp); /* { dg-warning "length" "bad use of %h" } */ - scanf ("%h"); /* { dg-warning "conversion lacks type" "bare %h" } */ - scanf ("%h."); /* { dg-warning "conversion" "bogus %h" } */ - scanf ("%ld%li%lo%lu%lx%lX%ln", lp, lp, ulp, ulp, ulp, ulp, ln); - scanf ("%le%lE%lf%lg%lG", dp, dp, dp, dp, dp); - scanf ("%lp", pp); /* { dg-warning "length" "bad use of %l" } */ - /* These next three formats were added in C94. */ - scanf ("%ls", ls); /* { dg-warning "length|C" "bad use of %l" } */ - scanf ("%l[ac]", ls); /* { dg-warning "length|C" "bad use of %l" } */ - scanf ("%lc", ls); /* { dg-warning "length|C" "bad use of %l" } */ - scanf ("%Le%LE%Lf%Lg%LG", ldp, ldp, ldp, ldp, ldp); - scanf ("%Ld", llp); /* { dg-warning "does not support" "bad use of %L" } */ - scanf ("%Li", llp); /* { dg-warning "does not support" "bad use of %L" } */ - scanf ("%Lo", ullp); /* { dg-warning "does not support" "bad use of %L" } */ - scanf ("%Lu", ullp); /* { dg-warning "does not support" "bad use of %L" } */ - scanf ("%Lx", ullp); /* { dg-warning "does not support" "bad use of %L" } */ - scanf ("%LX", ullp); /* { dg-warning "does not support" "bad use of %L" } */ - scanf ("%Ls", s); /* { dg-warning "length" "bad use of %L" } */ - scanf ("%L[ac]", s); /* { dg-warning "length" "bad use of %L" } */ - scanf ("%Lc", s); /* { dg-warning "length" "bad use of %L" } */ - scanf ("%Lp", pp); /* { dg-warning "length" "bad use of %L" } */ - scanf ("%Ln", n); /* { dg-warning "length" "bad use of %L" } */ - /* Valid uses of each bare conversion. */ - scanf ("%d%i%o%u%x%X%e%E%f%g%G%s%[abc]%c%p%n%%", ip, ip, uip, uip, uip, - uip, fp, fp, fp, fp, fp, s, s, s, pp, n); - /* Allow other character pointers with %s, %c, %[]. */ - scanf ("%2s%3s%4c%5c%6[abc]%7[abc]", ss, us, ss, us, ss, us); - /* Further tests for %[]. */ - scanf ("%[%d]%d", s, ip); - scanf ("%[^%d]%d", s, ip); - scanf ("%[]%d]%d", s, ip); - scanf ("%[^]%d]%d", s, ip); - scanf ("%[%d]%d", s, ip); - scanf ("%[]abcd", s); /* { dg-warning "no closing" "incomplete scanset" } */ - /* Various tests of bad argument types. Some of these are only pedantic - warnings. - */ - scanf ("%d", lp); /* { dg-warning "format" "bad argument types" } */ - scanf ("%d", uip); /* { dg-warning "format" "bad argument types" } */ - scanf ("%d", pp); /* { dg-warning "format" "bad argument types" } */ - scanf ("%p", ppc); /* { dg-warning "format" "bad argument types" } */ - scanf ("%p", ppv); /* { dg-warning "format" "bad argument types" } */ - scanf ("%s", n); /* { dg-warning "format" "bad argument types" } */ - scanf ("%s", p); /* { dg-warning "format" "bad argument types" } */ - scanf ("%p", p); /* { dg-warning "format" "bad argument types" } */ - scanf ("%p", sp); /* { dg-warning "format" "bad argument types" } */ - /* Tests for writing into constant values. */ - scanf ("%d", cip); /* { dg-warning "constant" "%d writing into const" } */ - scanf ("%n", cn); /* { dg-warning "constant" "%n writing into const" } */ - scanf ("%s", cs); /* { dg-warning "constant" "%s writing into const" } */ - scanf ("%p", pcp); /* { dg-warning "constant" "%p writing into const" } */ - /* Wrong number of arguments. */ - scanf ("%d%d", ip); /* { dg-warning "matching" "wrong number of args" } */ - scanf ("%d", ip, ip); /* { dg-warning "arguments" "wrong number of args" } */ - /* Miscellaneous bogus constructions. */ - scanf (""); /* { dg-warning "zero-length" "warning for empty format" } */ - scanf ("\0"); /* { dg-warning "embedded" "warning for embedded NUL" } */ - scanf ("%d\0", ip); /* { dg-warning "embedded" "warning for embedded NUL" } */ - scanf ("%d\0%d", ip, ip); /* { dg-warning "embedded|too many" "warning for embedded NUL" } */ - scanf (NULL); /* { dg-warning "null" "null format string warning" } */ - scanf ("%"); /* { dg-warning "trailing" "trailing % warning" } */ - scanf ("%d", (int *)0); /* { dg-warning "null" "writing into NULL" } */ -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/c90-scanf-2.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/c90-scanf-2.c deleted file mode 100644 index 52c08921e..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/c90-scanf-2.c +++ /dev/null @@ -1,25 +0,0 @@ -/* Test for scanf formats. Formats using C99 features should be rejected - outside of C99 mode. -*/ -/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ -/* { dg-do compile } */ -/* { dg-options "-std=iso9899:1990 -pedantic -Wformat" } */ - -#include "format.h" - -void -foo (signed char *hhp, float *fp, llong *llp, intmax_t *jp, - size_t *zp, ptrdiff_t *tp) -{ - /* Some tests already in c90-scanf-1.c. */ - /* The widths hh, ll, j, z, t are new. */ - scanf ("%hhd", hhp); /* { dg-warning "length|C" "%hh in C90" } */ - scanf ("%lld", llp); /* { dg-warning "length|C" "%ll in C90" } */ - scanf ("%jd", jp); /* { dg-warning "length|C" "%j in C90" } */ - scanf ("%zu", zp); /* { dg-warning "length|C" "%z in C90" } */ - scanf ("%td", tp); /* { dg-warning "length|C" "%t in C90" } */ - /* The formats F, a, A are new. */ - scanf ("%F", fp); /* { dg-warning "C" "%F in C90" } */ - scanf ("%a", fp); /* { dg-warning "C" "%a in C90" } */ - scanf ("%A", fp); /* { dg-warning "C" "%A in C90" } */ -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/c90-scanf-3.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/c90-scanf-3.c deleted file mode 100644 index 557070782..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/c90-scanf-3.c +++ /dev/null @@ -1,19 +0,0 @@ -/* Test for scanf formats. Formats using extensions to the standard - should be rejected in strict pedantic mode. -*/ -/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ -/* { dg-do compile } */ -/* { dg-options "-std=iso9899:1990 -pedantic -Wformat" } */ - -#include "format.h" - -void -foo (char **sp, wchar_t **lsp) -{ - /* %a formats for allocation, only recognized in C90 mode, are a - GNU extension. - */ - scanf ("%as", sp); /* { dg-warning "C" "%as" } */ - scanf ("%aS", lsp); /* { dg-warning "C" "%aS" } */ - scanf ("%a[bcd]", sp); /* { dg-warning "C" "%a[]" } */ -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/c90-scanf-4.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/c90-scanf-4.c deleted file mode 100644 index 0a47f3f35..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/c90-scanf-4.c +++ /dev/null @@ -1,33 +0,0 @@ -/* Test for scanf formats. Test that the C90 functions get their default - attributes in strict C90 mode, but the C99 and gettext functions - do not. -*/ -/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ -/* { dg-do compile { target { ! *-*-mingw* } } } */ -/* { dg-options "-std=iso9899:1990 -pedantic -Wformat" } */ - -#include "format.h" - -void -foo (int *ip, char *s, va_list v0, va_list v1, va_list v2, va_list v3, - va_list v4, va_list v5) -{ - fscanf (stdin, "%d", ip); - fscanf (stdin, "%ld", ip); /* { dg-warning "format" "fscanf" } */ - scanf ("%d", ip); - scanf ("%ld", ip); /* { dg-warning "format" "scanf" } */ - sscanf (s, "%d", ip); - sscanf (s, "%ld", ip); /* { dg-warning "format" "sscanf" } */ - vfscanf (stdin, "%d", v0); - vfscanf (stdin, "%Y", v1); - vscanf ("%d", v2); - vscanf ("%Y", v3); - vsscanf (s, "%d", v4); - vsscanf (s, "%Y", v5); - scanf (gettext ("%d"), ip); - scanf (gettext ("%ld"), ip); - scanf (dgettext ("", "%d"), ip); - scanf (dgettext ("", "%ld"), ip); - scanf (dcgettext ("", "%d", 0), ip); - scanf (dcgettext ("", "%ld", 0), ip); -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/c90-scanf-5.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/c90-scanf-5.c deleted file mode 100644 index c94e25f22..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/c90-scanf-5.c +++ /dev/null @@ -1,19 +0,0 @@ -/* Test for scanf formats. Formats using extensions to the standard - should be rejected in strict pedantic mode. -*/ -/* { dg-do compile } */ -/* { dg-options "-std=iso9899:1990 -pedantic -Wformat" } */ - -#include "format.h" - -void -foo (char **sp, wchar_t **lsp) -{ - /* m assignment-allocation modifier, recognized in both C90 - and C99 modes, is a POSIX and ISO/IEC WDTR 24731-2 extension. */ - scanf ("%ms", sp); /* { dg-warning "C" "%ms" } */ - scanf ("%mS", lsp); /* { dg-warning "C" "%mS" } */ - scanf ("%mls", lsp); /* { dg-warning "C" "%mls" } */ - scanf ("%m[bcd]", sp); /* { dg-warning "C" "%m[]" } */ - scanf ("%ml[bcd]", lsp); /* { dg-warning "C" "%ml[]" } */ -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/c90-strftime-1.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/c90-strftime-1.c deleted file mode 100644 index 1739f7b75..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/c90-strftime-1.c +++ /dev/null @@ -1,19 +0,0 @@ -/* Test for strftime formats. Formats using C90 features. */ -/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ -/* { dg-do compile } */ -/* { dg-options "-std=iso9899:1990 -pedantic -Wformat -Wformat-y2k" } */ - -#include "format.h" - -void -foo (char *s, size_t m, const struct tm *tp) -{ - /* See ISO/IEC 9899:1990 (E) subclause 7.12.3.5 (pages 174-175). */ - /* Formats which are Y2K-compliant (no 2-digit years). */ - strftime (s, m, "%a%A%b%B%d%H%I%j%m%M%p%S%U%w%W%X%Y%Z%%", tp); - /* Formats with 2-digit years. */ - strftime (s, m, "%y", tp); /* { dg-warning "only last 2" "2-digit year" } */ - /* Formats with 2-digit years in some locales. */ - strftime (s, m, "%c", tp); /* { dg-warning "some locales" "2-digit year" } */ - strftime (s, m, "%x", tp); /* { dg-warning "some locales" "2-digit year" } */ -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/c90-strftime-2.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/c90-strftime-2.c deleted file mode 100644 index 8b8398ed9..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/c90-strftime-2.c +++ /dev/null @@ -1,31 +0,0 @@ -/* Test for strftime formats. Rejection of formats using C99 features in - pedantic C90 mode. */ -/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ -/* { dg-do compile } */ -/* { dg-options "-std=iso9899:1990 -pedantic -Wformat -Wformat-y2k" } */ - -#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 *-*-* } 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 *-*-* } 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" } */ - strftime (s, m, "%r", tp); /* { dg-warning "C" "%r not in C90" } */ - strftime (s, m, "%R", tp); /* { dg-warning "C" "%R not in C90" } */ - strftime (s, m, "%t", tp); /* { dg-warning "C" "%t not in C90" } */ - strftime (s, m, "%T", tp); /* { dg-warning "C" "%T not in C90" } */ - strftime (s, m, "%u", tp); /* { dg-warning "C" "%u not in C90" } */ - strftime (s, m, "%V", tp); /* { dg-warning "C" "%V not in C90" } */ - strftime (s, m, "%z", tp); /* { dg-warning "C" "%z not in C90" } */ - strftime (s, m, "%EX", tp); /* { dg-warning "C" "%E not in C90" } */ - strftime (s, m, "%OW", tp); /* { dg-warning "C" "%O not in C90" } */ -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/c94-printf-1.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/c94-printf-1.c deleted file mode 100644 index 9ffc8385e..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/c94-printf-1.c +++ /dev/null @@ -1,18 +0,0 @@ -/* Test for printf formats. Changes in C94 to C90. */ -/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ -/* { dg-do compile } */ -/* { dg-options "-std=iso9899:199409 -pedantic -Wformat" } */ - -#include "format.h" - -void -foo (wint_t lc, wchar_t *ls) -{ - /* See ISO/IEC 9899:1990 (E) subclause 7.9.6.1 (pages 131-134), - as amended by ISO/IEC 9899:1990/Amd.1:1995 (E) (pages 4-5). - We do not repeat here all the C90 format checks, but just verify - that %ls and %lc are accepted without warning. - */ - printf ("%lc", lc); - printf ("%ls", ls); -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/c94-scanf-1.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/c94-scanf-1.c deleted file mode 100644 index 1eaad7dbf..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/c94-scanf-1.c +++ /dev/null @@ -1,17 +0,0 @@ -/* Test for scanf formats. Changes in C94 to C90. */ -/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ -/* { dg-do compile } */ -/* { dg-options "-std=iso9899:199409 -pedantic -Wformat" } */ - -#include "format.h" - -void -foo (wchar_t *ls) -{ - /* See ISO/IEC 9899:1990 (E) subclause 7.9.6.2 (pages 134-138), - as amended by ISO/IEC 9899:1990/Amd.1:1995 (E) (pages 5-6). - We do not repeat here all the C90 format checks, but just verify - that %ls, %lc, %l[] are accepted without warning. - */ - scanf ("%lc%ls%l[abc]", ls, ls, ls); -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/c99-printf-1.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/c99-printf-1.c deleted file mode 100644 index 729e41c3d..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/c99-printf-1.c +++ /dev/null @@ -1,197 +0,0 @@ -/* Test for printf formats. Formats using C99 features, including cases - where C99 specifies some aspect of the format to be ignored or where - the behavior is undefined. -*/ -/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ -/* { dg-do compile } */ -/* { dg-options "-std=iso9899:1999 -pedantic -Wformat" } */ - -#include "format.h" - -void -foo (int i, unsigned int u, double d, char *s, void *p, int *n, - long double ld, wint_t lc, wchar_t *ls, long long int ll, - unsigned long long int ull, signed char *ss, unsigned char *us, - long long int *lln, intmax_t j, uintmax_t uj, intmax_t *jn, - size_t z, signed_size_t sz, signed_size_t *zn, - ptrdiff_t t, ptrdiff_t *tn) -{ - /* See ISO/IEC 9899:1999 (E) subclause 7.19.6.1 (pages 273-281). - We do not repeat here most of the checks for correct C90 formats - or completely broken formats. - */ - /* Valid and invalid %h, %hh, %l, %ll, %j, %z, %t, %L constructions. */ - printf ("%hf", d); /* { dg-warning "length" "bad use of %h" } */ - printf ("%hF", d); /* { dg-warning "length" "bad use of %h" } */ - printf ("%he", d); /* { dg-warning "length" "bad use of %h" } */ - printf ("%hE", d); /* { dg-warning "length" "bad use of %h" } */ - printf ("%hg", d); /* { dg-warning "length" "bad use of %h" } */ - printf ("%hG", d); /* { dg-warning "length" "bad use of %h" } */ - printf ("%ha", d); /* { dg-warning "length" "bad use of %h" } */ - printf ("%hA", d); /* { dg-warning "length" "bad use of %h" } */ - printf ("%hc", i); /* { dg-warning "length" "bad use of %h" } */ - printf ("%hs", s); /* { dg-warning "length" "bad use of %h" } */ - printf ("%hp", p); /* { dg-warning "length" "bad use of %h" } */ - printf ("%hhd%hhi%hho%hhu%hhx%hhX", i, i, u, u, u, u); - printf ("%hhn", ss); - printf ("%hhf", d); /* { dg-warning "length" "bad use of %hh" } */ - printf ("%hhF", d); /* { dg-warning "length" "bad use of %hh" } */ - printf ("%hhe", d); /* { dg-warning "length" "bad use of %hh" } */ - printf ("%hhE", d); /* { dg-warning "length" "bad use of %hh" } */ - printf ("%hhg", d); /* { dg-warning "length" "bad use of %hh" } */ - printf ("%hhG", d); /* { dg-warning "length" "bad use of %hh" } */ - printf ("%hha", d); /* { dg-warning "length" "bad use of %hh" } */ - printf ("%hhA", d); /* { dg-warning "length" "bad use of %hh" } */ - printf ("%hhc", i); /* { dg-warning "length" "bad use of %hh" } */ - printf ("%hhs", s); /* { dg-warning "length" "bad use of %hh" } */ - printf ("%hhp", p); /* { dg-warning "length" "bad use of %hh" } */ - printf ("%lc", lc); - printf ("%ls", ls); - printf ("%lf%lF%le%lE%lg%lG%la%lA", d, d, d, d, d, d, d, d); - printf ("%lp", p); /* { dg-warning "length|C" "bad use of %l" } */ - printf ("%lld%lli%llo%llu%llx%llX", ll, ll, ull, ull, ull, ull); - printf ("%lln", lln); - printf ("%llf", d); /* { dg-warning "length" "bad use of %ll" } */ - printf ("%llF", d); /* { dg-warning "length" "bad use of %ll" } */ - printf ("%lle", d); /* { dg-warning "length" "bad use of %ll" } */ - printf ("%llE", d); /* { dg-warning "length" "bad use of %ll" } */ - printf ("%llg", d); /* { dg-warning "length" "bad use of %ll" } */ - printf ("%llG", d); /* { dg-warning "length" "bad use of %ll" } */ - printf ("%lla", d); /* { dg-warning "length" "bad use of %ll" } */ - printf ("%llA", d); /* { dg-warning "length" "bad use of %ll" } */ - printf ("%llc", i); /* { dg-warning "length" "bad use of %ll" } */ - printf ("%lls", s); /* { dg-warning "length" "bad use of %ll" } */ - printf ("%llp", p); /* { dg-warning "length" "bad use of %ll" } */ - printf ("%jd%ji%jo%ju%jx%jX", j, j, uj, uj, uj, uj); /* { dg-bogus "length" "bogus %j warning" { target *-*-* } } */ - printf ("%jn", jn); /* { dg-bogus "length" "bogus %j warning" { target *-*-* } } */ - printf ("%jf", d); /* { dg-warning "length" "bad use of %j" } */ - printf ("%jF", d); /* { dg-warning "length" "bad use of %j" } */ - printf ("%je", d); /* { dg-warning "length" "bad use of %j" } */ - printf ("%jE", d); /* { dg-warning "length" "bad use of %j" } */ - printf ("%jg", d); /* { dg-warning "length" "bad use of %j" } */ - printf ("%jG", d); /* { dg-warning "length" "bad use of %j" } */ - printf ("%ja", d); /* { dg-warning "length" "bad use of %j" } */ - printf ("%jA", d); /* { dg-warning "length" "bad use of %j" } */ - printf ("%jc", i); /* { dg-warning "length" "bad use of %j" } */ - printf ("%js", s); /* { dg-warning "length" "bad use of %j" } */ - printf ("%jp", p); /* { dg-warning "length" "bad use of %j" } */ - printf ("%zd%zi%zo%zu%zx%zX", sz, sz, z, z, z, z); - printf ("%zn", zn); - printf ("%zf", d); /* { dg-warning "length" "bad use of %z" } */ - printf ("%zF", d); /* { dg-warning "length" "bad use of %z" } */ - printf ("%ze", d); /* { dg-warning "length" "bad use of %z" } */ - printf ("%zE", d); /* { dg-warning "length" "bad use of %z" } */ - printf ("%zg", d); /* { dg-warning "length" "bad use of %z" } */ - printf ("%zG", d); /* { dg-warning "length" "bad use of %z" } */ - printf ("%za", d); /* { dg-warning "length" "bad use of %z" } */ - printf ("%zA", d); /* { dg-warning "length" "bad use of %z" } */ - printf ("%zc", i); /* { dg-warning "length" "bad use of %z" } */ - printf ("%zs", s); /* { dg-warning "length" "bad use of %z" } */ - printf ("%zp", p); /* { dg-warning "length" "bad use of %z" } */ - printf ("%td%ti%to%tu%tx%tX", t, t, t, t, t, t); - printf ("%tn", tn); - printf ("%tf", d); /* { dg-warning "length" "bad use of %t" } */ - printf ("%tF", d); /* { dg-warning "length" "bad use of %t" } */ - printf ("%te", d); /* { dg-warning "length" "bad use of %t" } */ - printf ("%tE", d); /* { dg-warning "length" "bad use of %t" } */ - printf ("%tg", d); /* { dg-warning "length" "bad use of %t" } */ - printf ("%tG", d); /* { dg-warning "length" "bad use of %t" } */ - printf ("%ta", d); /* { dg-warning "length" "bad use of %t" } */ - printf ("%tA", d); /* { dg-warning "length" "bad use of %t" } */ - printf ("%tc", i); /* { dg-warning "length" "bad use of %t" } */ - printf ("%ts", s); /* { dg-warning "length" "bad use of %t" } */ - printf ("%tp", p); /* { dg-warning "length" "bad use of %t" } */ - printf ("%Le%LE%Lf%LF%Lg%LG%La%LA", ld, ld, ld, ld, ld, ld, ld, ld); - /* These next six are accepted by GCC as referring to long long, - but -pedantic correctly warns. - */ - printf ("%Ld", ll); /* { dg-warning "does not support" "bad use of %L" } */ - printf ("%Li", ll); /* { dg-warning "does not support" "bad use of %L" } */ - printf ("%Lo", ull); /* { dg-warning "does not support" "bad use of %L" } */ - printf ("%Lu", ull); /* { dg-warning "does not support" "bad use of %L" } */ - printf ("%Lx", ull); /* { dg-warning "does not support" "bad use of %L" } */ - printf ("%LX", ull); /* { dg-warning "does not support" "bad use of %L" } */ - printf ("%Lc", i); /* { dg-warning "length" "bad use of %L" } */ - printf ("%Ls", s); /* { dg-warning "length" "bad use of %L" } */ - printf ("%Lp", p); /* { dg-warning "length" "bad use of %L" } */ - printf ("%Ln", n); /* { dg-warning "length" "bad use of %L" } */ - /* Valid uses of each bare conversion. */ - printf ("%d%i%o%u%x%X%f%F%e%E%g%G%a%A%c%s%p%n%%", i, i, u, u, u, u, - d, d, d, d, d, d, d, d, i, s, p, n); - /* Uses of the - flag (valid on all non-%, non-n conversions). */ - printf ("%-d%-i%-o%-u%-x%-X%-f%-F%-e%-E%-g%-G%-a%-A%-c%-s%-p", i, i, - u, u, u, u, d, d, d, d, d, d, d, d, i, s, p); - printf ("%-n", n); /* { dg-warning "flag" "bad use of %-n" } */ - /* Uses of the + flag (valid on signed conversions only). */ - printf ("%+d%+i%+f%+F%+e%+E%+g%+G%+a%+A\n", i, i, d, d, d, d, d, d, d, d); - printf ("%+o", u); /* { dg-warning "flag" "bad use of + flag" } */ - printf ("%+u", u); /* { dg-warning "flag" "bad use of + flag" } */ - printf ("%+x", u); /* { dg-warning "flag" "bad use of + flag" } */ - printf ("%+X", u); /* { dg-warning "flag" "bad use of + flag" } */ - printf ("%+c", i); /* { dg-warning "flag" "bad use of + flag" } */ - printf ("%+s", s); /* { dg-warning "flag" "bad use of + flag" } */ - printf ("%+p", p); /* { dg-warning "flag" "bad use of + flag" } */ - printf ("%+n", n); /* { dg-warning "flag" "bad use of + flag" } */ - /* Uses of the space flag (valid on signed conversions only, and ignored - with +). - */ - printf ("% +d", i); /* { dg-warning "use of both|ignored" "use of space and + flags" } */ - printf ("%+ d", i); /* { dg-warning "use of both|ignored" "use of space and + flags" } */ - printf ("% d% i% f% F% e% E% g% G% a% A\n", i, i, d, d, d, d, d, d, d, d); - printf ("% o", u); /* { dg-warning "flag" "bad use of space flag" } */ - printf ("% u", u); /* { dg-warning "flag" "bad use of space flag" } */ - printf ("% x", u); /* { dg-warning "flag" "bad use of space flag" } */ - printf ("% X", u); /* { dg-warning "flag" "bad use of space flag" } */ - printf ("% c", i); /* { dg-warning "flag" "bad use of space flag" } */ - printf ("% s", s); /* { dg-warning "flag" "bad use of space flag" } */ - printf ("% p", p); /* { dg-warning "flag" "bad use of space flag" } */ - printf ("% n", n); /* { dg-warning "flag" "bad use of space flag" } */ - /* Uses of the # flag. */ - printf ("%#o%#x%#X%#e%#E%#f%#F%#g%#G%#a%#A", u, u, u, d, d, d, d, - d, d, d, d); - printf ("%#d", i); /* { dg-warning "flag" "bad use of # flag" } */ - printf ("%#i", i); /* { dg-warning "flag" "bad use of # flag" } */ - printf ("%#u", u); /* { dg-warning "flag" "bad use of # flag" } */ - printf ("%#c", i); /* { dg-warning "flag" "bad use of # flag" } */ - printf ("%#s", s); /* { dg-warning "flag" "bad use of # flag" } */ - printf ("%#p", p); /* { dg-warning "flag" "bad use of # flag" } */ - printf ("%#n", n); /* { dg-warning "flag" "bad use of # flag" } */ - /* Uses of the 0 flag. */ - printf ("%08d%08i%08o%08u%08x%08X%08e%08E%08f%08F%08g%08G%08a%08A", i, i, - u, u, u, u, d, d, d, d, d, d, d, d); - printf ("%0c", i); /* { dg-warning "flag" "bad use of 0 flag" } */ - printf ("%0s", s); /* { dg-warning "flag" "bad use of 0 flag" } */ - printf ("%0p", p); /* { dg-warning "flag" "bad use of 0 flag" } */ - printf ("%0n", n); /* { dg-warning "flag" "bad use of 0 flag" } */ - /* 0 flag ignored with precision for certain types, not others. */ - printf ("%08.5d", i); /* { dg-warning "ignored" "0 flag ignored with precision" } */ - printf ("%08.5i", i); /* { dg-warning "ignored" "0 flag ignored with precision" } */ - printf ("%08.5o", u); /* { dg-warning "ignored" "0 flag ignored with precision" } */ - printf ("%08.5u", u); /* { dg-warning "ignored" "0 flag ignored with precision" } */ - printf ("%08.5x", u); /* { dg-warning "ignored" "0 flag ignored with precision" } */ - printf ("%08.5X", u); /* { dg-warning "ignored" "0 flag ignored with precision" } */ - printf ("%08.5f%08.5F%08.5e%08.5E%08.5g%08.5G%08.5a%08.5A", - d, d, d, d, d, d, d, d); - /* 0 flag ignored with - flag. */ - printf ("%-08d", i); /* { dg-warning "flags|ignored" "0 flag ignored with - flag" } */ - printf ("%-08i", i); /* { dg-warning "flags|ignored" "0 flag ignored with - flag" } */ - printf ("%-08o", u); /* { dg-warning "flags|ignored" "0 flag ignored with - flag" } */ - printf ("%-08u", u); /* { dg-warning "flags|ignored" "0 flag ignored with - flag" } */ - printf ("%-08x", u); /* { dg-warning "flags|ignored" "0 flag ignored with - flag" } */ - printf ("%-08X", u); /* { dg-warning "flags|ignored" "0 flag ignored with - flag" } */ - printf ("%-08e", d); /* { dg-warning "flags|ignored" "0 flag ignored with - flag" } */ - printf ("%-08E", d); /* { dg-warning "flags|ignored" "0 flag ignored with - flag" } */ - printf ("%-08f", d); /* { dg-warning "flags|ignored" "0 flag ignored with - flag" } */ - printf ("%-08F", d); /* { dg-warning "flags|ignored" "0 flag ignored with - flag" } */ - printf ("%-08g", d); /* { dg-warning "flags|ignored" "0 flag ignored with - flag" } */ - printf ("%-08G", d); /* { dg-warning "flags|ignored" "0 flag ignored with - flag" } */ - printf ("%-08a", d); /* { dg-warning "flags|ignored" "0 flag ignored with - flag" } */ - printf ("%-08A", d); /* { dg-warning "flags|ignored" "0 flag ignored with - flag" } */ - /* Various tests of bad argument types. Mostly covered in c90-printf-1.c; - here just test for pointer target sign with %hhn. (Probably allowed - by the standard, but a bad idea, so GCC should diagnose if what - is used is not signed char *.) - */ - printf ("%hhn", s); /* { dg-warning "format" "%hhn plain char" } */ - printf ("%hhn", us); /* { dg-warning "format" "%hhn unsigned char" } */ -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/c99-printf-2.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/c99-printf-2.c deleted file mode 100644 index 9efcb0667..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/c99-printf-2.c +++ /dev/null @@ -1,32 +0,0 @@ -/* Test for printf formats. Formats using extensions to the standard - should be rejected in strict pedantic mode. -*/ -/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ -/* { dg-do compile } */ -/* { dg-options "-std=iso9899:1999 -pedantic -Wformat" } */ - -#include "format.h" - -void -foo (int i, long long ll, size_t z, wint_t lc, wchar_t *ls) -{ - /* The length modifiers q, Z and L as applied to integer formats are - extensions. - */ - printf ("%qd", ll); /* { dg-warning "C" "%q length" } */ - printf ("%Ld", ll); /* { dg-warning "C" "%L length" } */ - printf ("%Zd", z); /* { dg-warning "C" "%Z length" } */ - /* The conversion specifiers C and S are X/Open extensions; the - conversion specifier m is a GNU extension. - */ - printf ("%m"); /* { dg-warning "C" "printf %m" } */ - printf ("%C", lc); /* { dg-warning "C" "printf %C" } */ - printf ("%S", ls); /* { dg-warning "C" "printf %S" } */ - /* The flag character ', and the use of operand number $ formats, are - X/Open extensions. - */ - printf ("%'d", i); /* { dg-warning "C" "printf ' flag" } */ - printf ("%1$d", i); /* { dg-warning "C" "printf $ format" } */ - /* The flag character I is a GNU extension. */ - printf ("%Id", i); /* { dg-warning "C" "printf I flag" } */ -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/c99-printf-3.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/c99-printf-3.c deleted file mode 100644 index 2407bb603..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/c99-printf-3.c +++ /dev/null @@ -1,39 +0,0 @@ -/* Test for printf formats. Test that the C99 functions get their default - attributes in strict C99 mode, but the gettext functions do not. -*/ -/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ -/* { dg-do compile { target { ! *-*-mingw* } } } */ -/* { dg-options "-std=iso9899:1999 -pedantic -Wformat" } */ - -#include "format.h" - -void -foo (int i, char *s, size_t n, va_list v0, va_list v1, va_list v2, va_list v3, - va_list v4, va_list v5, va_list v6, va_list v7) -{ - fprintf (stdout, "%d", i); - fprintf (stdout, "%ld", i); /* { dg-warning "format" "fprintf" } */ - printf ("%d", i); - printf ("%ld", i); /* { dg-warning "format" "printf" } */ - /* The "unlocked" functions shouldn't warn in c99 mode. */ - fprintf_unlocked (stdout, "%ld", i); /* { dg-bogus "format" "fprintf_unlocked" } */ - printf_unlocked ("%ld", i); /* { dg-bogus "format" "printf_unlocked" } */ - sprintf (s, "%d", i); - sprintf (s, "%ld", i); /* { dg-warning "format" "sprintf" } */ - snprintf (s, n, "%d", i); - snprintf (s, n, "%ld", i); /* { dg-warning "format" "snprintf" } */ - vfprintf (stdout, "%d", v0); - vfprintf (stdout, "%Y", v1); /* { dg-warning "format" "vfprintf" } */ - vprintf ("%d", v0); - vprintf ("%Y", v1); /* { dg-warning "format" "vprintf" } */ - vsprintf (s, "%d", v0); - vsprintf (s, "%Y", v1); /* { dg-warning "format" "vsprintf" } */ - vsnprintf (s, n, "%d", v0); - vsnprintf (s, n, "%Y", v1); /* { dg-warning "format" "vsnprintf" } */ - printf (gettext ("%d"), i); - printf (gettext ("%ld"), i); - printf (dgettext ("", "%d"), i); - printf (dgettext ("", "%ld"), i); - printf (dcgettext ("", "%d", 0), i); - printf (dcgettext ("", "%ld", 0), i); -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/c99-scanf-1.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/c99-scanf-1.c deleted file mode 100644 index 7a8b3e245..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/c99-scanf-1.c +++ /dev/null @@ -1,145 +0,0 @@ -/* Test for scanf formats. Formats using C99 features, including cases - where C99 specifies some aspect of the format to be ignored or where - the behavior is undefined. -*/ -/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ -/* { dg-do compile } */ -/* { dg-options "-std=iso9899:1999 -pedantic -Wformat" } */ - -#include "format.h" - -void -foo (int *ip, unsigned int *uip, short int *hp, unsigned short int *uhp, - signed char *hhp, unsigned char *uhhp, long int *lp, - unsigned long int *ulp, float *fp, double *dp, long double *ldp, char *s, - void **pp, int *n, long long *llp, unsigned long long *ullp, wchar_t *ls, - short int *hn, signed char *hhn, long int *ln, long long int *lln, - intmax_t *jp, uintmax_t *ujp, intmax_t *jn, size_t *zp, - signed_size_t *szp, signed_size_t *zn, ptrdiff_t *tp, - unsigned_ptrdiff_t *utp, ptrdiff_t *tn) -{ - /* See ISO/IEC 9899:1999 (E) subclause 7.19.6.2 (pages 281-288). - We do not repeat here most of the checks for correct C90 formats - or completely broken formats. - */ - /* Valid, invalid and silly assignment-suppression - and width constructions. - */ - scanf ("%*d%*i%*o%*u%*x%*X%*a%*A%*e%*E%*f%*F%*g%*G%*s%*[abc]%*c%*p"); - scanf ("%*2d%*8s%*3c"); - scanf ("%*n", n); /* { dg-warning "suppress" "suppression of %n" } */ - scanf ("%*hd"); /* { dg-warning "together" "suppression with length" } */ - scanf ("%2d%3i%4o%5u%6x%7X%8a%9A%10e%11E%12f%13F%14g%15G%16s%3[abc]%4c%5p", - ip, ip, uip, uip, uip, uip, fp, fp, fp, fp, fp, fp, fp, fp, - s, s, s, pp); - scanf ("%0d", ip); /* { dg-warning "width" "warning for zero width" } */ - scanf ("%3n", n); /* { dg-warning "width" "width with %n" } */ - /* Valid and invalid %h, %hh, %l, %ll, %j, %z, %t, %L constructions. */ - scanf ("%hd%hi%ho%hu%hx%hX%hn", hp, hp, uhp, uhp, uhp, uhp, hn); - scanf ("%ha", fp); /* { dg-warning "length" "bad use of %h" } */ - scanf ("%hA", fp); /* { dg-warning "length" "bad use of %h" } */ - scanf ("%he", fp); /* { dg-warning "length" "bad use of %h" } */ - scanf ("%hE", fp); /* { dg-warning "length" "bad use of %h" } */ - scanf ("%hf", fp); /* { dg-warning "length" "bad use of %h" } */ - scanf ("%hF", fp); /* { dg-warning "length" "bad use of %h" } */ - scanf ("%hg", fp); /* { dg-warning "length" "bad use of %h" } */ - scanf ("%hG", fp); /* { dg-warning "length" "bad use of %h" } */ - scanf ("%hs", s); /* { dg-warning "length" "bad use of %h" } */ - scanf ("%h[ac]", s); /* { dg-warning "length" "bad use of %h" } */ - scanf ("%hc", s); /* { dg-warning "length" "bad use of %h" } */ - scanf ("%hp", pp); /* { dg-warning "length" "bad use of %h" } */ - scanf ("%hhd%hhi%hho%hhu%hhx%hhX%hhn", hhp, hhp, uhhp, uhhp, uhhp, uhhp, - hhn); - scanf ("%hha", fp); /* { dg-warning "length" "bad use of %hh" } */ - scanf ("%hhA", fp); /* { dg-warning "length" "bad use of %hh" } */ - scanf ("%hhe", fp); /* { dg-warning "length" "bad use of %hh" } */ - scanf ("%hhE", fp); /* { dg-warning "length" "bad use of %hh" } */ - scanf ("%hhf", fp); /* { dg-warning "length" "bad use of %hh" } */ - scanf ("%hhF", fp); /* { dg-warning "length" "bad use of %hh" } */ - scanf ("%hhg", fp); /* { dg-warning "length" "bad use of %hh" } */ - scanf ("%hhG", fp); /* { dg-warning "length" "bad use of %hh" } */ - scanf ("%hhs", s); /* { dg-warning "length" "bad use of %hh" } */ - scanf ("%hh[ac]", s); /* { dg-warning "length" "bad use of %hh" } */ - scanf ("%hhc", s); /* { dg-warning "length" "bad use of %hh" } */ - scanf ("%hhp", pp); /* { dg-warning "length" "bad use of %hh" } */ - scanf ("%ld%li%lo%lu%lx%lX%ln", lp, lp, ulp, ulp, ulp, ulp, ln); - scanf ("%la%lA%le%lE%lf%lF%lg%lG", dp, dp, dp, dp, dp, dp, dp, dp); - scanf ("%lp", pp); /* { dg-warning "length" "bad use of %l" } */ - scanf ("%ls", ls); - scanf ("%l[ac]", ls); - scanf ("%lc", ls); - scanf ("%lld%lli%llo%llu%llx%llX%lln", llp, llp, ullp, ullp, ullp, ullp, - lln); - scanf ("%lla", fp); /* { dg-warning "length" "bad use of %ll" } */ - scanf ("%llA", fp); /* { dg-warning "length" "bad use of %ll" } */ - scanf ("%lle", fp); /* { dg-warning "length" "bad use of %ll" } */ - scanf ("%llE", fp); /* { dg-warning "length" "bad use of %ll" } */ - scanf ("%llf", fp); /* { dg-warning "length" "bad use of %ll" } */ - scanf ("%llF", fp); /* { dg-warning "length" "bad use of %ll" } */ - scanf ("%llg", fp); /* { dg-warning "length" "bad use of %ll" } */ - scanf ("%llG", fp); /* { dg-warning "length" "bad use of %ll" } */ - scanf ("%lls", s); /* { dg-warning "length" "bad use of %ll" } */ - scanf ("%ll[ac]", s); /* { dg-warning "length" "bad use of %ll" } */ - scanf ("%llc", s); /* { dg-warning "length" "bad use of %ll" } */ - scanf ("%llp", pp); /* { dg-warning "length" "bad use of %ll" } */ - scanf ("%jd%ji%jo%ju%jx%jX%jn", jp, jp, ujp, ujp, ujp, ujp, jn); /* { dg-bogus "length" "bogus %j warning" { target *-*-* } } */ - scanf ("%ja", fp); /* { dg-warning "length" "bad use of %j" } */ - scanf ("%jA", fp); /* { dg-warning "length" "bad use of %j" } */ - scanf ("%je", fp); /* { dg-warning "length" "bad use of %j" } */ - scanf ("%jE", fp); /* { dg-warning "length" "bad use of %j" } */ - scanf ("%jf", fp); /* { dg-warning "length" "bad use of %j" } */ - scanf ("%jF", fp); /* { dg-warning "length" "bad use of %j" } */ - scanf ("%jg", fp); /* { dg-warning "length" "bad use of %j" } */ - scanf ("%jG", fp); /* { dg-warning "length" "bad use of %j" } */ - scanf ("%js", s); /* { dg-warning "length" "bad use of %j" } */ - scanf ("%j[ac]", s); /* { dg-warning "length" "bad use of %j" } */ - scanf ("%jc", s); /* { dg-warning "length" "bad use of %j" } */ - scanf ("%jp", pp); /* { dg-warning "length" "bad use of %j" } */ - scanf ("%zd%zi%zo%zu%zx%zX%zn", szp, szp, zp, zp, zp, zp, zn); - scanf ("%za", fp); /* { dg-warning "length" "bad use of %z" } */ - scanf ("%zA", fp); /* { dg-warning "length" "bad use of %z" } */ - scanf ("%ze", fp); /* { dg-warning "length" "bad use of %z" } */ - scanf ("%zE", fp); /* { dg-warning "length" "bad use of %z" } */ - scanf ("%zf", fp); /* { dg-warning "length" "bad use of %z" } */ - scanf ("%zF", fp); /* { dg-warning "length" "bad use of %z" } */ - scanf ("%zg", fp); /* { dg-warning "length" "bad use of %z" } */ - scanf ("%zG", fp); /* { dg-warning "length" "bad use of %z" } */ - scanf ("%zs", s); /* { dg-warning "length" "bad use of %z" } */ - scanf ("%z[ac]", s); /* { dg-warning "length" "bad use of %z" } */ - scanf ("%zc", s); /* { dg-warning "length" "bad use of %z" } */ - scanf ("%zp", pp); /* { dg-warning "length" "bad use of %z" } */ - scanf ("%td%ti%to%tu%tx%tX%tn", tp, tp, utp, utp, utp, utp, tn); - scanf ("%ta", fp); /* { dg-warning "length" "bad use of %t" } */ - scanf ("%tA", fp); /* { dg-warning "length" "bad use of %t" } */ - scanf ("%te", fp); /* { dg-warning "length" "bad use of %t" } */ - scanf ("%tE", fp); /* { dg-warning "length" "bad use of %t" } */ - scanf ("%tf", fp); /* { dg-warning "length" "bad use of %t" } */ - scanf ("%tF", fp); /* { dg-warning "length" "bad use of %t" } */ - scanf ("%tg", fp); /* { dg-warning "length" "bad use of %t" } */ - scanf ("%tG", fp); /* { dg-warning "length" "bad use of %t" } */ - scanf ("%ts", s); /* { dg-warning "length" "bad use of %t" } */ - scanf ("%t[ac]", s); /* { dg-warning "length" "bad use of %t" } */ - scanf ("%tc", s); /* { dg-warning "length" "bad use of %t" } */ - scanf ("%tp", pp); /* { dg-warning "length" "bad use of %t" } */ - scanf ("%La%LA%Le%LE%Lf%LF%Lg%LG", ldp, ldp, ldp, ldp, ldp, ldp, ldp, ldp); - scanf ("%Ld", llp); /* { dg-warning "does not support" "bad use of %L" } */ - scanf ("%Li", llp); /* { dg-warning "does not support" "bad use of %L" } */ - scanf ("%Lo", ullp); /* { dg-warning "does not support" "bad use of %L" } */ - scanf ("%Lu", ullp); /* { dg-warning "does not support" "bad use of %L" } */ - scanf ("%Lx", ullp); /* { dg-warning "does not support" "bad use of %L" } */ - scanf ("%LX", ullp); /* { dg-warning "does not support" "bad use of %L" } */ - scanf ("%Ls", s); /* { dg-warning "length" "bad use of %L" } */ - scanf ("%L[ac]", s); /* { dg-warning "length" "bad use of %L" } */ - scanf ("%Lc", s); /* { dg-warning "length" "bad use of %L" } */ - scanf ("%Lp", pp); /* { dg-warning "length" "bad use of %L" } */ - scanf ("%Ln", n); /* { dg-warning "length" "bad use of %L" } */ - /* Valid uses of each bare conversion. */ - scanf ("%d%i%o%u%x%X%a%A%e%E%f%F%g%G%s%[abc]%c%p%n%%", ip, ip, uip, uip, uip, - uip, fp, fp, fp, fp, fp, fp, fp, fp, s, s, s, pp, n); - /* Assert that %as is not treated as an extension in C99 mode. */ - scanf ("%as", fp); - scanf ("%a[", fp); - /* Tests for bad argument types: pointer target sign with %hh. */ - scanf ("%hhd", uhhp); /* { dg-warning "format" "%hhd sign" } */ - scanf ("%hhu", hhp); /* { dg-warning "format" "%hhu sign" } */ -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/c99-scanf-2.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/c99-scanf-2.c deleted file mode 100644 index eedf3e57c..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/c99-scanf-2.c +++ /dev/null @@ -1,26 +0,0 @@ -/* Test for scanf formats. Formats using extensions to the standard - should be rejected in strict pedantic mode. -*/ -/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ -/* { dg-do compile } */ -/* { dg-options "-std=iso9899:1999 -pedantic -Wformat" } */ - -#include "format.h" - -void -foo (int *ip, long long int *llp, wchar_t *ls) -{ - /* The length modifiers q and L as applied to integer formats are - extensions. - */ - scanf ("%qd", llp); /* { dg-warning "C" "%q length" } */ - scanf ("%Ld", llp); /* { dg-warning "C" "%L length" } */ - /* The conversion specifiers C and S are X/Open extensions. */ - scanf ("%C", ls); /* { dg-warning "C" "scanf %C" } */ - scanf ("%S", ls); /* { dg-warning "C" "scanf %S" } */ - /* The use of operand number $ formats is an X/Open extension. */ - scanf ("%1$d", ip); /* { dg-warning "C" "scanf $ format" } */ - /* glibc also supports flags ' and I on scanf formats as an extension. */ - scanf ("%'d", ip); /* { dg-warning "C" "scanf ' flag" } */ - scanf ("%Id", ip); /* { dg-warning "C" "scanf I flag" } */ -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/c99-scanf-3.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/c99-scanf-3.c deleted file mode 100644 index 091a3ea95..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/c99-scanf-3.c +++ /dev/null @@ -1,32 +0,0 @@ -/* Test for scanf formats. Test that the C99 functions get their default - attributes in strict C99 mode, but the gettext functions do not. -*/ -/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ -/* { dg-do compile } */ -/* { dg-options "-std=iso9899:1999 -pedantic -Wformat" } */ - -#include "format.h" - -void -foo (int *ip, char *s, va_list v0, va_list v1, va_list v2, va_list v3, - va_list v4, va_list v5) -{ - fscanf (stdin, "%d", ip); - fscanf (stdin, "%ld", ip); /* { dg-warning "format" "fscanf" } */ - scanf ("%d", ip); - scanf ("%ld", ip); /* { dg-warning "format" "scanf" } */ - sscanf (s, "%d", ip); - sscanf (s, "%ld", ip); /* { dg-warning "format" "sscanf" } */ - vfscanf (stdin, "%d", v0); - vfscanf (stdin, "%Y", v1); /* { dg-warning "format" "vfscanf" } */ - vscanf ("%d", v2); - vscanf ("%Y", v3); /* { dg-warning "format" "vscanf" } */ - vsscanf (s, "%d", v4); - vsscanf (s, "%Y", v5); /* { dg-warning "format" "vsscanf" } */ - scanf (gettext ("%d"), ip); - scanf (gettext ("%ld"), ip); - scanf (dgettext ("", "%d"), ip); - scanf (dgettext ("", "%ld"), ip); - scanf (dcgettext ("", "%d", 0), ip); - scanf (dcgettext ("", "%ld", 0), ip); -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/c99-scanf-4.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/c99-scanf-4.c deleted file mode 100644 index 9c7a5e4b2..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/c99-scanf-4.c +++ /dev/null @@ -1,19 +0,0 @@ -/* Test for scanf formats. Formats using extensions to the standard - should be rejected in strict pedantic mode. -*/ -/* { dg-do compile } */ -/* { dg-options "-std=iso9899:1999 -pedantic -Wformat" } */ - -#include "format.h" - -void -foo (char **sp, wchar_t **lsp) -{ - /* m assignment-allocation modifier, recognized in both C90 - and C99 modes, is a POSIX and ISO/IEC WDTR 24731-2 extension. */ - scanf ("%ms", sp); /* { dg-warning "C" "%ms" } */ - scanf ("%mS", lsp); /* { dg-warning "C" "%mS" } */ - scanf ("%mls", lsp); /* { dg-warning "C" "%mls" } */ - scanf ("%m[bcd]", sp); /* { dg-warning "C" "%m[]" } */ - scanf ("%ml[bcd]", lsp); /* { dg-warning "C" "%ml[]" } */ -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/c99-strftime-1.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/c99-strftime-1.c deleted file mode 100644 index 1730738df..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/c99-strftime-1.c +++ /dev/null @@ -1,97 +0,0 @@ -/* Test for strftime formats. Formats using C99 features. */ -/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ -/* { dg-do compile } */ -/* { dg-options "-std=iso9899:1999 -pedantic -Wformat -Wformat-y2k" } */ - -#include "format.h" - -void -foo (char *s, size_t m, const struct tm *tp) -{ - /* See ISO/IEC 9899:1990 (E) subclause 7.12.3.5 (pages 174-175). */ - /* Formats which are Y2K-compliant (no 2-digit years). */ - strftime (s, m, "%a%A%b%B%C%d%e%F%G%h%H%I%j%m%M%p%R%S%t%T%u%U%V%w%W%X%Y%z%Z%%", tp); - strftime (s, m, "%EC%EX%EY%Od%Oe%OH%OI%Om%OM%OS%Ou%OU%OV%Ow%OW", tp); - /* Formats with 2-digit years. */ - strftime (s, m, "%D", tp); /* { dg-warning "only last 2" "2-digit year" } */ - strftime (s, m, "%g", tp); /* { dg-warning "only last 2" "2-digit year" } */ - strftime (s, m, "%y", tp); /* { dg-warning "only last 2" "2-digit year" } */ - strftime (s, m, "%Oy", tp); /* { dg-warning "only last 2" "2-digit year" } */ - /* Formats with 2-digit years in some locales. */ - strftime (s, m, "%c", tp); /* { dg-warning "some locales" "2-digit year" } */ - strftime (s, m, "%Ec", tp); /* { dg-warning "some locales" "2-digit year" } */ - strftime (s, m, "%x", tp); /* { dg-warning "some locales" "2-digit year" } */ - strftime (s, m, "%Ex", tp); /* { dg-warning "some locales" "2-digit year" } */ - /* %Ey is explicitly an era offset not a 2-digit year; but in some - locales the E modifier may be ignored. - */ - strftime (s, m, "%Ey", tp); /* { dg-warning "some locales" "2-digit year" } */ - /* Bad uses of %E and %O. */ - strftime (s, m, "%EEY", tp); /* { dg-warning "multiple|repeated" "multiple %E/%O" } */ - 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 *-*-* } 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 *-*-* } 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 *-*-* } 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" } */ - strftime (s, m, "%EI", tp); /* { dg-warning "flag|modifier" "bad %EI" } */ - strftime (s, m, "%Ej", tp); /* { dg-warning "flag|modifier" "bad %Ej" } */ - strftime (s, m, "%Em", tp); /* { dg-warning "flag|modifier" "bad %Em" } */ - strftime (s, m, "%EM", tp); /* { dg-warning "flag|modifier" "bad %EM" } */ - strftime (s, m, "%En", tp); /* { dg-warning "flag|modifier" "bad %En" } */ - strftime (s, m, "%Ep", tp); /* { dg-warning "flag|modifier" "bad %Ep" } */ - strftime (s, m, "%Er", tp); /* { dg-warning "flag|modifier" "bad %Er" } */ - strftime (s, m, "%ER", tp); /* { dg-warning "flag|modifier" "bad %ER" } */ - strftime (s, m, "%ES", tp); /* { dg-warning "flag|modifier" "bad %ES" } */ - strftime (s, m, "%Et", tp); /* { dg-warning "flag|modifier" "bad %Et" } */ - strftime (s, m, "%ET", tp); /* { dg-warning "flag|modifier" "bad %ET" } */ - strftime (s, m, "%Eu", tp); /* { dg-warning "flag|modifier" "bad %Eu" } */ - strftime (s, m, "%EU", tp); /* { dg-warning "flag|modifier" "bad %EU" } */ - strftime (s, m, "%EV", tp); /* { dg-warning "flag|modifier" "bad %EV" } */ - strftime (s, m, "%Ew", tp); /* { dg-warning "flag|modifier" "bad %Ew" } */ - strftime (s, m, "%EW", tp); /* { dg-warning "flag|modifier" "bad %EW" } */ - strftime (s, m, "%Ez", tp); /* { dg-warning "flag|modifier" "bad %Ez" } */ - strftime (s, m, "%EZ", tp); /* { dg-warning "flag|modifier" "bad %EZ" } */ - strftime (s, m, "%E%", tp); /* { dg-warning "flag|modifier" "bad %E%" } */ - strftime (s, m, "%Oa", tp); /* { dg-warning "flag|modifier" "bad %Oa" } */ - strftime (s, m, "%OA", tp); /* { dg-warning "flag|modifier" "bad %OA" } */ - 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 *-*-* } 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 *-*-* } 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 *-*-* } 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" } */ - strftime (s, m, "%On", tp); /* { dg-warning "flag|modifier" "bad %On" } */ - strftime (s, m, "%Op", tp); /* { dg-warning "flag|modifier" "bad %Op" } */ - strftime (s, m, "%Or", tp); /* { dg-warning "flag|modifier" "bad %Or" } */ - strftime (s, m, "%OR", tp); /* { dg-warning "flag|modifier" "bad %OR" } */ - 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 *-*-* } 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" } */ - strftime (s, m, "%OZ", tp); /* { dg-warning "flag|modifier" "bad %OZ" } */ - strftime (s, m, "%O%", tp); /* { dg-warning "flag|modifier" "bad %O%" } */ -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/c99-strftime-2.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/c99-strftime-2.c deleted file mode 100644 index 747faa2c2..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/c99-strftime-2.c +++ /dev/null @@ -1,23 +0,0 @@ -/* Test for strftime formats. Rejection of extensions in pedantic mode. */ -/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ -/* { dg-do compile } */ -/* { dg-options "-std=iso9899:1999 -pedantic -Wformat" } */ - -#include "format.h" - -void -foo (char *s, size_t m, const struct tm *tp) -{ - /* %P is a lowercase version of %p. */ - strftime (s, m, "%P", tp); /* { dg-warning "C" "strftime %P" } */ - /* %k is %H but padded with a space rather than 0 if necessary. */ - strftime (s, m, "%k", tp); /* { dg-warning "C" "strftime %k" } */ - /* %l is %I but padded with a space rather than 0 if necessary. */ - strftime (s, m, "%l", tp); /* { dg-warning "C" "strftime %l" } */ - /* %s is the number of seconds since the Epoch. */ - strftime (s, m, "%s", tp); /* { dg-warning "C" "strftime %s" } */ - /* Extensions using %O already tested in c99-strftime-1.c. */ - /* Width and flags are GNU extensions for strftime. */ - strftime (s, m, "%20Y", tp); /* { dg-warning "C" "strftime width" } */ - strftime (s, m, "%^A", tp); /* { dg-warning "C" "strftime flags" } */ -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/cast-1.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/cast-1.c deleted file mode 100644 index 5d1d47709..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/cast-1.c +++ /dev/null @@ -1,16 +0,0 @@ -/* Test for strings cast through integer types: should not be treated - as format strings unless the types are of the same width as - pointers (intptr_t or similar). */ -/* Origin: Joseph Myers <joseph@codesourcery.com> */ -/* { dg-do compile } */ -/* { dg-options "-Wformat" } */ - -#include "format.h" - -void -f (int x) -{ - printf("%s", x); /* { dg-warning "format" } */ - printf((char *)(__UINTPTR_TYPE__)"%s", x); /* { dg-warning "format" } */ - printf((char *)(char)"%s", x); /* { dg-warning "cast from pointer to integer of different size" } */ -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/cmn-err-1.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/cmn-err-1.c deleted file mode 100644 index fd5ca59d0..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/cmn-err-1.c +++ /dev/null @@ -1,39 +0,0 @@ -/* { dg-do compile { target *-*-solaris2.* } } */ -/* { dg-options "-Wformat" } */ - -#include "format.h" - -void cmn_err_func (int level, char * format, ...) - __attribute__((format (cmn_err, 2, 3))); - -void cmn_err_func (int level, char * format, ...) -{ -} - -const char *string = "foo"; - -int main() -{ - int i = 1; - long l = 2; - llong ll = 3; - - cmn_err_func (0, "%s", string); - cmn_err_func (0, "%d %D %o %O %x %X %u", i, i, i, i, i, i, i); - cmn_err_func (0, "%ld %lD %lo %lO %lx %lX %lu", l, l, l, l, l, l, l); - cmn_err_func (0, "%lld %llD %llo %llO %llx %llX %llu", - ll, ll, ll, ll, ll, ll, ll); - cmn_err_func (0, "%b %s", i, "\01Foo", string); - cmn_err_func (0, "%p", string); - cmn_err_func (0, "%16b", i, "\01Foo"); - - cmn_err_func (0, "%i", i); /* { dg-warning "unknown|too many" } */ - cmn_err_func (0, "%d", l); /* { dg-warning "expects argument" } */ - cmn_err_func (0, "%b"); /* { dg-warning "'int'" } */ -/* { dg-warning "'char \\*'" "" { target *-*-solaris2.* } 32 } */ - cmn_err_func (0, "%b", i); /* { dg-warning "matching" } */ - cmn_err_func (0, "%b", i, i); /* { dg-warning "expects argument" } */ - cmn_err_func (0, "%b", string, i); /* { dg-warning "expects argument" } */ - cmn_err_func (0, "%p", 3); /* { dg-warning "expects argument" } */ - return 0; -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/dfp-printf-1.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/dfp-printf-1.c deleted file mode 100644 index 4453ad192..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/dfp-printf-1.c +++ /dev/null @@ -1,123 +0,0 @@ -/* Test for printf formats for Decimal Floating Point types. */ - -/* { dg-do compile } */ -/* { dg-require-effective-target dfp } */ -/* { dg-options "-Wformat" } */ -/* { dg-skip-if "No scanf/printf dfp support" { *-*-mingw* } { "*" } { "" } } */ - -extern int printf (const char *restrict, ...); - -void -foo (_Decimal32 x, _Decimal64 y, _Decimal128 z, int i, unsigned int j, - double d, char *p) -{ - /* See ISO/IEC DTR 24732 subclause 9.3 (currently Working Draft 5 from - 2005-03-06). */ - /* Formatted input/output specifiers. */ - - /* Check lack of warnings for valid usage. */ - - printf ("%Hf\n", x); - printf ("%HF\n", x); - printf ("%He\n", x); - printf ("%HE\n", x); - printf ("%Hg\n", x); - printf ("%HG\n", x); - - printf ("%Df\n", y); - printf ("%DF\n", y); - printf ("%De\n", y); - printf ("%DE\n", y); - printf ("%Dg\n", y); - printf ("%DG\n", y); - - printf ("%DDf\n", z); - printf ("%DDF\n", z); - printf ("%DDe\n", z); - printf ("%DDE\n", z); - printf ("%DDg\n", z); - printf ("%DDG\n", z); - - printf ("%DG%DDE%HF%DDe%He%HE%DF%DDF%De%DDG%HG%Df%Hg%DE%DDf%Dg%DDg%Hf\n", - y, z, x, z, x, x, y, z, y, z, x, y, x, y, z, y, z, x); - - /* Check warnings for type mismatches. */ - - printf ("%Hf\n", y); /* { dg-warning "expects argument" "bad use of %H" } */ - printf ("%HF\n", y); /* { dg-warning "expects argument" "bad use of %H" } */ - printf ("%He\n", y); /* { dg-warning "expects argument" "bad use of %H" } */ - printf ("%HE\n", y); /* { dg-warning "expects argument" "bad use of %H" } */ - printf ("%Hg\n", y); /* { dg-warning "expects argument" "bad use of %H" } */ - printf ("%HG\n", y); /* { dg-warning "expects argument" "bad use of %H" } */ - printf ("%Hf\n", z); /* { dg-warning "expects argument" "bad use of %H" } */ - printf ("%HF\n", z); /* { dg-warning "expects argument" "bad use of %H" } */ - printf ("%He\n", z); /* { dg-warning "expects argument" "bad use of %H" } */ - printf ("%HE\n", z); /* { dg-warning "expects argument" "bad use of %H" } */ - printf ("%Hg\n", z); /* { dg-warning "expects argument" "bad use of %H" } */ - printf ("%HG\n", z); /* { dg-warning "expects argument" "bad use of %H" } */ - - printf ("%Df\n", x); /* { dg-warning "expects argument" "bad use of %D" } */ - printf ("%DF\n", x); /* { dg-warning "expects argument" "bad use of %D" } */ - printf ("%De\n", x); /* { dg-warning "expects argument" "bad use of %D" } */ - printf ("%DE\n", x); /* { dg-warning "expects argument" "bad use of %D" } */ - printf ("%Dg\n", x); /* { dg-warning "expects argument" "bad use of %D" } */ - printf ("%DG\n", x); /* { dg-warning "expects argument" "bad use of %D" } */ - printf ("%Df\n", z); /* { dg-warning "expects argument" "bad use of %D" } */ - printf ("%DF\n", z); /* { dg-warning "expects argument" "bad use of %D" } */ - printf ("%De\n", z); /* { dg-warning "expects argument" "bad use of %D" } */ - printf ("%DE\n", z); /* { dg-warning "expects argument" "bad use of %D" } */ - printf ("%Dg\n", z); /* { dg-warning "expects argument" "bad use of %D" } */ - printf ("%DG\n", z); /* { dg-warning "expects argument" "bad use of %D" } */ - - printf ("%DDf\n", x); /* { dg-warning "expects argument" "bad use of %DD" } */ - printf ("%DDF\n", x); /* { dg-warning "expects argument" "bad use of %DD" } */ - printf ("%DDe\n", x); /* { dg-warning "expects argument" "bad use of %DD" } */ - printf ("%DDE\n", x); /* { dg-warning "expects argument" "bad use of %DD" } */ - printf ("%DDg\n", x); /* { dg-warning "expects argument" "bad use of %DD" } */ - printf ("%DDG\n", x); /* { dg-warning "expects argument" "bad use of %DD" } */ - printf ("%DDf\n", y); /* { dg-warning "expects argument" "bad use of %DD" } */ - printf ("%DDF\n", y); /* { dg-warning "expects argument" "bad use of %DD" } */ - printf ("%DDe\n", y); /* { dg-warning "expects argument" "bad use of %DD" } */ - printf ("%DDE\n", y); /* { dg-warning "expects argument" "bad use of %DD" } */ - printf ("%DDg\n", y); /* { dg-warning "expects argument" "bad use of %DD" } */ - printf ("%DDG\n", y); /* { dg-warning "expects argument" "bad use of %DD" } */ - - /* Check for warnings for bad use of H, D, and DD length specifiers. */ - - printf ("%Hd\n", i); /* { dg-warning "length" "bad use of %H" } */ - printf ("%Hi\n", i); /* { dg-warning "length" "bad use of %H" } */ - printf ("%Ho\n", j); /* { dg-warning "length" "bad use of %H" } */ - printf ("%Hu\n", j); /* { dg-warning "length" "bad use of %H" } */ - printf ("%Hx\n", j); /* { dg-warning "length" "bad use of %H" } */ - printf ("%HX\n", j); /* { dg-warning "length" "bad use of %H" } */ - printf ("%Ha\n", d); /* { dg-warning "length" "bad use of %H" } */ - printf ("%HA\n", d); /* { dg-warning "length" "bad use of %H" } */ - printf ("%Hc\n", i); /* { dg-warning "length" "bad use of %H" } */ - printf ("%Hs\n", p); /* { dg-warning "length" "bad use of %H" } */ - printf ("%Hp\n", p); /* { dg-warning "length" "bad use of %H" } */ - printf ("%Hn\n", p); /* { dg-warning "length" "bad use of %H" } */ - - /* Sanity checks for flags, field width, and precision in formats for - DFP types. */ - - printf ("%-Hf\n", x); - printf ("%+HF\n", x); - printf ("% He\n", x); - printf ("%#HE\n", x); - printf ("%0Hg\n", x); - printf ("%#0HG\n", x); - - printf ("%0#Df\n", y); - printf ("%0DF\n", y); - printf ("%#De\n", y); - printf ("%-#DE\n", y); - printf ("%-#0Dg\n", y); /* { dg-warning "flag ignored" "ignore flag" } */ - printf ("%0+ DG\n", y); /* { dg-warning "flag ignored" "ignore flag" } */ - - printf ("%DDf\n", z); - printf ("%0DDF\n", z); - printf ("%#0DDe\n", z); - printf ("%+DDE\n", z); - printf ("%0-#DDg\n", z); /* { dg-warning "flag ignored" "ignore flag" } */ - printf ("% DDG\n", z); -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/dfp-scanf-1.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/dfp-scanf-1.c deleted file mode 100644 index ffa12a803..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/dfp-scanf-1.c +++ /dev/null @@ -1,99 +0,0 @@ -/* Test for scanf formats for Decimal Floating Point types. */ - -/* { dg-do compile } */ -/* { dg-require-effective-target dfp } */ -/* { dg-options "-Wformat" } */ -/* { dg-skip-if "No scanf/printf dfp support" { *-*-mingw* } } */ - -#include "format.h" - -void -voo (_Decimal32 *x, _Decimal64 *y, _Decimal128 *z, int *i, unsigned int *j, - double *d, char **p) -{ - /* See ISO/IEC DTR 24732 subclause 9.3 (currently Working Draft 5 from - 2005-03-06). */ - /* Formatted input/output specifiers. */ - - /* Check lack of warnings for valid usage. */ - - scanf ("%Hf", x); - scanf ("%HF", x); - scanf ("%He", x); - scanf ("%HE", x); - scanf ("%Hg", x); - scanf ("%HG", x); - - scanf ("%Df", y); - scanf ("%DF", y); - scanf ("%De", y); - scanf ("%DE", y); - scanf ("%Dg", y); - scanf ("%DG", y); - - scanf ("%DDf", z); - scanf ("%DDF", z); - scanf ("%DDe", z); - scanf ("%DDE", z); - scanf ("%DDg", z); - scanf ("%DDG", z); - - scanf ("%DG%DDE%HF%DDe%He%HE%DF%DDF%De%DDG%HG%Df%Hg%DE%DDf%Dg%DDg%Hf\n", - y, z, x, z, x, x, y, z, y, z, x, y, x, y, z, y, z, x); - - /* Check warnings for type mismatches. */ - - scanf ("%Hf", y); /* { dg-warning "expects argument" "bad use of %H" } */ - scanf ("%HF", y); /* { dg-warning "expects argument" "bad use of %H" } */ - scanf ("%He", y); /* { dg-warning "expects argument" "bad use of %H" } */ - scanf ("%HE", y); /* { dg-warning "expects argument" "bad use of %H" } */ - scanf ("%Hg", y); /* { dg-warning "expects argument" "bad use of %H" } */ - scanf ("%HG", y); /* { dg-warning "expects argument" "bad use of %H" } */ - scanf ("%Hf", z); /* { dg-warning "expects argument" "bad use of %H" } */ - scanf ("%HF", z); /* { dg-warning "expects argument" "bad use of %H" } */ - scanf ("%He", z); /* { dg-warning "expects argument" "bad use of %H" } */ - scanf ("%HE", z); /* { dg-warning "expects argument" "bad use of %H" } */ - scanf ("%Hg", z); /* { dg-warning "expects argument" "bad use of %H" } */ - scanf ("%HG", z); /* { dg-warning "expects argument" "bad use of %H" } */ - - scanf ("%Df", x); /* { dg-warning "expects argument" "bad use of %D" } */ - scanf ("%DF", x); /* { dg-warning "expects argument" "bad use of %D" } */ - scanf ("%De", x); /* { dg-warning "expects argument" "bad use of %D" } */ - scanf ("%DE", x); /* { dg-warning "expects argument" "bad use of %D" } */ - scanf ("%Dg", x); /* { dg-warning "expects argument" "bad use of %D" } */ - scanf ("%DG", x); /* { dg-warning "expects argument" "bad use of %D" } */ - scanf ("%Df", z); /* { dg-warning "expects argument" "bad use of %D" } */ - scanf ("%DF", z); /* { dg-warning "expects argument" "bad use of %D" } */ - scanf ("%De", z); /* { dg-warning "expects argument" "bad use of %D" } */ - scanf ("%DE", z); /* { dg-warning "expects argument" "bad use of %D" } */ - scanf ("%Dg", z); /* { dg-warning "expects argument" "bad use of %D" } */ - scanf ("%DG", z); /* { dg-warning "expects argument" "bad use of %D" } */ - - scanf ("%DDf", x); /* { dg-warning "expects argument" "bad use of %DD" } */ - scanf ("%DDF", x); /* { dg-warning "expects argument" "bad use of %DD" } */ - scanf ("%DDe", x); /* { dg-warning "expects argument" "bad use of %DD" } */ - scanf ("%DDE", x); /* { dg-warning "expects argument" "bad use of %DD" } */ - scanf ("%DDg", x); /* { dg-warning "expects argument" "bad use of %DD" } */ - scanf ("%DDG", x); /* { dg-warning "expects argument" "bad use of %DD" } */ - scanf ("%DDf", y); /* { dg-warning "expects argument" "bad use of %DD" } */ - scanf ("%DDF", y); /* { dg-warning "expects argument" "bad use of %DD" } */ - scanf ("%DDe", y); /* { dg-warning "expects argument" "bad use of %DD" } */ - scanf ("%DDE", y); /* { dg-warning "expects argument" "bad use of %DD" } */ - scanf ("%DDg", y); /* { dg-warning "expects argument" "bad use of %DD" } */ - scanf ("%DDG", y); /* { dg-warning "expects argument" "bad use of %DD" } */ - - /* Check for warnings for bad use of H, D, and DD length specifiers. */ - - scanf ("%Hd\n", i); /* { dg-warning "length" "bad use of %H" } */ - scanf ("%Hi\n", i); /* { dg-warning "length" "bad use of %H" } */ - scanf ("%Ho\n", j); /* { dg-warning "length" "bad use of %H" } */ - scanf ("%Hu\n", j); /* { dg-warning "length" "bad use of %H" } */ - scanf ("%Hx\n", j); /* { dg-warning "length" "bad use of %H" } */ - scanf ("%HX\n", j); /* { dg-warning "length" "bad use of %H" } */ - scanf ("%Ha\n", d); /* { dg-warning "length" "bad use of %H" } */ - scanf ("%HA\n", d); /* { dg-warning "length" "bad use of %H" } */ - scanf ("%Hc\n", i); /* { dg-warning "length" "bad use of %H" } */ - scanf ("%Hs\n", p); /* { dg-warning "length" "bad use of %H" } */ - scanf ("%Hp\n", p); /* { dg-warning "length" "bad use of %H" } */ - scanf ("%Hn\n", p); /* { dg-warning "length" "bad use of %H" } */ -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/diag-1.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/diag-1.c deleted file mode 100644 index 998e35b9b..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/diag-1.c +++ /dev/null @@ -1,18 +0,0 @@ -/* Test for format diagnostics. */ -/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ -/* { dg-do compile } */ -/* { dg-options "-std=gnu99 -Wformat" } */ - -#include "format.h" - -void -foo (double d) -{ - /* This should get a message referring to `hh', not to `H'. */ - printf ("%hhf", d); /* { dg-warning "hh" "%hhf warning" } */ - /* This should get a message referring to `ll', not to `q'. */ - printf ("%llf", d); /* { dg-warning "ll" "%llf warning" } */ - /* This should get a message referring to 'size_t', not to - 'unsigned int' or similar. */ - printf ("%zu", d); /* { dg-warning "size_t" "size_t format warning" } */ -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/diag-2.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/diag-2.c deleted file mode 100644 index e7578d3f0..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/diag-2.c +++ /dev/null @@ -1,13 +0,0 @@ -/* Test for format diagnostics. Proper type names (bug 1027). */ -/* Origin: Joseph Myers <jsm@polyomino.org.uk> */ -/* { dg-do compile } */ -/* { dg-options "-std=gnu99 -Wformat" } */ - -#include "format.h" - -void -foo (double d) -{ - printf ("%s", &d); /* { dg-warning "char \\*" "correct arg type" } */ - scanf ("%zu", &d); /* { dg-warning "size_t \\*" "correct arg type" } */ -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/errmk-1.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/errmk-1.c deleted file mode 100644 index 77630ab0a..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/errmk-1.c +++ /dev/null @@ -1,12 +0,0 @@ -/* Test for format checking not giving tree checking errors. */ -/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ -/* { dg-do compile } */ -/* { dg-options "-Wformat" } */ - -#include "format.h" - -void -foo (int t) -{ - printf ("%*d", u, t); /* { dg-error "undeclared|function" "u undeclared error" } */ -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ext-1.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ext-1.c deleted file mode 100644 index 3b020892a..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ext-1.c +++ /dev/null @@ -1,126 +0,0 @@ -/* Test for format extensions beyond the C standard and X/Open standard. - Test for printf formats. -*/ -/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ -/* { dg-do compile } */ -/* { dg-options "-std=gnu99 -Wformat" } */ - -#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, - unsigned long long int ull, int i, unsigned int u, double d, - char *s, void *p, wchar_t *ls, wint_t lc, int *n, long int l) -{ - /* As an extension, GCC allows the BSD length "q" for integer formats. - This is largely obsoleted in C99 by %j, %ll and PRId64. - */ - printf ("%qd%qi%qo%qu%qx%qX%qn", q, q, uq, uq, uq, uq, qn); - printf ("%qf", d); /* { dg-warning "length" "bad use of %q" } */ - printf ("%qF", d); /* { dg-warning "length" "bad use of %q" } */ - printf ("%qe", d); /* { dg-warning "length" "bad use of %q" } */ - printf ("%qE", d); /* { dg-warning "length" "bad use of %q" } */ - printf ("%qg", d); /* { dg-warning "length" "bad use of %q" } */ - printf ("%qG", d); /* { dg-warning "length" "bad use of %q" } */ - printf ("%qa", d); /* { dg-warning "length" "bad use of %q" } */ - printf ("%qA", d); /* { dg-warning "length" "bad use of %q" } */ - printf ("%qc", i); /* { dg-warning "length" "bad use of %q" } */ - printf ("%qs", s); /* { dg-warning "length" "bad use of %q" } */ - printf ("%qp", p); /* { dg-warning "length" "bad use of %q" } */ - printf ("%qC", lc); /* { dg-warning "length" "bad use of %q" } */ - printf ("%qS", ls); /* { dg-warning "length" "bad use of %q" } */ - /* With a bad length GCC wants some argument, any argument, - to devour with the format conversion, as a synchronisation heuristic. - This may get improved later. - */ - printf ("%qm", i); /* { dg-warning "length" "bad use of %q" } */ - /* As an extension, GCC allows the length "Z" as a synonym for "z". - This was an extension predating C99 which should now be considered - deprecated; use the standard "z" instead. - */ - printf ("%Zd%Zi%Zo%Zu%Zx%ZX", z, z, z, z, z, z); - printf ("%Zn", zn); - printf ("%Zf", d); /* { dg-warning "length" "bad use of %Z" } */ - printf ("%ZF", d); /* { dg-warning "length" "bad use of %Z" } */ - printf ("%Ze", d); /* { dg-warning "length" "bad use of %Z" } */ - printf ("%ZE", d); /* { dg-warning "length" "bad use of %Z" } */ - printf ("%Zg", d); /* { dg-warning "length" "bad use of %Z" } */ - printf ("%ZG", d); /* { dg-warning "length" "bad use of %Z" } */ - printf ("%Za", d); /* { dg-warning "length" "bad use of %Z" } */ - printf ("%ZA", d); /* { dg-warning "length" "bad use of %Z" } */ - printf ("%Zc", i); /* { dg-warning "length" "bad use of %Z" } */ - printf ("%Zs", s); /* { dg-warning "length" "bad use of %Z" } */ - printf ("%Zp", p); /* { dg-warning "length" "bad use of %Z" } */ - printf ("%ZC", lc); /* { dg-warning "length" "bad use of %Z" } */ - printf ("%ZS", ls); /* { dg-warning "length" "bad use of %Z" } */ - printf ("%Zm", i); /* { dg-warning "length" "bad use of %Z" } */ - /* As an extension, GCC allows the length "L" on integer formats - (but not %n) as a synonym for "ll". - This should be considered deprecated. - */ - printf ("%Ld%Li%Lo%Lu%Lx%LX", ll, ll, ull, ull, ull, ull); - /* As an extension, derived from syslog, GCC allows the conversion - specifier "m" for formatting strerror(errno). This may be used - with width, precision and the "-" flag, the same as %s. - */ - printf ("%m%3m%.4m%5.6m"); - printf ("%*m", i); - printf ("%.*m", i); - printf ("%*.*m", i, i); - printf ("%3.*m", i); - printf ("%*.4m", i); - printf ("%-m"); - printf ("%+m"); /* { dg-warning "flag" "bad %+m" } */ - printf ("% m"); /* { dg-warning "flag" "bad % m" } */ - printf ("%#m"); /* { dg-warning "flag" "bad %#m" } */ - printf ("%0m"); /* { dg-warning "flag" "bad %0m" } */ - printf ("%'m"); /* { dg-warning "flag" "bad %'m" } */ - printf ("%hm", i); /* { dg-warning "length" "bad %hm" } */ - printf ("%hhm", i); /* { dg-warning "length" "bad %hhm" } */ - printf ("%lm", i); /* { dg-warning "length" "bad %lm" } */ - printf ("%llm", i); /* { dg-warning "length" "bad %llm" } */ - printf ("%jm", i); /* { dg-warning "length" "bad %jm" } */ - printf ("%zm", i); /* { dg-warning "length" "bad %zm" } */ - printf ("%tm", i); /* { dg-warning "length" "bad %tm" } */ - printf ("%Lm", i); /* { dg-warning "length" "bad %Lm" } */ - printf ("%qm", i); /* { dg-warning "length" "bad %qm" } */ - printf ("%Zm", i); /* { dg-warning "length" "bad %Zm" } */ - /* It should be OK to mix %m formats with $ operand number formats. */ - printf ("%2$ld%m%1$d", i, l); - /* Likewise, %m formats with width and precision should not have an - operand number for the %m itself. - */ - printf ("%*2$.*1$m", i, i); - printf ("%1$*2$.*1$m", i, i); /* { dg-warning "no argument" "printf %1\$m" } */ - /* As an extension, glibc includes the "I" flag for decimal - formats, to output using the locale's digits (e.g. in Arabic). - In GCC, we require this to be in the standard place for flags, though - glibc allows it also after width or precision. - */ - printf ("%Id%Ii%Iu", i, i, u); - printf ("%Io", u); /* { dg-warning "flag" "bad use of I flag" } */ - printf ("%Ix", u); /* { dg-warning "flag" "bad use of I flag" } */ - printf ("%IX", u); /* { dg-warning "flag" "bad use of I flag" } */ - printf ("%In", n); /* { dg-warning "flag" "bad use of I flag" } */ - printf ("%If", d); - printf ("%IF", d); - printf ("%Ie", d); - printf ("%IE", d); - printf ("%Ig", d); - printf ("%IG", d); - printf ("%Ia", d); /* { dg-warning "flag" "bad use of I flag" } */ - printf ("%IA", d); /* { dg-warning "flag" "bad use of I flag" } */ - printf ("%Ic", i); /* { dg-warning "flag" "bad use of I flag" } */ - printf ("%Is", s); /* { dg-warning "flag" "bad use of I flag" } */ - printf ("%Ip", p); /* { dg-warning "flag" "bad use of I flag" } */ - printf ("%IC", lc); /* { dg-warning "flag" "bad use of I flag" } */ - printf ("%IS", ls); /* { dg-warning "flag" "bad use of I flag" } */ - printf ("%Im"); /* { dg-warning "flag" "bad use of I flag" } */ - - /* As an extension, GCC does format checking on "unlocked" - i.e. thread unsafe versions of these functions. */ - fprintf_unlocked (stdout, "%d", i); - fprintf_unlocked (stdout, "%ld", i); /* { dg-warning "format" "fprintf_unlocked" } */ - printf_unlocked ("%d", i); - printf_unlocked ("%ld", i); /* { dg-warning "format" "printf_unlocked" } */ -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ext-2.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ext-2.c deleted file mode 100644 index 466991b59..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ext-2.c +++ /dev/null @@ -1,73 +0,0 @@ -/* Test for format extensions beyond the C standard and X/Open standard. - Test for scanf formats. -*/ -/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ -/* { dg-do compile } */ -/* { dg-options "-std=gnu99 -Wformat" } */ - -#include "format.h" - -void -foo (quad_t *qp, u_quad_t *uqp, quad_t *qn, long long int *llp, - unsigned long long int *ullp, float *fp, char *s, void **pp, wchar_t *ls, - int *ip, unsigned int *up) -{ - /* As an extension, GCC allows the BSD length "q" for integer formats. - This is largely obsoleted in C99 by %j, %ll and SCNd64. - */ - scanf ("%qd%qi%qo%qu%qx%qX%qn", qp, qp, uqp, uqp, uqp, uqp, qn); - scanf ("%qf", fp); /* { dg-warning "length" "bad use of %q" } */ - scanf ("%qF", fp); /* { dg-warning "length" "bad use of %q" } */ - scanf ("%qe", fp); /* { dg-warning "length" "bad use of %q" } */ - scanf ("%qE", fp); /* { dg-warning "length" "bad use of %q" } */ - scanf ("%qg", fp); /* { dg-warning "length" "bad use of %q" } */ - scanf ("%qG", fp); /* { dg-warning "length" "bad use of %q" } */ - scanf ("%qa", fp); /* { dg-warning "length" "bad use of %q" } */ - scanf ("%qA", fp); /* { dg-warning "length" "bad use of %q" } */ - scanf ("%qs", s); /* { dg-warning "length" "bad use of %q" } */ - scanf ("%q[abc]", s); /* { dg-warning "length" "bad use of %q" } */ - scanf ("%qc", s); /* { dg-warning "length" "bad use of %q" } */ - scanf ("%qp", pp); /* { dg-warning "length" "bad use of %q" } */ - scanf ("%qC", ls); /* { dg-warning "length" "bad use of %q" } */ - scanf ("%qS", ls); /* { dg-warning "length" "bad use of %q" } */ - /* As an extension, GCC allows the length "L" on integer formats - (but not %n) as a synonym for "ll". - This should be considered deprecated. - */ - scanf ("%Ld%Li%Lo%Lu%Lx%LX", llp, llp, ullp, ullp, ullp, ullp); - /* glibc also supports flags ' and I on scanf formats. The ' flag applies - to all formats scanning decimal values; the I flag only to decimal integer - formats. - */ - scanf ("%'d%'i%'u%'a%'A%'e%'E%'f%'F%'g%'G", ip, ip, up, fp, fp, fp, fp, - fp, fp, fp, fp); - scanf ("%'o", up); /* { dg-warning "flag" "bad use of ' flag" } */ - scanf ("%'x", up); /* { dg-warning "flag" "bad use of ' flag" } */ - scanf ("%'X", up); /* { dg-warning "flag" "bad use of ' flag" } */ - scanf ("%'n", ip); /* { dg-warning "flag" "bad use of ' flag" } */ - scanf ("%'s", s); /* { dg-warning "flag" "bad use of ' flag" } */ - scanf ("%'[abc]", s); /* { dg-warning "flag" "bad use of ' flag" } */ - scanf ("%'c", s); /* { dg-warning "flag" "bad use of ' flag" } */ - scanf ("%'p", pp); /* { dg-warning "flag" "bad use of ' flag" } */ - scanf ("%'C", ls); /* { dg-warning "flag" "bad use of ' flag" } */ - scanf ("%'S", ls); /* { dg-warning "flag" "bad use of ' flag" } */ - scanf ("%Id%Ii%Iu", ip, ip, up); - scanf ("%Ia", fp); /* { dg-warning "flag" "bad use of I flag" } */ - scanf ("%IA", fp); /* { dg-warning "flag" "bad use of I flag" } */ - scanf ("%Ie", fp); /* { dg-warning "flag" "bad use of I flag" } */ - scanf ("%IE", fp); /* { dg-warning "flag" "bad use of I flag" } */ - scanf ("%If", fp); /* { dg-warning "flag" "bad use of I flag" } */ - scanf ("%IF", fp); /* { dg-warning "flag" "bad use of I flag" } */ - scanf ("%Ig", fp); /* { dg-warning "flag" "bad use of I flag" } */ - scanf ("%IG", fp); /* { dg-warning "flag" "bad use of I flag" } */ - scanf ("%Io", up); /* { dg-warning "flag" "bad use of I flag" } */ - scanf ("%Ix", up); /* { dg-warning "flag" "bad use of I flag" } */ - scanf ("%IX", up); /* { dg-warning "flag" "bad use of I flag" } */ - scanf ("%In", ip); /* { dg-warning "flag" "bad use of I flag" } */ - scanf ("%Is", s); /* { dg-warning "flag" "bad use of I flag" } */ - scanf ("%I[abc]", s); /* { dg-warning "flag" "bad use of I flag" } */ - scanf ("%Ic", s); /* { dg-warning "flag" "bad use of I flag" } */ - scanf ("%Ip", pp); /* { dg-warning "flag" "bad use of I flag" } */ - scanf ("%IC", ls); /* { dg-warning "flag" "bad use of I flag" } */ - scanf ("%IS", ls); /* { dg-warning "flag" "bad use of I flag" } */ -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ext-3.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ext-3.c deleted file mode 100644 index 937e11212..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ext-3.c +++ /dev/null @@ -1,216 +0,0 @@ -/* Test for format extensions beyond the C standard and X/Open standard. - Test for strftime formats. -*/ -/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ -/* { dg-do compile } */ -/* { dg-options "-std=gnu99 -Wformat -Wformat-y2k" } */ - -#include "format.h" - -void -foo (char *s, size_t m, const struct tm *tp) -{ - /* GCC accepts the "-", "_" and "0" flags to control padding on numeric - formats. It also accepts width on these formats. - */ - /* Basic tests of parts on their own. */ - strftime (s, m, "%5C%-C%_C%0C", tp); - /* Correct usages. */ - strftime (s, m, "%-5C%_5C%05C%-5d%_5d%05d%-5e%_5e%05e%-5G%_5G%05G", tp); - strftime (s, m, "%-5H%_5H%05H%-5I%_5I%05I%-5j%_5j%05j%-5m%_5m%05m", tp); - strftime (s, m, "%-5M%_5M%05M%-5S%_5S%05S%-5u%_5u%05u%-5U%_5U%05U", tp); - strftime (s, m, "%-5V%_5V%05V%-5w%_5w%05w%-5W%_5W%05W%-5Y%_5Y%05Y", tp); - /* Correct usages with GNU extension conversion characters. */ - strftime (s, m, "%-5k%_5k%05k%-5l%_5l%05l%-20s%_20s%020s", tp); - /* Correct usages with Y2K problems. */ - strftime (s, m, "%-5g%_5g%05g%-5y%_5y%05y", tp); /* { dg-warning "only last 2" "2-digit year" } */ - /* Incorrect usages. */ - strftime (s, m, "%5a", tp); /* { dg-warning "width" "bad %a" } */ - strftime (s, m, "%-a", tp); /* { dg-warning "flag" "bad %a" } */ - strftime (s, m, "%_a", tp); /* { dg-warning "flag" "bad %a" } */ - strftime (s, m, "%0a", tp); /* { dg-warning "flag" "bad %a" } */ - strftime (s, m, "%5A", tp); /* { dg-warning "width" "bad %A" } */ - strftime (s, m, "%-A", tp); /* { dg-warning "flag" "bad %A" } */ - strftime (s, m, "%_A", tp); /* { dg-warning "flag" "bad %A" } */ - strftime (s, m, "%0A", tp); /* { dg-warning "flag" "bad %A" } */ - strftime (s, m, "%5b", tp); /* { dg-warning "width" "bad %b" } */ - strftime (s, m, "%-b", tp); /* { dg-warning "flag" "bad %b" } */ - strftime (s, m, "%_b", tp); /* { dg-warning "flag" "bad %b" } */ - strftime (s, m, "%0b", tp); /* { dg-warning "flag" "bad %b" } */ - strftime (s, m, "%5B", tp); /* { dg-warning "width" "bad %B" } */ - strftime (s, m, "%-B", tp); /* { dg-warning "flag" "bad %B" } */ - strftime (s, m, "%_B", tp); /* { dg-warning "flag" "bad %B" } */ - strftime (s, m, "%0B", tp); /* { dg-warning "flag" "bad %B" } */ - strftime (s, m, "%5F", tp); /* { dg-warning "width" "bad %F" } */ - strftime (s, m, "%-F", tp); /* { dg-warning "flag" "bad %F" } */ - strftime (s, m, "%_F", tp); /* { dg-warning "flag" "bad %F" } */ - strftime (s, m, "%0F", tp); /* { dg-warning "flag" "bad %F" } */ - strftime (s, m, "%5h", tp); /* { dg-warning "width" "bad %h" } */ - strftime (s, m, "%-h", tp); /* { dg-warning "flag" "bad %h" } */ - strftime (s, m, "%_h", tp); /* { dg-warning "flag" "bad %h" } */ - strftime (s, m, "%0h", tp); /* { dg-warning "flag" "bad %h" } */ - strftime (s, m, "%5n", tp); /* { dg-warning "width" "bad %n" } */ - strftime (s, m, "%-n", tp); /* { dg-warning "flag" "bad %n" } */ - strftime (s, m, "%_n", tp); /* { dg-warning "flag" "bad %n" } */ - strftime (s, m, "%0n", tp); /* { dg-warning "flag" "bad %n" } */ - strftime (s, m, "%5p", tp); /* { dg-warning "width" "bad %p" } */ - strftime (s, m, "%-p", tp); /* { dg-warning "flag" "bad %p" } */ - strftime (s, m, "%_p", tp); /* { dg-warning "flag" "bad %p" } */ - strftime (s, m, "%0p", tp); /* { dg-warning "flag" "bad %p" } */ - strftime (s, m, "%5r", tp); /* { dg-warning "width" "bad %r" } */ - strftime (s, m, "%-r", tp); /* { dg-warning "flag" "bad %r" } */ - strftime (s, m, "%_r", tp); /* { dg-warning "flag" "bad %r" } */ - strftime (s, m, "%0r", tp); /* { dg-warning "flag" "bad %r" } */ - strftime (s, m, "%5R", tp); /* { dg-warning "width" "bad %R" } */ - strftime (s, m, "%-R", tp); /* { dg-warning "flag" "bad %R" } */ - strftime (s, m, "%_R", tp); /* { dg-warning "flag" "bad %R" } */ - strftime (s, m, "%0R", tp); /* { dg-warning "flag" "bad %R" } */ - strftime (s, m, "%5t", tp); /* { dg-warning "width" "bad %t" } */ - strftime (s, m, "%-t", tp); /* { dg-warning "flag" "bad %t" } */ - strftime (s, m, "%_t", tp); /* { dg-warning "flag" "bad %t" } */ - strftime (s, m, "%0t", tp); /* { dg-warning "flag" "bad %t" } */ - strftime (s, m, "%5T", tp); /* { dg-warning "width" "bad %T" } */ - strftime (s, m, "%-T", tp); /* { dg-warning "flag" "bad %T" } */ - strftime (s, m, "%_T", tp); /* { dg-warning "flag" "bad %T" } */ - strftime (s, m, "%0T", tp); /* { dg-warning "flag" "bad %T" } */ - strftime (s, m, "%5X", tp); /* { dg-warning "width" "bad %X" } */ - 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" } */ - strftime (s, m, "%5z", tp); /* { dg-warning "width" "bad %z" } */ - strftime (s, m, "%-z", tp); /* { dg-warning "flag" "bad %z" } */ - strftime (s, m, "%_z", tp); /* { dg-warning "flag" "bad %z" } */ - strftime (s, m, "%0z", tp); /* { dg-warning "flag" "bad %z" } */ - strftime (s, m, "%5Z", tp); /* { dg-warning "width" "bad %Z" } */ - strftime (s, m, "%-Z", tp); /* { dg-warning "flag" "bad %Z" } */ - strftime (s, m, "%_Z", tp); /* { dg-warning "flag" "bad %Z" } */ - strftime (s, m, "%0Z", tp); /* { dg-warning "flag" "bad %Z" } */ - /* Incorrect usages with Y2K problems. */ - strftime (s, m, "%5c", tp); /* { dg-warning "width" "bad %c" } */ - strftime (s, m, "%-c", tp); /* { dg-warning "flag" "bad %c" } */ - strftime (s, m, "%_c", tp); /* { dg-warning "flag" "bad %c" } */ - strftime (s, m, "%0c", tp); /* { dg-warning "flag" "bad %c" } */ - strftime (s, m, "%5D", tp); /* { dg-warning "width" "bad %D" } */ - strftime (s, m, "%-D", tp); /* { dg-warning "flag" "bad %D" } */ - strftime (s, m, "%_D", tp); /* { dg-warning "flag" "bad %D" } */ - strftime (s, m, "%0D", tp); /* { dg-warning "flag" "bad %D" } */ - strftime (s, m, "%5x", tp); /* { dg-warning "width" "bad %x" } */ - 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 } */ - /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 96 } */ - /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 97 } */ - /* { 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 } */ - /* 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" } */ - strftime (s, m, "%_P", tp); /* { dg-warning "flag" "bad %P" } */ - strftime (s, m, "%0P", tp); /* { dg-warning "flag" "bad %P" } */ - /* The "^" and "#" flags control the case of the output. - ^ (uppercase) makes sense on aAbBhZ; # (change case) makes sense - on the same and on p. - */ - strftime (s, m, "%^a%#a%^A%#A%^b%#b%^B%#B%^h%#h%^Z%#Z%#p", tp); - /* Bad usages. */ - strftime (s, m, "%^C", tp); /* { dg-warning "flag" "bad %C" } */ - strftime (s, m, "%#C", tp); /* { dg-warning "flag" "bad %C" } */ - strftime (s, m, "%^d", tp); /* { dg-warning "flag" "bad %d" } */ - strftime (s, m, "%#d", tp); /* { dg-warning "flag" "bad %d" } */ - strftime (s, m, "%^e", tp); /* { dg-warning "flag" "bad %e" } */ - strftime (s, m, "%#e", tp); /* { dg-warning "flag" "bad %e" } */ - strftime (s, m, "%^F", tp); /* { dg-warning "flag" "bad %F" } */ - strftime (s, m, "%#F", tp); /* { dg-warning "flag" "bad %F" } */ - strftime (s, m, "%^G", tp); /* { dg-warning "flag" "bad %G" } */ - strftime (s, m, "%#G", tp); /* { dg-warning "flag" "bad %G" } */ - strftime (s, m, "%^H", tp); /* { dg-warning "flag" "bad %H" } */ - strftime (s, m, "%#H", tp); /* { dg-warning "flag" "bad %H" } */ - strftime (s, m, "%^I", tp); /* { dg-warning "flag" "bad %I" } */ - strftime (s, m, "%#I", tp); /* { dg-warning "flag" "bad %I" } */ - strftime (s, m, "%^j", tp); /* { dg-warning "flag" "bad %j" } */ - strftime (s, m, "%#j", tp); /* { dg-warning "flag" "bad %j" } */ - strftime (s, m, "%^m", tp); /* { dg-warning "flag" "bad %m" } */ - strftime (s, m, "%#m", tp); /* { dg-warning "flag" "bad %m" } */ - strftime (s, m, "%^M", tp); /* { dg-warning "flag" "bad %M" } */ - strftime (s, m, "%#M", tp); /* { dg-warning "flag" "bad %M" } */ - strftime (s, m, "%^n", tp); /* { dg-warning "flag" "bad %n" } */ - strftime (s, m, "%#n", tp); /* { dg-warning "flag" "bad %n" } */ - strftime (s, m, "%^p", tp); /* { dg-warning "flag" "bad %p" } */ - strftime (s, m, "%^r", tp); /* { dg-warning "flag" "bad %r" } */ - strftime (s, m, "%#r", tp); /* { dg-warning "flag" "bad %r" } */ - strftime (s, m, "%^R", tp); /* { dg-warning "flag" "bad %R" } */ - strftime (s, m, "%#R", tp); /* { dg-warning "flag" "bad %R" } */ - strftime (s, m, "%^S", tp); /* { dg-warning "flag" "bad %S" } */ - strftime (s, m, "%#S", tp); /* { dg-warning "flag" "bad %S" } */ - strftime (s, m, "%^t", tp); /* { dg-warning "flag" "bad %t" } */ - strftime (s, m, "%#t", tp); /* { dg-warning "flag" "bad %t" } */ - strftime (s, m, "%^T", tp); /* { dg-warning "flag" "bad %T" } */ - strftime (s, m, "%#T", tp); /* { dg-warning "flag" "bad %T" } */ - strftime (s, m, "%^u", tp); /* { dg-warning "flag" "bad %u" } */ - strftime (s, m, "%#u", tp); /* { dg-warning "flag" "bad %u" } */ - strftime (s, m, "%^U", tp); /* { dg-warning "flag" "bad %U" } */ - strftime (s, m, "%#U", tp); /* { dg-warning "flag" "bad %U" } */ - strftime (s, m, "%^V", tp); /* { dg-warning "flag" "bad %V" } */ - strftime (s, m, "%#V", tp); /* { dg-warning "flag" "bad %V" } */ - strftime (s, m, "%^w", tp); /* { dg-warning "flag" "bad %w" } */ - strftime (s, m, "%#w", tp); /* { dg-warning "flag" "bad %w" } */ - strftime (s, m, "%^W", tp); /* { dg-warning "flag" "bad %W" } */ - strftime (s, m, "%#W", tp); /* { dg-warning "flag" "bad %W" } */ - strftime (s, m, "%^X", tp); /* { dg-warning "flag" "bad %X" } */ - 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" } */ - strftime (s, m, "%^z", tp); /* { dg-warning "flag" "bad %z" } */ - strftime (s, m, "%#z", tp); /* { dg-warning "flag" "bad %z" } */ - strftime (s, m, "%^P", tp); /* { dg-warning "flag" "bad %P" } */ - strftime (s, m, "%#P", tp); /* { dg-warning "flag" "bad %P" } */ - strftime (s, m, "%^k", tp); /* { dg-warning "flag" "bad %k" } */ - strftime (s, m, "%#k", tp); /* { dg-warning "flag" "bad %k" } */ - strftime (s, m, "%^l", tp); /* { dg-warning "flag" "bad %l" } */ - strftime (s, m, "%#l", tp); /* { dg-warning "flag" "bad %l" } */ - strftime (s, m, "%^s", tp); /* { dg-warning "flag" "bad %s" } */ - strftime (s, m, "%#s", tp); /* { dg-warning "flag" "bad %s" } */ - /* Bad usages with Y2K problems. */ - strftime (s, m, "%^c", tp); /* { dg-warning "flag" "bad %c" } */ - strftime (s, m, "%#c", tp); /* { dg-warning "flag" "bad %c" } */ - strftime (s, m, "%^D", tp); /* { dg-warning "flag" "bad %D" } */ - strftime (s, m, "%#D", tp); /* { dg-warning "flag" "bad %D" } */ - strftime (s, m, "%^g", tp); /* { dg-warning "flag" "bad %g" } */ - strftime (s, m, "%#g", tp); /* { dg-warning "flag" "bad %g" } */ - strftime (s, m, "%^x", tp); /* { dg-warning "flag" "bad %x" } */ - 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 } */ - /* 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 - more formats. The cases where it is rejected altogether are - covered in c99-strftime-1.c, except for the extension %P. - */ - strftime (s, m, "%OC%Og%OG%Oj%OY%Oz%Ok%Ol%Os", tp); /* { dg-warning "only last 2" "2-digit year" } */ - strftime (s, m, "%OP", tp); /* { dg-warning "flag|modifier" "bad %OP" } */ - /* The "-", "_" and "0" flags are mutually exclusive. */ - strftime (s, m, "%-_5C", tp); /* { dg-warning "flag" "bad %-_" } */ - strftime (s, m, "%-05C", tp); /* { dg-warning "flag" "bad %-0" } */ - strftime (s, m, "%_05C", tp); /* { dg-warning "flag" "bad %_0" } */ - /* The "#" and "^" flags are mutually exclusive. */ - strftime (s, m, "%^#a", tp); /* { dg-warning "flag" "bad %^#" } */ -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ext-4.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ext-4.c deleted file mode 100644 index c11c0ada7..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ext-4.c +++ /dev/null @@ -1,18 +0,0 @@ -/* Test for scanf formats. %a extensions. */ -/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ -/* { dg-do compile } */ -/* { dg-options "-std=gnu89 -Wformat" } */ - -#include "format.h" - -void -foo (char **sp, wchar_t **lsp) -{ - /* %a formats for allocation, only recognized in C90 mode, are a - GNU extension. Followed by other characters, %a is not treated - specially. - */ - scanf ("%as", sp); - scanf ("%aS", lsp); - scanf ("%a[bcd]", sp); -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ext-5.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ext-5.c deleted file mode 100644 index eebc7faa3..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ext-5.c +++ /dev/null @@ -1,17 +0,0 @@ -/* Test for gettext default attributes. */ -/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ -/* { dg-do compile } */ -/* { dg-options "-std=gnu99 -Wformat" } */ - -#include "format.h" - -void -foo (int i, long l) -{ - printf (gettext ("%d"), i); - printf (gettext ("%ld"), i); /* { dg-warning "format" "gettext" } */ - printf (dgettext ("", "%d"), i); - printf (dgettext ("", "%ld"), i); /* { dg-warning "format" "dgettext" } */ - printf (dcgettext ("", "%d", 0), i); - printf (dcgettext ("", "%ld", 0), i); /* { dg-warning "format" "dcgettext" } */ -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ext-6.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ext-6.c deleted file mode 100644 index 08d24cbf7..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ext-6.c +++ /dev/null @@ -1,47 +0,0 @@ -/* Test for format extensions. Test that the C99 functions get their - default attributes in gnu89 mode. -*/ -/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ -/* { dg-do compile } */ -/* { dg-options "-std=gnu89 -Wformat" } */ - -#include "format.h" - -void -foo (int i, char *s, size_t n, int *ip, va_list v0, va_list v1, va_list v2, - va_list v3, va_list v4, va_list v5, va_list v6, va_list v7, va_list v8, - va_list v9, va_list v10, va_list v11, va_list v12, va_list v13) -{ - fprintf (stdout, "%d", i); - fprintf (stdout, "%ld", i); /* { dg-warning "format" "fprintf" } */ - printf ("%d", i); - printf ("%ld", i); /* { dg-warning "format" "printf" } */ - fprintf_unlocked (stdout, "%d", i); - fprintf_unlocked (stdout, "%ld", i); /* { dg-warning "format" "fprintf_unlocked" } */ - printf_unlocked ("%d", i); - printf_unlocked ("%ld", i); /* { dg-warning "format" "printf_unlocked" } */ - sprintf (s, "%d", i); - sprintf (s, "%ld", i); /* { dg-warning "format" "sprintf" } */ - snprintf (s, n, "%d", i); - snprintf (s, n, "%ld", i); /* { dg-warning "format" "snprintf" } */ - vfprintf (stdout, "%d", v0); - vfprintf (stdout, "%Y", v1); /* { dg-warning "format" "vfprintf" } */ - vprintf ("%d", v2); - vprintf ("%Y", v3); /* { dg-warning "format" "vprintf" } */ - vsprintf (s, "%d", v4); - vsprintf (s, "%Y", v5); /* { dg-warning "format" "vsprintf" } */ - vsnprintf (s, n, "%d", v6); - vsnprintf (s, n, "%Y", v7); /* { dg-warning "format" "vsnprintf" } */ - fscanf (stdin, "%d", ip); - fscanf (stdin, "%ld", ip); /* { dg-warning "format" "fscanf" } */ - scanf ("%d", ip); - scanf ("%ld", ip); /* { dg-warning "format" "scanf" } */ - sscanf (s, "%d", ip); - sscanf (s, "%ld", ip); /* { dg-warning "format" "sscanf" } */ - vfscanf (stdin, "%d", v8); - vfscanf (stdin, "%Y", v9); /* { dg-warning "format" "vfscanf" } */ - vscanf ("%d", v10); - vscanf ("%Y", v11); /* { dg-warning "format" "vscanf" } */ - vsscanf (s, "%d", v12); - vsscanf (s, "%Y", v13); /* { dg-warning "format" "vsscanf" } */ -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ext-7.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ext-7.c deleted file mode 100644 index d9bd0e8ff..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ext-7.c +++ /dev/null @@ -1,85 +0,0 @@ -/* Test for scanf formats. %a and %m extensions. */ -/* { dg-do compile } */ -/* { dg-options "-std=gnu89 -Wformat" } */ - -#include "format.h" - -void -foo (char **sp, wchar_t **lsp, int *ip, float *fp, void **pp, double *dp) -{ - /* %a formats for allocation, only recognized in C90 mode, are a - GNU extension. Followed by other characters, %a is not treated - specially. - */ - scanf ("%as", sp); - scanf ("%aS", lsp); - scanf ("%las", dp); - scanf ("%la", lsp); /* { dg-warning "but argument 2 has type" } */ - scanf ("%las", lsp); /* { dg-warning "but argument 2 has type" } */ - scanf ("%a[bcd]", sp); - scanf ("%la[bcd]", dp); - scanf ("%*as"); - scanf ("%*aS"); - scanf ("%*las"); /* { dg-warning "assignment suppression and length modifier" } */ - scanf ("%*a[bcd]"); - scanf ("%*la[bcd]"); /* { dg-warning "assignment suppression and length modifier" } */ - scanf ("%10as", sp); - scanf ("%5aS", lsp); - scanf ("%9las", dp); - scanf ("%25a[bcd]", sp); - scanf ("%48la[bcd]", dp); - scanf ("%*10as"); - scanf ("%*5aS"); - scanf ("%*9las"); /* { dg-warning "assignment suppression and length modifier" } */ - scanf ("%*25a[bcd]"); - scanf ("%*48la[bcd]"); /* { dg-warning "assignment suppression and length modifier" } */ - - /* m assignment-allocation modifier, recognized in both C90 - and C99 modes, is a POSIX and ISO/IEC WDTR 24731-2 extension. */ - scanf ("%ms", sp); - scanf ("%mS", lsp); - scanf ("%mls", lsp); - scanf ("%m[bcd]", sp); - scanf ("%ml[bcd]", lsp); - scanf ("%mc", sp); - scanf ("%mlc", lsp); - scanf ("%mC", lsp); - scanf ("%*ms"); - scanf ("%*mS"); - scanf ("%*mls"); /* { dg-warning "assignment suppression and length modifier" } */ - scanf ("%*m[bcd]"); - scanf ("%*ml[bcd]"); /* { dg-warning "assignment suppression and length modifier" } */ - scanf ("%*mc"); - scanf ("%*mlc"); /* { dg-warning "assignment suppression and length modifier" } */ - scanf ("%*mC"); - scanf ("%10ms", sp); - scanf ("%5mS", lsp); - scanf ("%9mls", lsp); - scanf ("%25m[bcd]", sp); - scanf ("%41ml[bcd]", lsp); - scanf ("%131mc", sp); - scanf ("%27mlc", lsp); - scanf ("%2mC", lsp); - scanf ("%*10ms"); - scanf ("%*5mS"); - scanf ("%*9mls"); /* { dg-warning "assignment suppression and length modifier" } */ - scanf ("%*25m[bcd]"); - scanf ("%*41ml[bcd]"); /* { dg-warning "assignment suppression and length modifier" } */ - scanf ("%*131mc"); - scanf ("%*27mlc"); /* { dg-warning "assignment suppression and length modifier" } */ - scanf ("%*2mC"); - - scanf ("%md", ip); /* { dg-warning "flag used with" } */ - scanf ("%mi", ip); /* { dg-warning "flag used with" } */ - scanf ("%mo", ip); /* { dg-warning "flag used with" } */ - scanf ("%mu", ip); /* { dg-warning "flag used with" } */ - scanf ("%mx", ip); /* { dg-warning "flag used with" } */ - scanf ("%me", fp); /* { dg-warning "flag used with" } */ - scanf ("%mf", fp); /* { dg-warning "flag used with" } */ - scanf ("%mg", fp); /* { dg-warning "flag used with" } */ - scanf ("%mp", pp); /* { dg-warning "flag used with" } */ - - scanf ("%mas", sp); /* { dg-warning "flag together" } */ - scanf ("%maS", lsp); /* { dg-warning "flag together" } */ - scanf ("%ma[bcd]", sp); /* { dg-warning "flag together" } */ -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ext-8.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ext-8.c deleted file mode 100644 index b50cc81d5..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ext-8.c +++ /dev/null @@ -1,56 +0,0 @@ -/* Test for scanf formats. %m extensions. */ -/* { dg-do compile } */ -/* { dg-options "-std=gnu99 -Wformat" } */ - -#include "format.h" - -void -foo (char **sp, wchar_t **lsp, int *ip, float *fp, void **pp) -{ - /* m assignment-allocation modifier, recognized in both C90 - and C99 modes, is a POSIX and ISO/IEC WDTR 24731-2 extension. */ - scanf ("%ms", sp); - scanf ("%mS", lsp); - scanf ("%mls", lsp); - scanf ("%m[bcd]", sp); - scanf ("%ml[bcd]", lsp); - scanf ("%mc", sp); - scanf ("%mlc", lsp); - scanf ("%mC", lsp); - scanf ("%*ms"); - scanf ("%*mS"); - scanf ("%*mls"); /* { dg-warning "assignment suppression and length modifier" } */ - scanf ("%*m[bcd]"); - scanf ("%*ml[bcd]"); /* { dg-warning "assignment suppression and length modifier" } */ - scanf ("%*mc"); - scanf ("%*mlc"); /* { dg-warning "assignment suppression and length modifier" } */ - scanf ("%*mC"); - scanf ("%10ms", sp); - scanf ("%5mS", lsp); - scanf ("%9mls", lsp); - scanf ("%25m[bcd]", sp); - scanf ("%41ml[bcd]", lsp); - scanf ("%131mc", sp); - scanf ("%27mlc", lsp); - scanf ("%2mC", lsp); - scanf ("%*10ms"); - scanf ("%*5mS"); - scanf ("%*9mls"); /* { dg-warning "assignment suppression and length modifier" } */ - scanf ("%*25m[bcd]"); - scanf ("%*41ml[bcd]"); /* { dg-warning "assignment suppression and length modifier" } */ - scanf ("%*131mc"); - scanf ("%*27mlc"); /* { dg-warning "assignment suppression and length modifier" } */ - scanf ("%*2mC"); - - scanf ("%md", ip); /* { dg-warning "flag used with" } */ - scanf ("%mi", ip); /* { dg-warning "flag used with" } */ - scanf ("%mo", ip); /* { dg-warning "flag used with" } */ - scanf ("%mu", ip); /* { dg-warning "flag used with" } */ - scanf ("%mx", ip); /* { dg-warning "flag used with" } */ - scanf ("%ma", fp); /* { dg-warning "flag used with" } */ - scanf ("%mA", fp); /* { dg-warning "flag used with" } */ - scanf ("%me", fp); /* { dg-warning "flag used with" } */ - scanf ("%mf", fp); /* { dg-warning "flag used with" } */ - scanf ("%mg", fp); /* { dg-warning "flag used with" } */ - scanf ("%mp", pp); /* { dg-warning "flag used with" } */ -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/few-1.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/few-1.c deleted file mode 100644 index cf411409b..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/few-1.c +++ /dev/null @@ -1,30 +0,0 @@ -/* { dg-do compile } */ -/* { dg-options "-std=gnu89 -Wformat" } */ - -int f(int *ip, char *cp) -{ - __builtin_printf ("%*.*s"); -/* { dg-warning "field width specifier '\\*' expects a matching 'int' argument" "width" { target *-*-* } 6 } */ -/* { dg-warning "field precision specifier '\\.\\*' expects a matching 'int' argument" "precision" { target *-*-* } 6 } */ -/* { dg-warning "format '%s' expects a matching 'char \\*' argument" "format" { target *-*-* } 6 } */ - __builtin_printf ("%*.*s", ip, *cp); -/* { dg-warning "field width specifier '\\*' expects argument of type 'int'" "width" { target *-*-* } 10 } */ -/* { dg-warning "format '%s' expects a matching 'char \\*' argument" "format" { target *-*-* } 10 } */ - __builtin_printf ("%s %i", ip, ip); -/* { dg-warning "format '%s' expects argument of type 'char \\*'" "char" { target *-*-* } 13 } */ -/* { dg-warning "format '%i' expects argument of type 'int'" "int" { target *-*-* } 13 } */ - __builtin_printf ("%s %i", cp); -/* { dg-warning "format '%i' expects a matching 'int' argument" "" { target *-*-* } 16 } */ - __builtin_printf ("%lc"); -/* { dg-warning "format '%lc' expects a matching 'wint_t' argument" "" { target *-*-* } 18 } */ - __builtin_printf ("%lc", cp); -/* { dg-warning "format '%lc' expects argument of type 'wint_t'" "" { target *-*-* } 20 } */ - __builtin_scanf ("%s"); -/* { dg-warning "format '%s' expects a matching 'char \\*' argument" "" { target *-*-* } 22 } */ - __builtin_scanf ("%i", cp); -/* { dg-warning "format '%i' expects argument of type 'int \\*'" "" { target *-*-* } 24 } */ - __builtin_scanf ("%lc"); -/* { dg-warning "format '%lc' expects a matching 'wchar_t \\*' argument" "" { target *-*-* } 26 } */ - __builtin_scanf ("%lc", cp); -/* { dg-warning "format '%lc' expects argument of type 'wchar_t \\*'" "" { target *-*-* } 28 } */ -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/format.exp b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/format.exp deleted file mode 100644 index 4191b4a73..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/format.exp +++ /dev/null @@ -1,34 +0,0 @@ -# Copyright (C) 1997-2013 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GCC; see the file COPYING3. If not see -# <http://www.gnu.org/licenses/>. - -# Don't run this directory with any default CFLAGS, but run tests with -# and without -DWIDE. - -# Need to copy the format.h header. -if [is_remote host] { - remote_download host $srcdir/$subdir/format.h -} - -load_lib gcc-dg.exp -load_lib torture-options.exp - -torture-init -set-torture-options [list { } { -DWIDE } ] - -dg-init -gcc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] "" -torture-finish -dg-finish diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/format.h b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/format.h deleted file mode 100644 index a99927e3c..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/format.h +++ /dev/null @@ -1,192 +0,0 @@ -/* Format checking tests: common header. */ -/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ - -/* DONT_GNU_PROTOTYPE */ -#if defined (_WIN32) && !defined (__CYGWIN__) -#if !defined (USE_SYSTEM_FORMATS) -#define gnu_attr_printf gnu_printf -#define gnu_attr___printf__ __gnu_printf__ -#define gnu_attr_scanf gnu_scanf -#define gnu_attr___scanf__ __gnu_scanf__ -#define gnu_attr_strftime gnu_strftime -#define gnu_attr___strftime__ __gnu_strftime__ -#endif -#endif - -#ifndef gnu_attr_printf -#define gnu_attr_printf printf -#define gnu_attr___printf__ __printf__ -#define gnu_attr_scanf scanf -#define gnu_attr___scanf__ __scanf__ -#define gnu_attr_strftime strftime -#define gnu_attr___strftime__ __strftime__ -#endif - -#if !defined (USE_SYSTEM_FORMATS) -#define USE_PRINTF(FMTPOS, WILDARG) __attribute__((format(gnu_printf, FMTPOS, WILDARG))) __attribute__((nonnull (FMTPOS))) -#define USE_SCANF(FMTPOS, WILDARG) __attribute__((format(gnu_scanf, FMTPOS, WILDARG))) __attribute__((nonnull (FMTPOS))) -#define USE_STRFTIME(FMTPOS) __attribute__((__format__(gnu_strftime, FMTPOS, 0))) __attribute__((nonnull (FMTPOS))) -#else -#define USE_PRINTF(FMTPOS, WILDARG) -#define USE_SCANF(FMTPOS, WILDARG) -#define USE_STRFTIME(FMTPOS) -#endif - -#include <stdarg.h> -#include <stddef.h> - -#ifndef _WINT_T -#ifndef __WINT_TYPE__ -#define __WINT_TYPE__ unsigned int -#endif -typedef __WINT_TYPE__ wint_t; -#endif - -#ifdef _WIN64 -/* Kludges to get types corresponding to size_t and ptrdiff_t. */ -#define unsigned signed -typedef signed int signed_size_t __attribute__ ((mode (DI))); -/* We also use this type to approximate ssize_t. */ -typedef signed int ssize_t __attribute__ ((mode (DI))); -#undef unsigned -#define signed /* Type might or might not have explicit 'signed'. */ -typedef unsigned int unsigned_ptrdiff_t __attribute__ ((mode (DI))); -#undef signed - -__extension__ typedef int llong __attribute__ ((mode (DI))); -__extension__ typedef unsigned int ullong __attribute__ ((mode (DI))); -#else -/* 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; -#endif - -/* %q formats want a "quad"; GCC considers this to be a long long. */ -typedef llong quad_t; -typedef ullong u_quad_t; - -__extension__ typedef __INTMAX_TYPE__ intmax_t; -__extension__ typedef __UINTMAX_TYPE__ uintmax_t; - -#if __STDC_VERSION__ < 199901L && !defined(restrict) -#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 fprintf_unlocked (FILE *restrict, const char *restrict, ...); -extern int printf_unlocked (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, ...); - -/* Mingw specific part. */ -#if !defined (USE_SYSTEM_FORMATS) && defined(_WIN32) && !defined(DONT_GNU_PROTOTYPE) - -extern USE_PRINTF(2,3) int fprintf_gnu (FILE *restrict, const char *restrict, ...); -#undef fprintf -#define fprintf fprintf_gnu - -extern USE_PRINTF(1,2) int printf_gnu (const char *restrict, ...); -#undef printf -#define printf printf_gnu - -extern USE_PRINTF(2,3) int fprintf_unlocked_gnu (FILE *restrict, const char *restrict, ...); -#undef fprintf_unlocked -#define fprintf_unlocked fprintf_unlocked_gnu - -extern USE_PRINTF(1,2)int printf_unlocked_gnu (const char *restrict, ...); -#undef printf_unlocked -#define printf_unlocked printf_unlocked_gnu - -extern USE_PRINTF(2,3) int sprintf_gnu (char *restrict, const char *restrict, ...); -#undef sprintf -#define sprintf sprintf_gnu - -extern USE_PRINTF(2,0) int vfprintf_gnu (FILE *restrict, const char *restrict, va_list); -#undef vsprintf -#define vsprintf vsprintf_gnu - -extern USE_PRINTF(1,0) int vprintf_gnu (const char *restrict, va_list); -#undef vprintf -#define vprintf vprintf_gnu - -extern USE_PRINTF(2,0) int vsprintf_gnu (char *restrict, const char *restrict, va_list); -#undef vsprintf -#define vsprintf vsprintf_gnu - -extern USE_PRINTF(3,4) int snprintf_gnu (char *restrict, size_t, const char *restrict, ...); -#undef snprintf -#define snprintf snprintf_gnu - -extern USE_PRINTF(3,0) int vsnprintf_gnu (char *restrict, size_t, const char *restrict, va_list); -#undef vsnprintf -#define vsnprintf vsnprintf_gnu - -extern USE_SCANF(2,3) int fscanf_gnu (FILE *restrict, const char *restrict, ...); -#undef fscanf -#define fscanf fscanf_gnu - -extern USE_SCANF(1,2) int scanf_gnu (const char *restrict, ...); -#undef scanf -#define scanf scanf_gnu - -extern USE_SCANF(2,3) int sscanf_gnu (const char *restrict, const char *restrict, ...); -#undef sscanf -#define sscanf sscanf_gnu - -extern USE_SCANF(2,0) int vfscanf_gnu (FILE *restrict, const char *restrict, va_list); -#undef vfscanf -#define vfscanf vfscanf_gnu - -extern USE_SCANF(1,0) int vscanf_gnu (const char *restrict, va_list); -#undef vscanf -#define vscanf vscanf_gnu - -extern USE_SCANF(2,0) int vsscanf_gnu (const char *restrict, const char *restrict, va_list); -#undef vsscanf -#define vsscanf vsscanf_gnu - -extern USE_STRFTIME(3) size_t strftime_gnu (char *restrict, size_t, const char *restrict, - const struct tm *restrict); -#undef strftime -#define strftime strftime_gnu - -#endif diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/gcc_diag-1.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/gcc_diag-1.c deleted file mode 100644 index 953c944b4..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/gcc_diag-1.c +++ /dev/null @@ -1,218 +0,0 @@ -/* Test for GCC diagnositc formats. */ -/* Origin: Kaveh Ghazi <ghazi@caip.rutgers.edu> */ -/* { dg-do compile } */ -/* { dg-options "-Wformat" } */ - -#include "format.h" - -#define ATTRIBUTE_DIAG(F) __attribute__ ((__format__ (F, 1, 2))) __attribute__ ((__nonnull__)); - -/* Magic identifiers must be set before the attribute is used. */ - -typedef long long __gcc_host_wide_int__; - -typedef struct location_s -{ - const char *file; - int line; -} location_t; - -union tree_node; -typedef union tree_node *tree; - -extern int diag (const char *, ...) ATTRIBUTE_DIAG(__gcc_diag__); -extern int tdiag (const char *, ...) ATTRIBUTE_DIAG(__gcc_tdiag__); -extern int cdiag (const char *, ...) ATTRIBUTE_DIAG(__gcc_cdiag__); -extern int cxxdiag (const char *, ...) ATTRIBUTE_DIAG(__gcc_cxxdiag__); - -void -foo (int i, int i1, int i2, unsigned int u, double d, char *s, void *p, - int *n, short int *hn, long int l, unsigned long int ul, - long int *ln, long double ld, wint_t lc, wchar_t *ls, llong ll, - ullong ull, unsigned int *un, const int *cn, signed char *ss, - unsigned char *us, const signed char *css, unsigned int u1, - unsigned int u2, location_t *loc, tree t1, union tree_node *t2, - tree *t3, tree t4[]) -{ - /* Acceptable C90 specifiers, flags and modifiers. */ - diag ("%%"); - tdiag ("%%"); - cdiag ("%%"); - cxxdiag ("%%"); - diag ("%d%i%o%u%x%c%s%p%%", i, i, u, u, u, i, s, p); - tdiag ("%d%i%o%u%x%c%s%p%%", i, i, u, u, u, i, s, p); - cdiag ("%d%i%o%u%x%c%s%p%%", i, i, u, u, u, i, s, p); - cxxdiag ("%d%i%o%u%x%c%s%p%%", i, i, u, u, u, i, s, p); - diag ("%qd%qi%qo%qu%qx%qc%qs%qp%<%%%'%>", i, i, u, u, u, i, s, p); - tdiag ("%qd%qi%qo%qu%qx%qc%qs%qp%<%%%'%>", i, i, u, u, u, i, s, p); - cdiag ("%qd%qi%qo%qu%qx%qc%qs%qp%<%%%'%>", i, i, u, u, u, i, s, p); - cxxdiag ("%qd%qi%qo%qu%qx%qc%qs%qp%<%%%'%>", i, i, u, u, u, i, s, p); - diag ("%ld%li%lo%lu%lx", l, l, ul, ul, ul); - tdiag ("%ld%li%lo%lu%lx", l, l, ul, ul, ul); - cdiag ("%ld%li%lo%lu%lx", l, l, ul, ul, ul); - cxxdiag ("%ld%li%lo%lu%lx", l, l, ul, ul, ul); - diag ("%lld%lli%llo%llu%llx", ll, ll, ull, ull, ull); - tdiag ("%lld%lli%llo%llu%llx", ll, ll, ull, ull, ull); - cdiag ("%lld%lli%llo%llu%llx", ll, ll, ull, ull, ull); - cxxdiag ("%lld%lli%llo%llu%llx", ll, ll, ull, ull, ull); - diag ("%wd%wi%wo%wu%wx", ll, ll, ull, ull, ull); - tdiag ("%wd%wi%wo%wu%wx", ll, ll, ull, ull, ull); - cdiag ("%wd%wi%wo%wu%wx", ll, ll, ull, ull, ull); - cxxdiag ("%wd%wi%wo%wu%wx", ll, ll, ull, ull, ull); - diag ("%.*s", i, s); - tdiag ("%.*s", i, s); - cdiag ("%.*s", i, s); - cxxdiag ("%.*s", i, s); - - /* Extensions provided in the diagnostic framework. */ - diag ("%m"); - tdiag ("%m"); - cdiag ("%m"); - cxxdiag ("%m"); - - tdiag ("%D%F%T%V", t1, t1, t1, t1); - tdiag ("%+D%+F%+T%+V", t1, t1, t1, t1); - tdiag ("%q+D%q+F%q+T%q+V", t1, t1, t1, t1); - tdiag ("%D%D%D%D", t1, t2, *t3, t4[5]); - cdiag ("%D%F%T%V", t1, t1, t1, t1); - cdiag ("%+D%+F%+T%+V", t1, t1, t1, t1); - cdiag ("%q+D%q+F%q+T%q+V", t1, t1, t1, t1); - cdiag ("%D%D%D%D", t1, t2, *t3, t4[5]); - cdiag ("%E", t1); - cxxdiag ("%A%D%E%F%T%V", t1, t1, t1, t1, t1, t1); - cxxdiag ("%D%D%D%D", t1, t2, *t3, t4[5]); - cxxdiag ("%#A%#D%#E%#F%#T%#V", t1, t1, t1, t1, t1, t1); - cxxdiag ("%+A%+D%+E%+F%+T%+V", t1, t1, t1, t1, t1, t1); - cxxdiag ("%+#A%+#D%+#E%+#F%+#T%+#V", t1, t1, t1, t1, t1, t1); - cxxdiag ("%C%L%O%P%Q", i, i, i, i, i); - - tdiag ("%v%qv%#v", i, i, i); - cdiag ("%v%qv%#v", i, i, i); - cxxdiag ("%v%qv%#v", i, i, i); - - /* Bad stuff with extensions. */ - diag ("%m", i); /* { dg-warning "format" "extra arg" } */ - tdiag ("%m", i); /* { dg-warning "format" "extra arg" } */ - cdiag ("%m", i); /* { dg-warning "format" "extra arg" } */ - cxxdiag ("%m", i); /* { dg-warning "format" "extra arg" } */ - diag ("%#m"); /* { dg-warning "format" "bogus modifier" } */ - tdiag ("%#m"); /* { dg-warning "format" "bogus modifier" } */ - cdiag ("%#m"); /* { dg-warning "format" "bogus modifier" } */ - cxxdiag ("%#m"); /* { dg-warning "format" "bogus modifier" } */ - diag ("%+m"); /* { dg-warning "format" "bogus modifier" } */ - tdiag ("%+m"); /* { dg-warning "format" "bogus modifier" } */ - cdiag ("%+m"); /* { dg-warning "format" "bogus modifier" } */ - cxxdiag ("%+m"); /* { dg-warning "format" "bogus modifier" } */ - diag ("%D", t1); /* { dg-warning "format" "bogus tree" } */ - tdiag ("%A", t1); /* { dg-warning "format" "bogus tree" } */ - tdiag ("%E", t1); - tdiag ("%#D", t1); /* { dg-warning "format" "bogus modifier" } */ - cdiag ("%A", t1); /* { dg-warning "format" "bogus tree" } */ - cdiag ("%#D", t1); /* { dg-warning "format" "bogus modifier" } */ - cdiag ("%+D", t1); - cxxdiag ("%C"); /* { dg-warning "format" "missing arg" } */ - cxxdiag ("%C", l); /* { dg-warning "format" "wrong arg" } */ - cxxdiag ("%C", i, i); /* { dg-warning "format" "extra arg" } */ - cxxdiag ("%#C", i); /* { dg-warning "format" "bogus modifier" } */ - cxxdiag ("%+C", i); /* { dg-warning "format" "bogus modifier" } */ - tdiag ("%D"); /* { dg-warning "format" "missing arg" } */ - cdiag ("%D"); /* { dg-warning "format" "missing arg" } */ - cxxdiag ("%D"); /* { dg-warning "format" "missing arg" } */ - tdiag ("%D", i); /* { dg-warning "format" "wrong arg" } */ - cdiag ("%D", i); /* { dg-warning "format" "wrong arg" } */ - cxxdiag ("%D", i); /* { dg-warning "format" "wrong arg" } */ - tdiag ("%D", t1, t1); /* { dg-warning "format" "extra arg" } */ - cdiag ("%D", t1, t1); /* { dg-warning "format" "extra arg" } */ - cxxdiag ("%D", t1, t1); /* { dg-warning "format" "extra arg" } */ - - tdiag ("%V", i); /* { dg-warning "format" "wrong arg" } */ - cdiag ("%V", i); /* { dg-warning "format" "wrong arg" } */ - cxxdiag ("%V", i); /* { dg-warning "format" "wrong arg" } */ - - tdiag ("%v", t1); /* { dg-warning "format" "wrong arg" } */ - cdiag ("%v", t1); /* { dg-warning "format" "wrong arg" } */ - cxxdiag ("%v", t1); /* { dg-warning "format" "wrong arg" } */ - - /* Standard specifiers not accepted in the diagnostic framework. */ - diag ("%X\n", u); /* { dg-warning "format" "HEX" } */ - diag ("%f\n", d); /* { dg-warning "format" "float" } */ - diag ("%e\n", d); /* { dg-warning "format" "float" } */ - diag ("%E\n", d); /* { dg-warning "format" "float" } */ - diag ("%g\n", d); /* { dg-warning "format" "float" } */ - diag ("%G\n", d); /* { dg-warning "format" "float" } */ - diag ("%n\n", n); /* { dg-warning "format" "counter" } */ - diag ("%hd\n", i); /* { dg-warning "format" "conversion" } */ - - /* Various tests of bad argument types. */ - diag ("%-d", i); /* { dg-warning "format" "bad flag" } */ - tdiag ("%-d", i); /* { dg-warning "format" "bad flag" } */ - cdiag ("%-d", i); /* { dg-warning "format" "bad flag" } */ - cxxdiag ("%-d", i); /* { dg-warning "format" "bad flag" } */ - diag ("% d", i); /* { dg-warning "format" "bad flag" } */ - tdiag ("% d", i); /* { dg-warning "format" "bad flag" } */ - cdiag ("% d", i); /* { dg-warning "format" "bad flag" } */ - cxxdiag ("% d", i); /* { dg-warning "format" "bad flag" } */ - diag ("%#o", u); /* { dg-warning "format" "bad flag" } */ - tdiag ("%#o", u); /* { dg-warning "format" "bad flag" } */ - cdiag ("%#o", u); /* { dg-warning "format" "bad flag" } */ - cxxdiag ("%#o", u); /* { dg-warning "format" "bad flag" } */ - diag ("%0d", i); /* { dg-warning "format" "bad flag" } */ - tdiag ("%0d", i); /* { dg-warning "format" "bad flag" } */ - cdiag ("%0d", i); /* { dg-warning "format" "bad flag" } */ - cxxdiag ("%0d", i); /* { dg-warning "format" "bad flag" } */ - diag ("%08d", i); /* { dg-warning "format" "bad flag" } */ - tdiag ("%08d", i); /* { dg-warning "format" "bad flag" } */ - cdiag ("%08d", i); /* { dg-warning "format" "bad flag" } */ - cxxdiag ("%08d", i); /* { dg-warning "format" "bad flag" } */ - diag ("%+d\n", i); /* { dg-warning "format" "bad flag" } */ - tdiag ("%+d\n", i); /* { dg-warning "format" "bad flag" } */ - cdiag ("%+d\n", i); /* { dg-warning "format" "bad flag" } */ - cxxdiag ("%+d\n", i); /* { dg-warning "format" "bad flag" } */ - diag ("%3d\n", i); /* { dg-warning "format" "bad flag" } */ - tdiag ("%3d\n", i); /* { dg-warning "format" "bad flag" } */ - cdiag ("%3d\n", i); /* { dg-warning "format" "bad flag" } */ - cxxdiag ("%3d\n", i); /* { dg-warning "format" "bad flag" } */ - diag ("%-3d\n", i); /* { dg-warning "format" "bad flag" } */ - tdiag ("%-3d\n", i); /* { dg-warning "format" "bad flag" } */ - cdiag ("%-3d\n", i); /* { dg-warning "format" "bad flag" } */ - cxxdiag ("%-3d\n", i); /* { dg-warning "format" "bad flag" } */ - diag ("%.7d\n", i); /* { dg-warning "format" "bad flag" } */ - tdiag ("%.7d\n", i); /* { dg-warning "format" "bad flag" } */ - cdiag ("%.7d\n", i); /* { dg-warning "format" "bad flag" } */ - cxxdiag ("%.7d\n", i); /* { dg-warning "format" "bad flag" } */ - diag ("%+9.4d\n", i); /* { dg-warning "format" "bad flag" } */ - tdiag ("%+9.4d\n", i); /* { dg-warning "format" "bad flag" } */ - cdiag ("%+9.4d\n", i); /* { dg-warning "format" "bad flag" } */ - cxxdiag ("%+9.4d\n", i); /* { dg-warning "format" "bad flag" } */ - diag ("%.3ld\n", l); /* { dg-warning "format" "bad flag" } */ - tdiag ("%.3ld\n", l); /* { dg-warning "format" "bad flag" } */ - cdiag ("%.3ld\n", l); /* { dg-warning "format" "bad flag" } */ - cxxdiag ("%.3ld\n", l); /* { dg-warning "format" "bad flag" } */ - diag ("%d %lu\n", i, ul); - diag ("%d", l); /* { dg-warning "format" "bad argument types" } */ - diag ("%wd", l); /* { dg-warning "format" "bad argument types" } */ - diag ("%d", ll); /* { dg-warning "format" "bad argument types" } */ - diag ("%*s", i, s); /* { dg-warning "format" "bad * argument types" } */ - diag ("%*.*s", i, i, s); /* { dg-warning "format" "bad * argument types" } */ - diag ("%*d\n", i1, i); /* { dg-warning "format" "bad * argument types" } */ - diag ("%.*d\n", i2, i); /* { dg-warning "format" "bad * argument types" } */ - diag ("%*.*ld\n", i1, i2, l); /* { dg-warning "format" "bad * argument types" } */ - diag ("%ld", i); /* { dg-warning "format" "bad argument types" } */ - diag ("%s", n); /* { dg-warning "format" "bad argument types" } */ - - /* Wrong number of arguments. */ - diag ("%d%d", i); /* { dg-warning "matching" "wrong number of args" } */ - diag ("%d", i, i); /* { dg-warning "arguments" "wrong number of args" } */ - /* Miscellaneous bogus constructions. */ - diag (""); /* { dg-warning "zero-length" "warning for empty format" } */ - diag ("\0"); /* { dg-warning "embedded" "warning for embedded NUL" } */ - diag ("%d\0", i); /* { dg-warning "embedded" "warning for embedded NUL" } */ - diag ("%d\0%d", i, i); /* { dg-warning "embedded|too many" "warning for embedded NUL" } */ - diag (NULL); /* { dg-warning "null" "null format string warning" } */ - diag ("%"); /* { dg-warning "trailing" "trailing % warning" } */ - diag ((const char *)L"foo"); /* { dg-warning "wide" "wide string" } */ - diag ("%s", (char *)0); /* { dg-warning "null" "%s with NULL" } */ - - /* Make sure we still get warnings for regular printf. */ - printf ("%d\n", ll); /* { dg-warning "format" "bad argument types" } */ -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/gcc_diag-2.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/gcc_diag-2.c deleted file mode 100644 index 60c6835da..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/gcc_diag-2.c +++ /dev/null @@ -1,10 +0,0 @@ -/* Test for ICE handling internal formats: bug 20740. The code did - not check that, if the required typedef names had been used as - identifiers, they were defined to suitable types. Test "tree", not - defined. */ -/* Origin: Joseph Myers <joseph@codesourcery.com> */ -/* { dg-do compile } */ -/* { dg-options "-Wformat" } */ - -void foo (int tree); -void bar (const char *, ...) __attribute__ ((__format__ (__gcc_diag__, 1, 2))); diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/gcc_diag-3.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/gcc_diag-3.c deleted file mode 100644 index 8d2ac61a9..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/gcc_diag-3.c +++ /dev/null @@ -1,10 +0,0 @@ -/* Test for ICE handling internal formats: bug 20740. The code did - not check that, if the required typedef names had been used as - identifiers, they were defined to suitable types. Test "tree", not - a type. */ -/* Origin: Joseph Myers <joseph@codesourcery.com> */ -/* { dg-do compile } */ -/* { dg-options "-Wformat" } */ - -int tree; -void bar (const char *, ...) __attribute__ ((__format__ (__gcc_diag__, 1, 2))); /* { dg-error "'tree' is not defined as a type" } */ diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/gcc_diag-4.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/gcc_diag-4.c deleted file mode 100644 index 9b2396219..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/gcc_diag-4.c +++ /dev/null @@ -1,10 +0,0 @@ -/* Test for ICE handling internal formats: bug 20740. The code did - not check that, if the required typedef names had been used as - identifiers, they were defined to suitable types. Test "tree", not - a pointer type. */ -/* Origin: Joseph Myers <joseph@codesourcery.com> */ -/* { dg-do compile } */ -/* { dg-options "-Wformat" } */ - -typedef int tree; -void bar (const char *, ...) __attribute__ ((__format__ (__gcc_diag__, 1, 2))); /* { dg-error "'tree' is not defined as a pointer type" } */ diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/gcc_diag-5.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/gcc_diag-5.c deleted file mode 100644 index f8f12d68c..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/gcc_diag-5.c +++ /dev/null @@ -1,10 +0,0 @@ -/* Test for ICE handling internal formats: bug 20740. The code did - not check that, if the required typedef names had been used as - identifiers, they were defined to suitable types. Test - "location_t", not defined. */ -/* Origin: Joseph Myers <joseph@codesourcery.com> */ -/* { dg-do compile } */ -/* { dg-options "-Wformat" } */ - -void foo (int location_t); -void bar (const char *, ...) __attribute__ ((__format__ (__gcc_diag__, 1, 2))); diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/gcc_diag-6.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/gcc_diag-6.c deleted file mode 100644 index 3f704e6f9..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/gcc_diag-6.c +++ /dev/null @@ -1,10 +0,0 @@ -/* Test for ICE handling internal formats: bug 20740. The code did - not check that, if the required typedef names had been used as - identifiers, they were defined to suitable types. Test - "location_t", not a type. */ -/* Origin: Joseph Myers <joseph@codesourcery.com> */ -/* { dg-do compile } */ -/* { dg-options "-Wformat" } */ - -int location_t; -void bar (const char *, ...) __attribute__ ((__format__ (__gcc_diag__, 1, 2))); /* { dg-error "'location_t' is not defined as a type" } */ diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/gcc_diag-7.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/gcc_diag-7.c deleted file mode 100644 index fccf5d240..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/gcc_diag-7.c +++ /dev/null @@ -1,10 +0,0 @@ -/* Test for ICE handling internal formats: bug 20740. The code did - not check that, if the required typedef names had been used as - identifiers, they were defined to suitable types. Test - "__gcc_host_wide_int__", not defined. */ -/* Origin: Joseph Myers <joseph@codesourcery.com> */ -/* { dg-do compile } */ -/* { dg-options "-Wformat" } */ - -void foo (int __gcc_host_wide_int__); -void bar (const char *, ...) __attribute__ ((__format__ (__gcc_diag__, 1, 2))); diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/gcc_diag-8.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/gcc_diag-8.c deleted file mode 100644 index 6715ee33e..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/gcc_diag-8.c +++ /dev/null @@ -1,10 +0,0 @@ -/* Test for ICE handling internal formats: bug 20740. The code did - not check that, if the required typedef names had been used as - identifiers, they were defined to suitable types. Test - "__gcc_host_wide_int__", not a type. */ -/* Origin: Joseph Myers <joseph@codesourcery.com> */ -/* { dg-do compile } */ -/* { dg-options "-Wformat" } */ - -int __gcc_host_wide_int__; -void bar (const char *, ...) __attribute__ ((__format__ (__gcc_diag__, 1, 2))); /* { dg-error "'__gcc_host_wide_int__' is not defined as a type" } */ diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/gcc_diag-9.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/gcc_diag-9.c deleted file mode 100644 index 8daeb58a7..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/gcc_diag-9.c +++ /dev/null @@ -1,10 +0,0 @@ -/* Test for ICE handling internal formats: bug 20740. The code did - not check that, if the required typedef names had been used as - identifiers, they were defined to suitable types. Test - "__gcc_host_wide_int__", bad type. */ -/* Origin: Joseph Myers <joseph@codesourcery.com> */ -/* { dg-do compile } */ -/* { dg-options "-Wformat" } */ - -typedef int __gcc_host_wide_int__; -void bar (const char *, ...) __attribute__ ((__format__ (__gcc_diag__, 1, 2))); /* { dg-error "'__gcc_host_wide_int__' is not defined as 'long' or 'long long'" } */ diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/gcc_gfc-1.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/gcc_gfc-1.c deleted file mode 100644 index 7e079b776..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/gcc_gfc-1.c +++ /dev/null @@ -1,32 +0,0 @@ -/* Test for gcc_gfc formats. */ -/* Origin: Kaveh Ghazi <ghazi@caip.rutgers.edu> */ -/* { dg-do compile } */ -/* { dg-options "-Wformat" } */ - -#include "format.h" - -/* Magic identifier must be set before the attribute is used. */ -typedef struct locus locus; - -extern int gfc_warn (const char *, ...) __attribute__ ((__format__ (__gcc_gfc__, 1, 2))) __attribute__ ((__nonnull__)); - -void -foo (unsigned int u, int i, char *s, unsigned long int ul, long int l, - llong ll, locus *loc) -{ - /* Acceptable C90 specifiers, flags and modifiers. */ - gfc_warn ("%%"); - gfc_warn ("%u%d%i%c%s%%", u, i, i, i, s); - gfc_warn ("%lu%ld%li%%", ul, l, l); - - /* Extensions provided in gfc_warn. */ - gfc_warn ("%C"); - gfc_warn ("%L", loc); - - /* Various tests of bad argument types. */ - gfc_warn ("%d", l); /* { dg-warning "format" "bad argument types" } */ - gfc_warn ("%d", ll); /* { dg-warning "format" "bad argument types" } */ - gfc_warn ("%s", &i); /* { dg-warning "format" "bad argument types" } */ - gfc_warn ("%L", &i); /* { dg-warning "format" "bad argument types" } */ - gfc_warn ("%C", i); /* { dg-warning "format" "too many arguments" } */ -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/gcc_gfc-2.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/gcc_gfc-2.c deleted file mode 100644 index f3095fa29..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/gcc_gfc-2.c +++ /dev/null @@ -1,13 +0,0 @@ -/* PR c/35436 */ -/* { dg-do compile } */ -/* { dg-options "-Wformat" } */ - -typedef void locus[1]; /* { dg-error "array of void" } */ - -void foo(const char*, ...) - __attribute__((__format__(__gcc_gfc__, 1, 2))); /* { dg-error "locus" } */ - -void bar() -{ - foo("%L", 0); /* { dg-warning "format" } */ -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/miss-1.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/miss-1.c deleted file mode 100644 index 3d4b99124..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/miss-1.c +++ /dev/null @@ -1,39 +0,0 @@ -/* Test for warnings for missing format attributes. */ -/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ -/* { dg-do compile } */ -/* { dg-options "-std=gnu99 -Wmissing-format-attribute" } */ - -#include "format.h" - -void -foo (const char *fmt, ...) -{ - va_list ap; - va_start (ap, fmt); - vprintf (fmt, ap); /* { dg-warning "candidate" "printf attribute warning" } */ - va_end (ap); -} - -void -bar (const char *fmt, ...) -{ - va_list ap; - va_start (ap, fmt); - vscanf (fmt, ap); /* { dg-warning "candidate" "scanf attribute warning" } */ - va_end (ap); -} - -__attribute__((__format__(gnu_attr___printf__, 1, 2))) void -foo2 (const char *fmt, ...) -{ - va_list ap; - va_start (ap, fmt); - vprintf (fmt, ap); - va_end (ap); -} - -void -vfoo (const char *fmt, va_list arg) -{ - vprintf (fmt, arg); /* { dg-warning "candidate" "printf attribute warning 2" } */ -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/miss-2.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/miss-2.c deleted file mode 100644 index 241b22d2c..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/miss-2.c +++ /dev/null @@ -1,16 +0,0 @@ -/* Test for warnings for missing format attributes. Don't warn if no - relevant parameters for a format attribute; see c/1017. */ -/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ -/* { dg-do compile } */ -/* { dg-options "-std=gnu99 -Wmissing-format-attribute" } */ - -#include "format.h" - -void -foo (int i, ...) -{ - va_list ap; - va_start (ap, i); - vprintf ("Foo %s bar %s", ap); /* { dg-bogus "candidate" "bogus printf attribute warning" } */ - va_end (ap); -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/miss-3.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/miss-3.c deleted file mode 100644 index e9cf19d1f..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/miss-3.c +++ /dev/null @@ -1,27 +0,0 @@ -/* Test warnings for missing format attributes on function pointers. */ -/* Origin: Kaveh Ghazi <ghazi@caip.rutgers.edu> */ -/* { dg-do compile } */ -/* { dg-options "-std=gnu99 -Wmissing-format-attribute" } */ - -#define DONT_GNU_PROTOTYPE -#include "format.h" - -typedef void (*noattr_t) (const char *, ...); -typedef noattr_t __attribute__ ((__format__(gnu_attr___printf__, 1, 2))) attr_t; - -typedef void (*vnoattr_t) (const char *, va_list); -typedef vnoattr_t __attribute__ ((__format__(gnu_attr___printf__, 1, 0))) vattr_t; - -void -foo1 (noattr_t na, attr_t a, vnoattr_t vna, vattr_t va) -{ - noattr_t na1 = na; - noattr_t na2 = a; /* { dg-warning "candidate" "initialization warning" } */ - attr_t a1 = na; - attr_t a2 = a; - - vnoattr_t vna1 = vna; - vnoattr_t vna2 = va; /* { dg-warning "candidate" "initialization warning" } */ - vattr_t va1 = vna; - vattr_t va2 = va; -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/miss-4.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/miss-4.c deleted file mode 100644 index f6cfd64cd..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/miss-4.c +++ /dev/null @@ -1,33 +0,0 @@ -/* Test warnings for missing format attributes on function pointers. */ -/* Origin: Kaveh Ghazi <ghazi@caip.rutgers.edu> */ -/* { dg-do compile } */ -/* { dg-options "-std=gnu99 -Wmissing-format-attribute" } */ - -#define DONT_GNU_PROTOTYPE -#include "format.h" - -typedef void (*noattr_t) (const char *, ...); -typedef noattr_t __attribute__ ((__format__(gnu_attr___printf__, 1, 2))) attr_t; - -typedef void (*vnoattr_t) (const char *, va_list); -typedef vnoattr_t __attribute__ ((__format__(gnu_attr___printf__, 1, 0))) vattr_t; - -void -foo1 (noattr_t na, attr_t a, vnoattr_t vna, vattr_t va) -{ - noattr_t na1, na2; - attr_t a1, a2; - - vnoattr_t vna1, vna2; - vattr_t va1, va2; - - na1 = na; - na2 = a; /* { dg-warning "candidate" "assignment warning" } */ - a1 = na; - a2 = a; - - vna1 = vna; - vna2 = va; /* { dg-warning "candidate" "assignment warning" } */ - va1 = vna; - va1 = va; -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/miss-5.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/miss-5.c deleted file mode 100644 index 1706e369b..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/miss-5.c +++ /dev/null @@ -1,49 +0,0 @@ -/* Test warnings for missing format attributes on function pointers. */ -/* Origin: Kaveh Ghazi <ghazi@caip.rutgers.edu> */ -/* { dg-do compile } */ -/* { dg-options "-std=gnu99 -Wmissing-format-attribute" } */ - -#define DONT_GNU_PROTOTYPE -#include "format.h" - -typedef void (*noattr_t) (const char *, ...); -typedef noattr_t __attribute__ ((__format__(gnu_attr___printf__, 1, 2))) attr_t; - -typedef void (*vnoattr_t) (const char *, va_list); -typedef vnoattr_t __attribute__ ((__format__(gnu_attr___printf__, 1, 0))) vattr_t; - -noattr_t -foo1 (noattr_t na, attr_t a, int i) -{ - if (i) - return na; - else - return a; /* { dg-warning "candidate" "return type warning" } */ -} - -attr_t -foo2 (noattr_t na, attr_t a, int i) -{ - if (i) - return na; - else - return a; -} - -vnoattr_t -foo3 (vnoattr_t vna, vattr_t va, int i) -{ - if (i) - return vna; - else - return va; /* { dg-warning "candidate" "return type warning" } */ -} - -vattr_t -foo4 (vnoattr_t vna, vattr_t va, int i) -{ - if (i) - return vna; - else - return va; -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/miss-6.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/miss-6.c deleted file mode 100644 index 77e287465..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/miss-6.c +++ /dev/null @@ -1,32 +0,0 @@ -/* Test warnings for missing format attributes on function pointers. */ -/* Origin: Kaveh Ghazi <ghazi@caip.rutgers.edu> */ -/* { dg-do compile } */ -/* { dg-options "-std=gnu99 -Wmissing-format-attribute" } */ - -#define DONT_GNU_PROTOTYPE -#include "format.h" - -typedef void (*noattr_t) (const char *, ...); -typedef noattr_t __attribute__ ((__format__(gnu_attr___printf__, 1, 2))) attr_t; - -typedef void (*vnoattr_t) (const char *, va_list); -typedef vnoattr_t __attribute__ ((__format__(gnu_attr___printf__, 1, 0))) vattr_t; - -extern void foo1 (noattr_t); -extern void foo2 (attr_t); -extern void foo3 (vnoattr_t); -extern void foo4 (vattr_t); - -void -foo (noattr_t na, attr_t a, vnoattr_t vna, vattr_t va) -{ - foo1 (na); - foo1 (a); /* { dg-warning "candidate" "parameter passing warning" } */ - foo2 (na); - foo2 (a); - - foo3 (vna); - foo3 (va); /* { dg-warning "candidate" "parameter passing warning" } */ - foo4 (vna); - foo4 (va); -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms-format1.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms-format1.c deleted file mode 100644 index e8f739dce..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms-format1.c +++ /dev/null @@ -1,23 +0,0 @@ -/* Test for printf formats. Formats using extensions to the standard - should be rejected in strict pedantic mode. But allowed by -Wno-pedantic-ms-format. -*/ -/* Origin: Kai Tietz <kai.tietz@onevision.com> */ -/* { dg-do compile { target { *-*-mingw* } } } */ -/* { dg-options "-std=iso9899:1999 -pedantic -Wformat -Wno-pedantic-ms-format" } */ - -#define USE_SYSTEM_FORMATS -#include "format.h" - -enum en1 { A=0, B=1 }; -typedef enum { _A=0, _B=1 } en2; - -void -foo (int i, long l, long long ll, size_t z, enum en1 e1, en2 e2) -{ - printf ("%I32d", i); - printf ("%I32d", l); - printf ("%I32d", e1); - printf ("%I32d", e2); - printf ("%I64x", ll); - printf ("%Ix", z); -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms-format2.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms-format2.c deleted file mode 100644 index 5c950522a..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms-format2.c +++ /dev/null @@ -1,23 +0,0 @@ -/* Test for printf formats. Formats using extensions to the standard - should be rejected in strict pedantic mode. But allowed by -Wno-pedantic-ms-format. -*/ -/* Origin: Kai Tietz <kai.tietz@onevision.com> */ -/* { dg-do compile { target { *-*-mingw* } } } */ -/* { dg-options "-std=iso9899:1999 -pedantic -Wformat -Wno-pedantic-ms-format" } */ - -#define USE_SYSTEM_FORMATS -#include "format.h" - -#ifdef _WIN64 -#define XXX "%I64x" -#else -#define XXX "%I32x" -#endif - -void -foo (float f, double d, void *p) -{ - printf (XXX, p); /* { dg-warning "format" "bad argument types" } */ - printf ("%I32x", f); /* { dg-warning "format" "bad argument types" } */ - printf ("%I64x", d); /* { dg-warning "format" "bad argument types" } */ -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms-format3.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms-format3.c deleted file mode 100644 index 806ddb60b..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms-format3.c +++ /dev/null @@ -1,20 +0,0 @@ -/* Test for printf formats. Formats using extensions to the standard - should be rejected in strict pedantic mode. But allowed by -Wno-pedantic-ms-format. -*/ -/* Tests for specific MS types, origin: Ozkan Sezer <sezeroz@gmail.com> */ -/* { dg-do compile { target { *-*-mingw* } } } */ -/* { dg-options "-std=iso9899:1999 -pedantic -Wformat -Wno-pedantic-ms-format" } */ - -#define USE_SYSTEM_FORMATS -#define WIN32_LEAN_AND_MEAN -#include "format.h" -#include <windows.h> - -void foo (LONG_PTR l, ULONG_PTR u, DWORD_PTR d, UINT_PTR p, SIZE_T s) -{ - printf ("%Id\n", l); - printf ("%Iu\n", u); - printf ("%Iu\n", d); - printf ("%Iu\n", p); - printf ("%Iu\n", s); -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms-warnI64-1.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms-warnI64-1.c deleted file mode 100644 index b5d31d2fe..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms-warnI64-1.c +++ /dev/null @@ -1,28 +0,0 @@ -/* Test for printf formats. Test for ISO C warnings with MS "I64" - extension.*/ - -/* { dg-do compile { target { *-*-mingw* } } } */ -/* { dg-options "-std=iso9899:1990 -pedantic -Wformat -Wno-long-long" } */ - -#define USE_SYSTEM_FORMATS -#include "format.h" - -void -foo (long long ll, unsigned long long ull, long long *lln, - long long *llp, unsigned long long *ullp) -{ - printf ("%I64d", ll); /* { dg-warning "'I64' ms_printf length modifier" "printf %I64d" } */ - printf ("%I64i", ll); /* { dg-warning "'I64' ms_printf length modifier" "printf %I64i" } */ - printf ("%I64o", ull); /* { dg-warning "'I64' ms_printf length modifier" "printf %I64o" } */ - printf ("%I64u", ull); /* { dg-warning "'I64' ms_printf length modifier" "printf %I64u" } */ - printf ("%I64x", ull); /* { dg-warning "'I64' ms_printf length modifier" "printf %I64x" } */ - printf ("%I64X", ull); /* { dg-warning "'I64' ms_printf length modifier" "printf %I64X" } */ - printf ("%I64n", lln); /* { dg-warning "'I64' ms_printf length modifier" "printf %I64n" } */ - scanf ("%I64d", llp); /* { dg-warning "'I64' ms_scanf length modifier" "scanf %I64d" } */ - scanf ("%I64i", llp); /* { dg-warning "'I64' ms_scanf length modifier" "scanf %I64i" } */ - scanf ("%I64o", ullp); /* { dg-warning "'I64' ms_scanf length modifier" "scanf %I64o" } */ - scanf ("%I64u", ullp); /* { dg-warning "'I64' ms_scanf length modifier" "scanf %I64u" } */ - scanf ("%I64x", ullp); /* { dg-warning "'I64' ms_scanf length modifier" "scanf %I64x" } */ - scanf ("%I64X", ullp); /* { dg-warning "'I64' ms_scanf length modifier" "scanf %I64X" } */ - scanf ("%I64n", llp); /* { dg-warning "'I64' ms_scanf length modifier" "scanf %I64n" } */ -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_array-1.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_array-1.c deleted file mode 100644 index b34506830..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_array-1.c +++ /dev/null @@ -1,42 +0,0 @@ -/* Test for format checking of constant arrays. */ -/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ -/* { dg-do compile { target { *-*-mingw* } } } */ -/* { dg-options "-std=gnu99 -Wformat=2" } */ - -#define USE_SYSTEM_FORMATS -#include "format.h" - -const char a1[] = "foo"; -const char a2[] = "foo%d"; -const char b1[3] = "foo"; -const char b2[1] = "1"; -static const char c1[] = "foo"; -static const char c2[] = "foo%d"; -char d[] = "foo"; -volatile const char e[] = "foo"; - -void -foo (int i, long l) -{ - const char p1[] = "bar"; - const char p2[] = "bar%d"; - static const char q1[] = "bar"; - static const char q2[] = "bar%d"; - printf (a1); - printf (a2, i); - printf (a2, l); /* { dg-warning "format" "wrong type with array" } */ - printf (b1); /* { dg-warning "unterminated" "unterminated array" } */ - printf (b2); /* { dg-warning "unterminated" "unterminated array" } */ - printf (c1); - printf (c2, i); - printf (c2, l); /* { dg-warning "format" "wrong type with array" } */ - printf (p1); - printf (p2, i); - printf (p2, l); /* { dg-warning "format" "wrong type with array" } */ - printf (q1); - printf (q2, i); - printf (q2, l); /* { dg-warning "format" "wrong type with array" } */ - /* Volatile or non-constant arrays must not be checked. */ - printf (d); /* { dg-warning "not a string literal" "non-const" } */ - printf ((const char *)e); /* { dg-warning "not a string literal" "volatile" } */ -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_attr-1.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_attr-1.c deleted file mode 100644 index 90709bb1f..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_attr-1.c +++ /dev/null @@ -1,10 +0,0 @@ -/* Test for strftime format attributes: can't have first_arg_num != 0. */ -/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ -/* { dg-do compile { target { *-*-mingw* } } } */ -/* { dg-options "-std=gnu99 -Wformat" } */ - -#define DONT_GNU_PROTOTYPE -#include "format.h" - -extern void foo0 (const char *) __attribute__((__format__(__ms_strftime__, 1, 0))); -extern void foo1 (const char *, ...) __attribute__((__format__(__ms_strftime__, 1, 2))); /* { dg-error "cannot format" "strftime first_arg_num != 0" } */ diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_attr-2.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_attr-2.c deleted file mode 100644 index 9a9ce0fe3..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_attr-2.c +++ /dev/null @@ -1,68 +0,0 @@ -/* Test for format attributes: test use of __attribute__. */ -/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ -/* { dg-do compile { target { *-*-mingw* } } } */ -/* { dg-options "-std=gnu99 -Wformat" } */ - -#define DONT_GNU_PROTOTYPE -#include "format.h" - -extern void tformatprintf (const char *, ...) __attribute__((format(ms_printf, 1, 2))); -extern void tformat__printf__ (const char *, ...) __attribute__((format(__ms_printf__, 1, 2))); -extern void tformatscanf (const char *, ...) __attribute__((format(ms_scanf, 1, 2))); -extern void tformat__scanf__ (const char *, ...) __attribute__((format(__ms_scanf__, 1, 2))); -extern void tformatstrftime (const char *) __attribute__((format(ms_strftime, 1, 0))); -extern void tformat__strftime__ (const char *) __attribute__((format(__ms_strftime__, 1, 0))); -extern void tformatstrfmon (const char *, ...) __attribute__((format(strfmon, 1, 2))); -extern void tformat__strfmon__ (const char *, ...) __attribute__((format(__strfmon__, 1, 2))); -extern void t__format__printf (const char *, ...) __attribute__((__format__(ms_printf, 1, 2))); -extern void t__format____printf__ (const char *, ...) __attribute__((__format__(__ms_printf__, 1, 2))); -extern void t__format__scanf (const char *, ...) __attribute__((__format__(ms_scanf, 1, 2))); -extern void t__format____scanf__ (const char *, ...) __attribute__((__format__(__ms_scanf__, 1, 2))); -extern void t__format__strftime (const char *) __attribute__((__format__(ms_strftime, 1, 0))); -extern void t__format____strftime__ (const char *) __attribute__((__format__(__ms_strftime__, 1, 0))); -extern void t__format__strfmon (const char *, ...) __attribute__((__format__(strfmon, 1, 2))); -extern void t__format____strfmon__ (const char *, ...) __attribute__((__format__(__strfmon__, 1, 2))); - -extern char *tformat_arg (const char *) __attribute__((format_arg(1))); -extern char *t__format_arg__ (const char *) __attribute__((__format_arg__(1))); - -void -foo (int i, int *ip, double d) -{ - tformatprintf ("%d", i); - tformatprintf ("%"); /* { dg-warning "format" "attribute format printf" } */ - tformat__printf__ ("%d", i); - tformat__printf__ ("%"); /* { dg-warning "format" "attribute format __printf__" } */ - tformatscanf ("%d", ip); - tformatscanf ("%"); /* { dg-warning "format" "attribute format scanf" } */ - tformat__scanf__ ("%d", ip); - tformat__scanf__ ("%"); /* { dg-warning "format" "attribute format __scanf__" } */ - tformatstrftime ("%a"); - tformatstrftime ("%"); /* { dg-warning "format" "attribute format strftime" } */ - tformat__strftime__ ("%a"); - tformat__strftime__ ("%"); /* { dg-warning "format" "attribute format __strftime__" } */ - tformatstrfmon ("%n", d); - tformatstrfmon ("%"); /* { dg-warning "format" "attribute format strfmon" } */ - tformat__strfmon__ ("%n", d); - tformat__strfmon__ ("%"); /* { dg-warning "format" "attribute format __strfmon__" } */ - t__format__printf ("%d", i); - t__format__printf ("%"); /* { dg-warning "format" "attribute __format__ printf" } */ - t__format____printf__ ("%d", i); - t__format____printf__ ("%"); /* { dg-warning "format" "attribute __format__ __printf__" } */ - t__format__scanf ("%d", ip); - t__format__scanf ("%"); /* { dg-warning "format" "attribute __format__ scanf" } */ - t__format____scanf__ ("%d", ip); - t__format____scanf__ ("%"); /* { dg-warning "format" "attribute __format__ __scanf__" } */ - t__format__strftime ("%a"); - t__format__strftime ("%"); /* { dg-warning "format" "attribute __format__ strftime" } */ - t__format____strftime__ ("%a"); - t__format____strftime__ ("%"); /* { dg-warning "format" "attribute __format__ __strftime__" } */ - t__format__strfmon ("%n", d); - t__format__strfmon ("%"); /* { dg-warning "format" "attribute __format__ strfmon" } */ - t__format____strfmon__ ("%n", d); - t__format____strfmon__ ("%"); /* { dg-warning "format" "attribute __format__ __strfmon__" } */ - tformatprintf (tformat_arg ("%d"), i); - tformatprintf (tformat_arg ("%")); /* { dg-warning "format" "attribute format_arg" } */ - tformatprintf (t__format_arg__ ("%d"), i); - tformatprintf (t__format_arg__ ("%")); /* { dg-warning "format" "attribute __format_arg__" } */ -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_attr-3.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_attr-3.c deleted file mode 100644 index 5341dd816..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_attr-3.c +++ /dev/null @@ -1,71 +0,0 @@ -/* Test for format attributes: test bad uses of __attribute__. */ -/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ -/* { dg-do compile { target { *-*-mingw* } } } */ -/* { dg-options "-std=gnu99 -Wformat" } */ - -#define USE_SYSTEM_FORMATS -#include "format.h" - -/* Proper uses of the attributes. */ -extern void fa0 (const char *, ...) __attribute__((format(ms_printf, 1, 2))); -extern void fa1 (char *, ...) __attribute__((format(ms_printf, 1, 2))); -extern char *fa2 (const char *) __attribute__((format_arg(1))); -extern char *fa3 (char *) __attribute__((format_arg(1))); - -/* Uses with too few or too many arguments. */ -extern void fb0 (const char *, ...) __attribute__((format)); /* { dg-error "wrong number of arguments" "bad format" } */ -extern void fb1 (const char *, ...) __attribute__((format())); /* { dg-error "wrong number of arguments" "bad format" } */ -extern void fb2 (const char *, ...) __attribute__((format(ms_printf))); /* { dg-error "wrong number of arguments" "bad format" } */ -extern void fb3 (const char *, ...) __attribute__((format(ms_printf, 1))); /* { dg-error "wrong number of arguments" "bad format" } */ -extern void fb4 (const char *, ...) __attribute__((format(ms_printf, 1, 2, 3))); /* { dg-error "wrong number of arguments" "bad format" } */ - -extern void fc1 (const char *) __attribute__((format_arg)); /* { dg-error "wrong number of arguments" "bad format_arg" } */ -extern void fc2 (const char *) __attribute__((format_arg())); /* { dg-error "wrong number of arguments" "bad format_arg" } */ -extern void fc3 (const char *) __attribute__((format_arg(1, 2))); /* { dg-error "wrong number of arguments" "bad format_arg" } */ - -/* These attributes presently only apply to declarations, not to types. - Eventually, they should be usable with declarators for function types - anywhere, but still not with structure/union/enum types. */ -struct s0 { int i; } __attribute__((format(ms_printf, 1, 2))); /* { dg-error "does not apply|only applies" "format on struct" } */ -union u0 { int i; } __attribute__((format(ms_printf, 1, 2))); /* { dg-error "does not apply|only applies" "format on union" } */ -enum e0 { E0V0 } __attribute__((format(ms_printf, 1, 2))); /* { dg-error "does not apply|only applies" "format on enum" } */ - -struct s1 { int i; } __attribute__((format_arg(1))); /* { dg-error "does not apply|only applies" "format_arg on struct" } */ -union u1 { int i; } __attribute__((format_arg(1))); /* { dg-error "does not apply|only applies" "format_arg on union" } */ -enum e1 { E1V0 } __attribute__((format_arg(1))); /* { dg-error "does not apply|only applies" "format_arg on enum" } */ - -/* The format type must be an identifier, one of those recognized. */ -extern void fe0 (const char *, ...) __attribute__((format(12345, 1, 2))); /* { dg-error "format specifier" "non-id format" } */ -extern void fe1 (const char *, ...) __attribute__((format(nosuch, 1, 2))); /* { dg-warning "format function type" "unknown format" } */ - -/* Both the numbers must be integer constant expressions. */ -extern void ff0 (const char *, ...) __attribute__((format(ms_printf, 3-2, (long long)(10/5)))); -int foo; -extern void ff1 (const char *, ...) __attribute__((format(ms_printf, foo, 10/5))); /* { dg-error "invalid operand" "bad number" } */ -extern void ff2 (const char *, ...) __attribute__((format(ms_printf, 3-2, foo))); /* { dg-error "invalid operand" "bad number" } */ -extern char *ff3 (const char *) __attribute__((format_arg(3-2))); -extern char *ff4 (const char *) __attribute__((format_arg(foo))); /* { dg-error "invalid operand" "bad format_arg number" } */ - -/* The format string argument must precede the arguments to be formatted. - This includes if no parameter types are specified (which is not valid ISO - C for variadic functions). */ -extern void fg0 () __attribute__((format(ms_printf, 1, 2))); -extern void fg1 () __attribute__((format(ms_printf, 1, 0))); -extern void fg2 () __attribute__((format(ms_printf, 1, 1))); /* { dg-error "follows" "bad number order" } */ -extern void fg3 () __attribute__((format(ms_printf, 2, 1))); /* { dg-error "follows" "bad number order" } */ - -/* The format string argument must be a string type, and the arguments to - be formatted must be the "...". */ -extern void fh0 (int, ...) __attribute__((format(ms_printf, 1, 2))); /* { dg-error "not a string" "format int string" } */ -extern void fh1 (signed char *, ...) __attribute__((format(ms_printf, 1, 2))); /* { dg-error "not a string" "signed char string" } */ -extern void fh2 (unsigned char *, ...) __attribute__((format(ms_printf, 1, 2))); /* { dg-error "not a string" "unsigned char string" } */ -extern void fh3 (const char *, ...) __attribute__((format(ms_printf, 1, 3))); /* { dg-error "is not" "not ..." } */ -extern void fh4 (const char *, int, ...) __attribute__((format(ms_printf, 1, 2))); /* { dg-error "is not" "not ..." } */ - -/* format_arg formats must take and return a string. */ -extern char *fi0 (int) __attribute__((format_arg(1))); /* { dg-error "not a string" "format_arg int string" } */ -extern char *fi1 (signed char *) __attribute__((format_arg(1))); /* { dg-error "not a string" "format_arg signed char string" } */ -extern char *fi2 (unsigned char *) __attribute__((format_arg(1))); /* { dg-error "not a string" "format_arg unsigned char string" } */ -extern int fi3 (const char *) __attribute__((format_arg(1))); /* { dg-error "not return string" "format_arg ret int string" } */ -extern signed char *fi4 (const char *) __attribute__((format_arg(1))); /* { dg-error "not return string" "format_arg ret signed char string" } */ -extern unsigned char *fi5 (const char *) __attribute__((format_arg(1))); /* { dg-error "not return string" "format_arg ret unsigned char string" } */ diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_attr-4.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_attr-4.c deleted file mode 100644 index 45f09ef22..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_attr-4.c +++ /dev/null @@ -1,26 +0,0 @@ -/* Test for format attributes: test use of __attribute__ - in prefix attributes. */ -/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ -/* { dg-do compile { target { *-*-mingw* } } } */ -/* { dg-options "-std=gnu99 -Wformat" } */ - -#define USE_SYSTEM_FORMATS -#include "format.h" - -extern __attribute__((format(ms_printf, 1, 2))) void tformatprintf0 (const char *, ...); -extern void __attribute__((format(ms_printf, 1, 2))) tformatprintf1 (const char *, ...); -extern void foo (void), __attribute__((format(ms_printf, 1, 2))) tformatprintf2 (const char *, ...); -extern __attribute__((noreturn)) void bar (void), __attribute__((format(ms_printf, 1, 2))) tformatprintf3 (const char *, ...); - -void -baz (int i, int *ip, double d) -{ - tformatprintf0 ("%d", i); - tformatprintf0 ("%"); /* { dg-warning "format" "attribute format printf case 0" } */ - tformatprintf1 ("%d", i); - tformatprintf1 ("%"); /* { dg-warning "format" "attribute format printf case 1" } */ - tformatprintf2 ("%d", i); - tformatprintf2 ("%"); /* { dg-warning "format" "attribute format printf case 2" } */ - tformatprintf3 ("%d", i); - tformatprintf3 ("%"); /* { dg-warning "format" "attribute format printf case 3" } */ -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_attr-7.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_attr-7.c deleted file mode 100644 index b169e2c3a..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_attr-7.c +++ /dev/null @@ -1,35 +0,0 @@ -/* Test for format attributes: test applying them to types. */ -/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ -/* { dg-do compile { target { *-*-mingw* } } } */ -/* { dg-options "-std=gnu99 -Wformat" } */ - -#define DONT_GNU_PROTOTYPE -#include "format.h" - -__attribute__((format(ms_printf, 1, 2))) void (*tformatprintf0) (const char *, ...); -void (*tformatprintf1) (const char *, ...) __attribute__((format(ms_printf, 1, 2))); -void (__attribute__((format(ms_printf, 1, 2))) *tformatprintf2) (const char *, ...); -void (__attribute__((format(ms_printf, 1, 2))) ****tformatprintf3) (const char *, ...); - -char * (__attribute__((format_arg(1))) *tformat_arg) (const char *); - -void -baz (int i) -{ - (*tformatprintf0) ("%d", i); - (*tformatprintf0) ((*tformat_arg) ("%d"), i); - (*tformatprintf0) ("%"); /* { dg-warning "format" "prefix" } */ - (*tformatprintf0) ((*tformat_arg) ("%")); /* { dg-warning "format" "prefix" } */ - (*tformatprintf1) ("%d", i); - (*tformatprintf1) ((*tformat_arg) ("%d"), i); - (*tformatprintf1) ("%"); /* { dg-warning "format" "postfix" } */ - (*tformatprintf1) ((*tformat_arg) ("%")); /* { dg-warning "format" "postfix" } */ - (*tformatprintf2) ("%d", i); - (*tformatprintf2) ((*tformat_arg) ("%d"), i); - (*tformatprintf2) ("%"); /* { dg-warning "format" "nested" } */ - (*tformatprintf2) ((*tformat_arg) ("%")); /* { dg-warning "format" "nested" } */ - (****tformatprintf3) ("%d", i); - (****tformatprintf3) ((*tformat_arg) ("%d"), i); - (****tformatprintf3) ("%"); /* { dg-warning "format" "nested 2" } */ - (****tformatprintf3) ((*tformat_arg) ("%")); /* { dg-warning "format" "nested 2" } */ -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_bitfld-1.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_bitfld-1.c deleted file mode 100644 index 83eb2fec6..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_bitfld-1.c +++ /dev/null @@ -1,52 +0,0 @@ -/* Test for printf formats and bit-fields: bug 22421. */ -/* Origin: Joseph Myers <joseph@codesourcery.com> */ -/* { dg-do compile { target { *-*-mingw* } } } */ -/* { dg-options "-std=gnu99 -Wformat" } */ -/* { dg-require-effective-target int32plus } */ - -#define USE_SYSTEM_FORMATS -#include "format.h" - -struct s { - unsigned int u1 : 1; - signed int s1 : 1; - unsigned int u15 : 15; - signed int s15 : 15; - unsigned int u16 : 16; - signed int s16 : 16; - unsigned long u31 : 31; - signed long s31 : 31; - unsigned long u32 : 32; - signed long s32 : 32; - unsigned long long u48 : 48; -} x; - -void -foo (void) -{ - printf ("%d%u", x.u1, x.u1); - printf ("%d%u", x.s1, x.s1); - printf ("%d%u", x.u15, x.u15); - printf ("%d%u", x.s15, x.s15); - printf ("%d%u", x.u16, x.u16); - printf ("%d%u", x.s16, x.s16); -#if __INT_MAX__ > 32767 - /* If integers are 16 bits, there doesn't seem to be a way of - printing these without getting an error. */ - printf ("%d%u", x.u31, x.u31); - printf ("%d%u", x.s31, x.s31); -#endif -#if __LONG_MAX__ > 2147483647 && __INT_MAX__ >= 2147483647 - /* If long is wider than 32 bits, the 32-bit bit-fields are int or - unsigned int or promote to those types. Otherwise, long is 32 - bits and the bit-fields are of type plain long or unsigned - long. */ - printf ("%d%u", x.u32, x.u32); - printf ("%d%u", x.s32, x.s32); -#else - printf ("%ld%lu", x.u32, x.u32); - printf ("%ld%lu", x.s32, x.s32); -#endif - printf ("%I64u", x.u48); /* { dg-warning "has type '.*unsigned int:48'" } */ - printf ("%I64u", (unsigned long long)x.u48); -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_branch-1.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_branch-1.c deleted file mode 100644 index fe3f80e57..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_branch-1.c +++ /dev/null @@ -1,28 +0,0 @@ -/* Test for format checking of conditional expressions. */ -/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ -/* { dg-do compile { target { *-*-mingw* } } } */ -/* { dg-options "-std=gnu99 -Wformat" } */ - -#define USE_SYSTEM_FORMATS -#include "format.h" - -void -foo (long l, int nfoo) -{ - printf ((nfoo > 1) ? "%d foos" : "%d foo", nfoo); - printf ((l > 1) ? "%d foos" : "%d foo", l); /* { dg-warning "int" "wrong type in conditional expr" } */ - printf ((l > 1) ? "%ld foos" : "%d foo", l); /* { dg-warning "int" "wrong type in conditional expr" } */ - printf ((l > 1) ? "%d foos" : "%ld foo", l); /* { dg-warning "int" "wrong type in conditional expr" } */ - /* Should allow one case to have extra arguments. */ - printf ((nfoo > 1) ? "%d foos" : "1 foo", nfoo); - printf ((nfoo > 1) ? "many foos" : "1 foo", nfoo); /* { dg-warning "too many" "too many args in all branches" } */ - printf ((nfoo > 1) ? "%d foos" : "", nfoo); - printf ((nfoo > 1) ? "%d foos" : ((nfoo > 0) ? "1 foo" : "no foos"), nfoo); - printf ((nfoo > 1) ? "%d foos" : ((nfoo > 0) ? "%d foo" : "%d foos"), nfoo); - printf ((nfoo > 1) ? "%d foos" : ((nfoo > 0) ? "%d foo" : "%ld foos"), nfoo); /* { dg-warning "long int" "wrong type" } */ - printf ((nfoo > 1) ? "%ld foos" : ((nfoo > 0) ? "%d foo" : "%d foos"), nfoo); /* { dg-warning "long int" "wrong type" } */ - printf ((nfoo > 1) ? "%d foos" : ((nfoo > 0) ? "%ld foo" : "%d foos"), nfoo); /* { dg-warning "long int" "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 *-*-* } 26 } */ -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_c90-printf-1.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_c90-printf-1.c deleted file mode 100644 index cce2342a5..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_c90-printf-1.c +++ /dev/null @@ -1,184 +0,0 @@ -/* Test for printf formats. Formats using C90 features, including cases - where C90 specifies some aspect of the format to be ignored or where - the behavior is undefined. -*/ -/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ -/* { dg-do compile { target { *-*-mingw* } } } */ -/* { dg-options "-std=iso9899:1990 -pedantic -Wformat" } */ - -#define USE_SYSTEM_FORMATS -#include "format.h" - -void -foo (int i, int i1, int i2, unsigned int u, double d, char *s, void *p, - int *n, short int *hn, long int l, unsigned long int ul, - long int *ln, long double ld, wint_t lc, wchar_t *ls, llong ll, - ullong ull, unsigned int *un, const int *cn, signed char *ss, - unsigned char *us, const signed char *css, unsigned int u1, - unsigned int u2) -{ - /* See ISO/IEC 9899:1990 (E) subclause 7.9.6.1 (pages 131-134). */ - /* Basic sanity checks for the different components of a format. */ - printf ("%d\n", i); - printf ("%+d\n", i); - printf ("%3d\n", i); - printf ("%-3d\n", i); - printf ("%*d\n", i1, i); - printf ("%d %lu\n", i, ul); - /* Bogus use of width. */ - printf ("%5n\n", n); /* { dg-warning "width" "width with %n" } */ - /* Valid and invalid %% constructions. Some of the warning messages - are non-optimal, but they do detect the errorneous nature of the - format string. - */ - printf ("%%"); - printf ("%-%"); /* { dg-warning "format" "bogus %%" } */ - printf ("%-%\n"); /* { dg-warning "format" "bogus %%" } */ - printf ("%5%\n"); /* { dg-warning "format" "bogus %%" } */ - printf ("%h%\n"); /* { dg-warning "format" "bogus %%" } */ - /* Valid and invalid %h, %l, %L constructions. */ - printf ("%hd", i); - printf ("%hi", i); - /* Strictly, these parameters should be int or unsigned int according to - what unsigned short promotes to. However, GCC ignores sign - differences in format checking here, and this is relied on to get the - correct checking without print_char_table needing to know whether - int and short are the same size. - */ - printf ("%ho%hu%hx%hX", u, u, u, u); - printf ("%hn", hn); - printf ("%hf", d); /* { dg-warning "length" "bad use of %h" } */ - printf ("%he", d); /* { dg-warning "length" "bad use of %h" } */ - printf ("%hE", d); /* { dg-warning "length" "bad use of %h" } */ - printf ("%hg", d); /* { dg-warning "length" "bad use of %h" } */ - printf ("%hG", d); /* { dg-warning "length" "bad use of %h" } */ - printf ("%hc", i); - printf ("%hs", hn); - printf ("%hp", p); /* { dg-warning "length" "bad use of %h" } */ - printf ("%h"); /* { dg-warning "conversion lacks type" "bare %h" } */ - printf ("%ld%li%lo%lu%lx%lX", l, l, ul, ul, ul, ul); - printf ("%ln", ln); - printf ("%lf", d); /* { dg-warning "length|C" "bad use of %l" } */ - printf ("%le", d); /* { dg-warning "length|C" "bad use of %l" } */ - printf ("%lE", d); /* { dg-warning "length|C" "bad use of %l" } */ - printf ("%lg", d); /* { dg-warning "length|C" "bad use of %l" } */ - printf ("%lG", d); /* { dg-warning "length|C" "bad use of %l" } */ - printf ("%lp", p); /* { dg-warning "length|C" "bad use of %l" } */ - /* These next two were added in C94, but should be objected to in C90. - For the first one, GCC has wanted wchar_t instead of the correct C94 - and C99 wint_t. - */ - printf ("%lc", lc); /* { dg-warning "length|C" "C90 bad use of %l" } */ - printf ("%ls", ls); /* { dg-warning "length|C" "C90 bad use of %l" } */ - /* Valid uses of each bare conversion. */ - printf ("%d%i%o%u%x%X%f%e%E%g%G%c%s%p%n%%", i, i, u, u, u, u, d, d, d, d, d, - i, s, p, n); - /* Uses of the - flag (valid on all non-%, non-n conversions). */ - printf ("%-d%-i%-o%-u%-x%-X%-f%-e%-E%-g%-G%-c%-s%-p", i, i, u, u, u, u, - d, d, d, d, d, i, s, p); - printf ("%-n", n); /* { dg-warning "flag" "bad use of %-n" } */ - /* Uses of the + flag (valid on signed conversions only). */ - printf ("%+d%+i%+f%+e%+E%+g%+G\n", i, i, d, d, d, d, d); - printf ("%+o", u); /* { dg-warning "flag" "bad use of + flag" } */ - printf ("%+u", u); /* { dg-warning "flag" "bad use of + flag" } */ - printf ("%+x", u); /* { dg-warning "flag" "bad use of + flag" } */ - printf ("%+X", u); /* { dg-warning "flag" "bad use of + flag" } */ - printf ("%+c", i); /* { dg-warning "flag" "bad use of + flag" } */ - printf ("%+s", s); /* { dg-warning "flag" "bad use of + flag" } */ - printf ("%+p", p); /* { dg-warning "flag" "bad use of + flag" } */ - printf ("%+n", n); /* { dg-warning "flag" "bad use of + flag" } */ - /* Uses of the space flag (valid on signed conversions only, and ignored - with +). - */ - printf ("% +d", i); /* { dg-warning "use of both|ignored" "use of space and + flags" } */ - printf ("%+ d", i); /* { dg-warning "use of both|ignored" "use of space and + flags" } */ - printf ("% d% i% f% e% E% g% G\n", i, i, d, d, d, d, d); - printf ("% o", u); /* { dg-warning "flag" "bad use of space flag" } */ - printf ("% u", u); /* { dg-warning "flag" "bad use of space flag" } */ - printf ("% x", u); /* { dg-warning "flag" "bad use of space flag" } */ - printf ("% X", u); /* { dg-warning "flag" "bad use of space flag" } */ - printf ("% c", i); /* { dg-warning "flag" "bad use of space flag" } */ - printf ("% s", s); /* { dg-warning "flag" "bad use of space flag" } */ - printf ("% p", p); /* { dg-warning "flag" "bad use of space flag" } */ - printf ("% n", n); /* { dg-warning "flag" "bad use of space flag" } */ - /* Uses of the # flag. */ - printf ("%#o%#x%#X%#e%#E%#f%#g%#G", u, u, u, d, d, d, d, d); - printf ("%#d", i); /* { dg-warning "flag" "bad use of # flag" } */ - printf ("%#i", i); /* { dg-warning "flag" "bad use of # flag" } */ - printf ("%#u", u); /* { dg-warning "flag" "bad use of # flag" } */ - printf ("%#c", i); /* { dg-warning "flag" "bad use of # flag" } */ - printf ("%#s", s); /* { dg-warning "flag" "bad use of # flag" } */ - printf ("%#p", p); /* { dg-warning "flag" "bad use of # flag" } */ - printf ("%#n", n); /* { dg-warning "flag" "bad use of # flag" } */ - /* Uses of the 0 flag. */ - printf ("%08d%08i%08o%08u%08x%08X%08e%08E%08f%08g%08G", i, i, u, u, u, u, - d, d, d, d, d); - printf ("%0c", i); /* { dg-warning "flag" "bad use of 0 flag" } */ - printf ("%0s", s); /* { dg-warning "flag" "bad use of 0 flag" } */ - printf ("%0p", p); /* { dg-warning "flag" "bad use of 0 flag" } */ - printf ("%0n", n); /* { dg-warning "flag" "bad use of 0 flag" } */ - /* 0 flag ignored with - flag. */ - printf ("%-08d", i); /* { dg-warning "flags|ignored" "0 flag ignored with - flag" } */ - printf ("%-08i", i); /* { dg-warning "flags|ignored" "0 flag ignored with - flag" } */ - printf ("%-08o", u); /* { dg-warning "flags|ignored" "0 flag ignored with - flag" } */ - printf ("%-08u", u); /* { dg-warning "flags|ignored" "0 flag ignored with - flag" } */ - printf ("%-08x", u); /* { dg-warning "flags|ignored" "0 flag ignored with - flag" } */ - printf ("%-08X", u); /* { dg-warning "flags|ignored" "0 flag ignored with - flag" } */ - printf ("%-08e", d); /* { dg-warning "flags|ignored" "0 flag ignored with - flag" } */ - printf ("%-08E", d); /* { dg-warning "flags|ignored" "0 flag ignored with - flag" } */ - printf ("%-08f", d); /* { dg-warning "flags|ignored" "0 flag ignored with - flag" } */ - printf ("%-08g", d); /* { dg-warning "flags|ignored" "0 flag ignored with - flag" } */ - printf ("%-08G", d); /* { dg-warning "flags|ignored" "0 flag ignored with - flag" } */ - /* Various tests of bad argument types. */ - printf ("%d", l); /* { dg-warning "format" "bad argument types" } */ - printf ("%ld", i); /* { dg-warning "format" "bad argument types" } */ - printf ("%s", n); /* { dg-warning "format" "bad argument types" } */ - printf ("%p", i); /* { dg-warning "format" "bad argument types" } */ - printf ("%n", p); /* { dg-warning "format" "bad argument types" } */ - /* With -pedantic, we want some further checks for pointer targets: - %p should allow only pointers to void (possibly qualified) and - to character types (possibly qualified), but not function pointers - or pointers to other types. (Whether, in fact, character types are - allowed here is unclear; see thread on comp.std.c, July 2000 for - discussion of the requirements of rules on identical representation, - and of the application of the as if rule with the new va_arg - allowances in C99 to printf.) Likewise, we should warn if - pointer targets differ in signedness, except in some circumstances - for character pointers. (In C99 we should consider warning for - char * or unsigned char * being passed to %hhn, even if strictly - legitimate by the standard.) - */ - printf ("%p", foo); /* { dg-warning "format" "bad argument types" } */ - printf ("%n", un); /* { dg-warning "format" "bad argument types" } */ - printf ("%p", n); /* { dg-warning "format" "bad argument types" } */ - /* Allow character pointers with %p. */ - printf ("%p%p%p%p", s, ss, us, css); - /* %s allows any character type. */ - printf ("%s%s%s%s", s, ss, us, css); - /* Warning for void * arguments for %s is GCC's historical behavior, - and seems useful to keep, even if some standard versions might be - read to permit it. - */ - printf ("%s", p); /* { dg-warning "format" "bad argument types" } */ - /* The historical behavior is to allow signed / unsigned types - interchangably as arguments. For values representable in both types, - such usage may be correct. For now preserve the behavior of GCC - in such cases. - */ - printf ("%d", u); - /* Wrong number of arguments. */ - printf ("%d%d", i); /* { dg-warning "matching" "wrong number of args" } */ - printf ("%d", i, i); /* { dg-warning "arguments" "wrong number of args" } */ - /* Miscellaneous bogus constructions. */ - printf (""); /* { dg-warning "zero-length" "warning for empty format" } */ - printf ("\0"); /* { dg-warning "embedded" "warning for embedded NUL" } */ - printf ("%d\0", i); /* { dg-warning "embedded" "warning for embedded NUL" } */ - printf ("%d\0%d", i, i); /* { dg-warning "embedded|too many" "warning for embedded NUL" } */ - printf (NULL); /* { dg-warning "null" "null format string warning" } */ - printf ("%"); /* { dg-warning "trailing" "trailing % warning" } */ - printf ("%++d", i); /* { dg-warning "repeated" "repeated flag warning" } */ - printf ("%n", cn); /* { dg-warning "constant" "%n with const" } */ - printf ((const char *)L"foo"); /* { dg-warning "wide" "wide string" } */ - printf ("%n", (int *)0); /* { dg-warning "null" "%n with NULL" } */ - printf ("%s", (char *)0); /* { dg-warning "null" "%s with NULL" } */ -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_c90-printf-2.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_c90-printf-2.c deleted file mode 100644 index b53955881..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_c90-printf-2.c +++ /dev/null @@ -1,25 +0,0 @@ -/* Test for printf formats. Formats using C99 features should be rejected - outside of C99 mode. -*/ -/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ -/* { dg-do compile { target { *-*-mingw* } } } */ -/* { dg-options "-std=iso9899:1990 -pedantic -Wformat" } */ - -#define USE_SYSTEM_FORMATS -#include "format.h" - -void -foo (int i, double d, llong ll, intmax_t j, size_t z, ptrdiff_t t) -{ - /* Some tests already in c90-printf-1.c, e.g. %lf. */ - /* The widths hh, ll, j, z, t are new. */ - printf ("%hhd", i); /* { dg-warning "unknown|format" "%hh is unsupported" } */ - printf ("%I64d", ll); /* { dg-warning "length|C" "%I64 in C90" } */ - printf ("%jd", j); /* { dg-warning "unknown|format" "%j is unsupported" } */ - printf ("%zu", z); /* { dg-warning "unknown|format" "%z is unsupported" } */ - printf ("%td", t); /* { dg-warning "unknown|format" "%t is unsupported" } */ - /* The formats F, a, A are new. */ - printf ("%F", d); /* { dg-warning "unknown|format" "%F is unsupported" } */ - printf ("%a", d); /* { dg-warning "unknown|format" "%a is unsupported" } */ - printf ("%A", d); /* { dg-warning "unknown|format" "%A is unsupported" } */ -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_c90-printf-3.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_c90-printf-3.c deleted file mode 100644 index 8e4b19a77..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_c90-printf-3.c +++ /dev/null @@ -1,43 +0,0 @@ -/* Test for printf formats. Test that the C90 functions get their default - attributes in strict C90 mode, but the C99 and gettext functions - do not. -*/ -/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ -/* { dg-do compile { target { *-*-mingw* } } } */ -/* { dg-options "-std=iso9899:1990 -pedantic -Wformat" } */ - -#define USE_SYSTEM_FORMATS -#include "format.h" - -void -foo (int i, char *s, size_t n, va_list v0, va_list v1, va_list v2, va_list v3, - va_list v4, va_list v5, va_list v6, va_list v7, va_list v8) -{ - fprintf (stdout, "%d", i); - fprintf (stdout, "%ld", i); /* { dg-warning "format" "fprintf" } */ - printf ("%d", i); - printf ("%ld", i); /* { dg-warning "format" "printf" } */ - /* The "unlocked" functions shouldn't warn in c90 mode. */ - fprintf_unlocked (stdout, "%ld", i); - printf_unlocked ("%ld", i); - sprintf (s, "%d", i); - sprintf (s, "%ld", i); /* { dg-warning "format" "sprintf" } */ - vfprintf (stdout, "%d", v0); - vfprintf (stdout, "%Y", v1); /* { dg-warning "format" "vfprintf" } */ - vprintf ("%d", v2); - vprintf ("%Y", v3); /* { dg-warning "format" "vprintf" } */ - /* The following used to give a bogus warning. */ - vprintf ("%*.*d", v8); /* { dg-bogus "format" "vprintf" } */ - vsprintf (s, "%d", v4); - vsprintf (s, "%Y", v5); /* { dg-warning "format" "Y is invalid" } */ - snprintf (s, n, "%d", i); - snprintf (s, n, "%ld", i); - vsnprintf (s, n, "%d", v6); - vsnprintf (s, n, "%Y", v7); - printf (gettext ("%d"), i); - printf (gettext ("%ld"), i); - printf (dgettext ("", "%d"), i); - printf (dgettext ("", "%ld"), i); - printf (dcgettext ("", "%d", 0), i); - printf (dcgettext ("", "%ld", 0), i); -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_c90-scanf-1.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_c90-scanf-1.c deleted file mode 100644 index f52ed20ea..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_c90-scanf-1.c +++ /dev/null @@ -1,119 +0,0 @@ -/* Test for scanf formats. Formats using C90 features, including cases - where C90 specifies some aspect of the format to be ignored or where - the behavior is undefined. -*/ -/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ -/* { dg-do compile { target { *-*-mingw* } } } */ -/* { dg-options "-std=iso9899:1990 -pedantic -Wformat" } */ - -#define USE_SYSTEM_FORMATS -#include "format.h" - -void -foo (int *ip, unsigned int *uip, short int *hp, unsigned short int *uhp, - long int *lp, unsigned long int *ulp, float *fp, double *dp, - long double *ldp, char *s, signed char *ss, unsigned char *us, - void **pp, int *n, llong *llp, ullong *ullp, wchar_t *ls, - const int *cip, const int *cn, const char *cs, const void **ppc, - void *const *pcp, short int *hn, long int *ln, void *p, char **sp, - volatile void *ppv) -{ - /* See ISO/IEC 9899:1990 (E) subclause 7.9.6.2 (pages 134-138). */ - /* Basic sanity checks for the different components of a format. */ - scanf ("%d", ip); - scanf ("%*d"); - scanf ("%3d", ip); - scanf ("%hd", hp); - scanf ("%3ld", lp); - scanf ("%*3d"); - scanf ("%d %ld", ip, lp); - /* Valid and invalid %% constructions. */ - scanf ("%%"); - scanf ("%*%"); /* { dg-warning "format" "bogus %%" } */ - scanf ("%*%\n"); /* { dg-warning "format" "bogus %%" } */ - scanf ("%4%"); /* { dg-warning "format" "bogus %%" } */ - scanf ("%4%\n"); /* { dg-warning "format" "bogus %%" } */ - scanf ("%h%"); /* { dg-warning "format" "bogus %%" } */ - scanf ("%h%\n"); /* { dg-warning "format" "bogus %%" } */ - /* Valid, invalid and silly assignment-suppression constructions. */ - scanf ("%*d%*i%*o%*u%*x%*X%*e%*E%*f%*g%*G%*s%*[abc]%*c%*p"); - scanf ("%*2d%*8s%*3c"); - scanf ("%*n", n); /* { dg-warning "suppress" "suppression of %n" } */ - scanf ("%*hd"); /* { dg-warning "together" "suppression with length" } */ - /* Valid, invalid and silly width constructions. */ - scanf ("%2d%3i%4o%5u%6x%7X%8e%9E%10f%11g%12G%13s%14[abc]%15c%16p", - ip, ip, uip, uip, uip, uip, fp, fp, fp, fp, fp, s, s, s, pp); - scanf ("%0d", ip); /* { dg-warning "width" "warning for zero width" } */ - scanf ("%3n", n); /* { dg-warning "width" "width with %n" } */ - /* Valid and invalid %h, %l, %L constructions. */ - scanf ("%hd%hi%ho%hu%hx%hX%hn", hp, hp, uhp, uhp, uhp, uhp, hn); - scanf ("%he", fp); /* { dg-warning "length" "bad use of %h" } */ - scanf ("%hE", fp); /* { dg-warning "length" "bad use of %h" } */ - scanf ("%hf", fp); /* { dg-warning "length" "bad use of %h" } */ - scanf ("%hg", fp); /* { dg-warning "length" "bad use of %h" } */ - scanf ("%hG", fp); /* { dg-warning "length" "bad use of %h" } */ - scanf ("%hs", hp); - scanf ("%h[ac]", s); /* { dg-warning "length" "bad use of %h" } */ - scanf ("%hc", hp); - scanf ("%hp", pp); /* { dg-warning "length" "bad use of %h" } */ - scanf ("%h"); /* { dg-warning "conversion lacks type" "bare %h" } */ - scanf ("%h."); /* { dg-warning "conversion" "bogus %h" } */ - scanf ("%ld%li%lo%lu%lx%lX%ln", lp, lp, ulp, ulp, ulp, ulp, ln); - scanf ("%le%lE%lf%lg%lG", dp, dp, dp, dp, dp); - scanf ("%lp", pp); /* { dg-warning "length" "bad use of %l" } */ - /* These next three formats were added in C94. */ - scanf ("%ls", ls); /* { dg-warning "length|C" "bad use of %l" } */ - scanf ("%l[ac]", ls); /* { dg-warning "length|C" "bad use of %l" } */ - scanf ("%lc", ls); /* { dg-warning "length|C" "bad use of %l" } */ - scanf ("%Ld", llp); /* { dg-warning "unknown|format" "%L is unsupported" } */ - scanf ("%Li", llp); /* { dg-warning "unknown|format" "%L is unsupported" } */ - scanf ("%Lo", ullp); /* { dg-warning "unknown|format" "%L is unsupported" } */ - scanf ("%Lu", ullp); /* { dg-warning "unknown|format" "%L is unsupported" } */ - scanf ("%Lx", ullp); /* { dg-warning "unknown|format" "%L is unsupported" } */ - scanf ("%LX", ullp); /* { dg-warning "unknown|format" "%L is unsupported" } */ - scanf ("%Ls", s); /* { dg-warning "unknown|format" "%L is unsupported" } */ - scanf ("%L[ac]", s); /* { dg-warning "unknown|format" "%L is unsupported" } */ - scanf ("%Lc", s); /* { dg-warning "unknown|format" "%L is unsupported" } */ - scanf ("%Lp", pp); /* { dg-warning "unknown|format" "%L is unsupported" } */ - scanf ("%Ln", n); /* { dg-warning "unknown|format" "%L is unsupported" } */ - /* Valid uses of each bare conversion. */ - scanf ("%d%i%o%u%x%X%e%E%f%g%G%s%[abc]%c%p%n%%", ip, ip, uip, uip, uip, - uip, fp, fp, fp, fp, fp, s, s, s, pp, n); - /* Allow other character pointers with %s, %c, %[]. */ - scanf ("%2s%3s%4c%5c%6[abc]%7[abc]", ss, us, ss, us, ss, us); - /* Further tests for %[]. */ - scanf ("%[%d]%d", s, ip); - scanf ("%[^%d]%d", s, ip); - scanf ("%[]%d]%d", s, ip); - scanf ("%[^]%d]%d", s, ip); - scanf ("%[%d]%d", s, ip); - scanf ("%[]abcd", s); /* { dg-warning "no closing" "incomplete scanset" } */ - /* Various tests of bad argument types. Some of these are only pedantic - warnings. - */ - scanf ("%d", lp); /* { dg-warning "format" "bad argument types" } */ - scanf ("%d", uip); /* { dg-warning "format" "bad argument types" } */ - scanf ("%d", pp); /* { dg-warning "format" "bad argument types" } */ - scanf ("%p", ppc); /* { dg-warning "format" "bad argument types" } */ - scanf ("%p", ppv); /* { dg-warning "format" "bad argument types" } */ - scanf ("%s", n); /* { dg-warning "format" "bad argument types" } */ - scanf ("%s", p); /* { dg-warning "format" "bad argument types" } */ - scanf ("%p", p); /* { dg-warning "format" "bad argument types" } */ - scanf ("%p", sp); /* { dg-warning "format" "bad argument types" } */ - /* Tests for writing into constant values. */ - scanf ("%d", cip); /* { dg-warning "constant" "%d writing into const" } */ - scanf ("%n", cn); /* { dg-warning "constant" "%n writing into const" } */ - scanf ("%s", cs); /* { dg-warning "constant" "%s writing into const" } */ - scanf ("%p", pcp); /* { dg-warning "constant" "%p writing into const" } */ - /* Wrong number of arguments. */ - scanf ("%d%d", ip); /* { dg-warning "matching" "wrong number of args" } */ - scanf ("%d", ip, ip); /* { dg-warning "arguments" "wrong number of args" } */ - /* Miscellaneous bogus constructions. */ - scanf (""); /* { dg-warning "zero-length" "warning for empty format" } */ - scanf ("\0"); /* { dg-warning "embedded" "warning for embedded NUL" } */ - scanf ("%d\0", ip); /* { dg-warning "embedded" "warning for embedded NUL" } */ - scanf ("%d\0%d", ip, ip); /* { dg-warning "embedded|too many" "warning for embedded NUL" } */ - scanf (NULL); /* { dg-warning "null" "null format string warning" } */ - scanf ("%"); /* { dg-warning "trailing" "trailing % warning" } */ - scanf ("%d", (int *)0); /* { dg-warning "null" "writing into NULL" } */ -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_c90-scanf-2.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_c90-scanf-2.c deleted file mode 100644 index b55122792..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_c90-scanf-2.c +++ /dev/null @@ -1,26 +0,0 @@ -/* Test for scanf formats. Formats using C99 features should be rejected - outside of C99 mode. -*/ -/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ -/* { dg-do compile { target { *-*-mingw* } } } */ -/* { dg-options "-std=iso9899:1990 -pedantic -Wformat" } */ - -#define USE_SYSTEM_FORMATS -#include "format.h" - -void -foo (signed char *hhp, float *fp, llong *llp, intmax_t *jp, - size_t *zp, ptrdiff_t *tp) -{ - /* Some tests already in c90-scanf-1.c. */ - /* The widths hh, ll, j, z, t are new. */ - scanf ("%hhd", hhp); /* { dg-warning "unknown|format" "%hh is unsupported" } */ - scanf ("%I64d", llp); /* { dg-warning "length|C" "%I64 in C90" } */ - scanf ("%jd", jp); /* { dg-warning "unknown|format" "%j is unsupported" } */ - scanf ("%zu", zp); /* { dg-warning "unknown|format" "%z is unsupported" } */ - scanf ("%td", tp); /* { dg-warning "unknown|format" "%t is unsupported" } */ - /* The formats F, a, A are new. */ - scanf ("%F", fp); /* { dg-warning "unknown|format" "%F is unsupported" } */ - scanf ("%a", fp); /* { dg-warning "unknown|format" "%a is unsupported" } */ - scanf ("%A", fp); /* { dg-warning "unknown|format" "%A is unsupported" } */ -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_c90-scanf-3.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_c90-scanf-3.c deleted file mode 100644 index b9d3e38bc..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_c90-scanf-3.c +++ /dev/null @@ -1,20 +0,0 @@ -/* Test for scanf formats. Formats using extensions to the standard - should be rejected in strict pedantic mode. -*/ -/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ -/* { dg-do compile { target { *-*-mingw* } } } */ -/* { dg-options "-std=iso9899:1990 -pedantic -Wformat" } */ - -#define USE_SYSTEM_FORMATS -#include "format.h" - -void -foo (char **sp, wchar_t **lsp) -{ - /* %a formats for allocation, only recognized in C90 mode, are a - GNU extension. - */ - scanf ("%as", sp); /* { dg-warning "flag" "%as is unsupported" } */ - scanf ("%aS", lsp); /* { dg-warning "format|flag" "%aS is unsupported" } */ - scanf ("%a[bcd]", sp); /* { dg-warning "flag" "%a[] is unsupported" } */ -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_c90-scanf-4.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_c90-scanf-4.c deleted file mode 100644 index 4b1fda7ca..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_c90-scanf-4.c +++ /dev/null @@ -1,31 +0,0 @@ -/* Test for scanf formats. Test that the C90 functions get their default - attributes in strict C90 mode, but the C99 and gettext functions - do not. -*/ -/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ -/* { dg-do compile { target { *-*-mingw* } } } */ -/* { dg-options "-std=iso9899:1990 -pedantic -Wformat" } */ - -#define USE_SYSTEM_FORMATS -#include "format.h" - -void -foo (int *ip, char *s, va_list v0, va_list v1, va_list v2, va_list v3, - va_list v4, va_list v5) -{ - fscanf (stdin, "%d", ip); - fscanf (stdin, "%ld", ip); /* { dg-warning "format" "fscanf" } */ - scanf ("%d", ip); - scanf ("%ld", ip); /* { dg-warning "format" "scanf" } */ - sscanf (s, "%d", ip); - sscanf (s, "%ld", ip); /* { dg-warning "format" "sscanf" } */ - vfscanf (stdin, "%d", v0); - vscanf ("%d", v2); - vsscanf (s, "%d", v4); - scanf (gettext ("%d"), ip); - scanf (gettext ("%ld"), ip); - scanf (dgettext ("", "%d"), ip); - scanf (dgettext ("", "%ld"), ip); - scanf (dcgettext ("", "%d", 0), ip); - scanf (dcgettext ("", "%ld", 0), ip); -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_c90-scanf-5.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_c90-scanf-5.c deleted file mode 100644 index c714689e0..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_c90-scanf-5.c +++ /dev/null @@ -1,20 +0,0 @@ -/* Test for scanf formats. Formats using extensions to the standard - should be rejected in strict pedantic mode. -*/ -/* { dg-do compile { target { *-*-mingw* } } } */ -/* { dg-options "-std=iso9899:1990 -pedantic -Wformat" } */ - -#define USE_SYSTEM_FORMATS -#include "format.h" - -void -foo (char **sp, wchar_t **lsp) -{ - /* m assignment-allocation modifier, recognized in both C90 - and C99 modes, is a POSIX and ISO/IEC WDTR 24731-2 extension. */ - scanf ("%ms", sp); /* { dg-warning "unknown|format" "%ms is unsupported" } */ - scanf ("%mS", lsp); /* { dg-warning "unknown|format" "%mS is unsupported" } */ - scanf ("%mls", lsp); /* { dg-warning "unknown|format" "%mls is unsupported" } */ - scanf ("%m[bcd]", sp); /* { dg-warning "unknown|format" "%m[] is unsupported" } */ - scanf ("%ml[bcd]", lsp); /* { dg-warning "unknown|format" "%ml[] is unsupported" } */ -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_c90-strftime-1.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_c90-strftime-1.c deleted file mode 100644 index 34143c1b2..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_c90-strftime-1.c +++ /dev/null @@ -1,20 +0,0 @@ -/* Test for strftime formats. Formats using C90 features. */ -/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ -/* { dg-do compile { target { *-*-mingw* } } } */ -/* { dg-options "-std=iso9899:1990 -pedantic -Wformat -Wformat-y2k" } */ - -#define USE_SYSTEM_FORMATS -#include "format.h" - -void -foo (char *s, size_t m, const struct tm *tp) -{ - /* See ISO/IEC 9899:1990 (E) subclause 7.12.3.5 (pages 174-175). */ - /* Formats which are Y2K-compliant (no 2-digit years). */ - strftime (s, m, "%a%A%b%B%d%H%I%j%m%M%p%S%U%w%W%X%Y%Z%%", tp); - /* Formats with 2-digit years. */ - strftime (s, m, "%y", tp); /* { dg-warning "only last 2" "2-digit year" } */ - /* Formats with 2-digit years in some locales. */ - strftime (s, m, "%c", tp); /* { dg-warning "some locales" "2-digit year" } */ - strftime (s, m, "%x", tp); /* { dg-warning "some locales" "2-digit year" } */ -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_c90-strftime-2.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_c90-strftime-2.c deleted file mode 100644 index 446f23533..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_c90-strftime-2.c +++ /dev/null @@ -1,28 +0,0 @@ -/* Test for strftime formats. Rejection of formats using C99 features in - pedantic C90 mode. */ -/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ -/* { dg-do compile { target { *-*-mingw* } } } */ -/* { dg-options "-std=iso9899:1990 -pedantic -Wformat -Wformat-y2k" } */ - -#define USE_SYSTEM_FORMATS -#include "format.h" - -void -foo (char *s, size_t m, const struct tm *tp) -{ - strftime (s, m, "%C", tp); /* { dg-warning "format" "%C is unsupported" } */ - strftime (s, m, "%D", tp); /* { dg-warning "format" "%D is unsupported" } */ - strftime (s, m, "%e", tp); /* { dg-warning "format" "%e is unsupported" } */ - strftime (s, m, "%F", tp); /* { dg-warning "format" "%F is unsupported" } */ - strftime (s, m, "%g", tp); /* { dg-warning "format" "%g is unsupported" } */ - strftime (s, m, "%G", tp); /* { dg-warning "format" "%G is unsupported" } */ - strftime (s, m, "%h", tp); /* { dg-warning "format" "%h is unsupported" } */ - strftime (s, m, "%n", tp); /* { dg-warning "format" "%n is unsupported" } */ - strftime (s, m, "%r", tp); /* { dg-warning "format" "%r is unsupported" } */ - strftime (s, m, "%R", tp); /* { dg-warning "format" "%R is unsupported" } */ - strftime (s, m, "%t", tp); /* { dg-warning "format" "%t is unsupported" } */ - strftime (s, m, "%T", tp); /* { dg-warning "format" "%T is unsupported" } */ - strftime (s, m, "%u", tp); /* { dg-warning "format" "%u is unsupported" } */ - strftime (s, m, "%V", tp); /* { dg-warning "format" "%V is unsupported" } */ - strftime (s, m, "%z", tp); /* { dg-warning "C" "%z not in C90" } */ -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_c94-printf-1.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_c94-printf-1.c deleted file mode 100644 index 8a7a12e3f..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_c94-printf-1.c +++ /dev/null @@ -1,19 +0,0 @@ -/* Test for printf formats. Changes in C94 to C90. */ -/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ -/* { dg-do compile { target { *-*-mingw* } } } */ -/* { dg-options "-std=iso9899:199409 -pedantic -Wformat" } */ - -#define USE_SYSTEM_FORMATS -#include "format.h" - -void -foo (wint_t lc, wchar_t *ls) -{ - /* See ISO/IEC 9899:1990 (E) subclause 7.9.6.1 (pages 131-134), - as amended by ISO/IEC 9899:1990/Amd.1:1995 (E) (pages 4-5). - We do not repeat here all the C90 format checks, but just verify - that %ls and %lc are accepted without warning. - */ - printf ("%lc", lc); - printf ("%ls", ls); -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_c94-scanf-1.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_c94-scanf-1.c deleted file mode 100644 index 85b300f4f..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_c94-scanf-1.c +++ /dev/null @@ -1,18 +0,0 @@ -/* Test for scanf formats. Changes in C94 to C90. */ -/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ -/* { dg-do compile { target { *-*-mingw* } } } */ -/* { dg-options "-std=iso9899:199409 -pedantic -Wformat" } */ - -#define USE_SYSTEM_FORMATS -#include "format.h" - -void -foo (wchar_t *ls) -{ - /* See ISO/IEC 9899:1990 (E) subclause 7.9.6.2 (pages 134-138), - as amended by ISO/IEC 9899:1990/Amd.1:1995 (E) (pages 5-6). - We do not repeat here all the C90 format checks, but just verify - that %ls, %lc, %l[] are accepted without warning. - */ - scanf ("%lc%ls%l[abc]", ls, ls, ls); -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_c99-printf-1.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_c99-printf-1.c deleted file mode 100644 index ad5634ceb..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_c99-printf-1.c +++ /dev/null @@ -1,109 +0,0 @@ -/* Test for printf formats. Formats using C99 features, including cases - where C99 specifies some aspect of the format to be ignored or where - the behavior is undefined. -*/ -/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ -/* { dg-do compile { target { *-*-mingw* } } } */ -/* { dg-options "-std=iso9899:1999 -pedantic -Wformat" } */ - -#define USE_SYSTEM_FORMATS -#include "format.h" - -void -foo (int i, unsigned int u, double d, char *s, void *p, int *n, - long double ld, wint_t lc, wchar_t *ls, long long int ll, - unsigned long long int ull, signed char *ss, unsigned char *us, - long long int *lln, intmax_t j, uintmax_t uj, intmax_t *jn, - size_t z, signed_size_t sz, signed_size_t *zn, - ptrdiff_t t, ptrdiff_t *tn) -{ - /* See ISO/IEC 9899:1999 (E) subclause 7.19.6.1 (pages 273-281). - We do not repeat here most of the checks for correct C90 formats - or completely broken formats. - */ - /* Valid and invalid %h, %hh, %l, %j, %z, %t, %L constructions. */ - printf ("%hf", d); /* { dg-warning "length" "bad use of %h" } */ - printf ("%hF", d); /* { dg-warning "unknown|format" "bad use of %hF" } */ - printf ("%he", d); /* { dg-warning "length" "bad use of %h" } */ - printf ("%hE", d); /* { dg-warning "length" "bad use of %h" } */ - printf ("%hg", d); /* { dg-warning "length" "bad use of %h" } */ - printf ("%hG", d); /* { dg-warning "length" "bad use of %h" } */ - printf ("%ha", d); /* { dg-warning "unknown|format" "bad use of %ha" } */ - printf ("%hA", d); /* { dg-warning "unknown|format" "bad use of %hA" } */ - printf ("%hc", i); - printf ("%hs", (short *)s); - printf ("%hp", p); /* { dg-warning "length" "bad use of %h" } */ - printf ("%lc", lc); - printf ("%ls", ls); - printf ("%lp", p); /* { dg-warning "length|C" "bad use of %l" } */ - /* Valid uses of each bare conversion. */ - printf ("%d%i%o%u%x%X%f%e%E%g%G%c%s%p%n%%", i, i, u, u, u, u, - d, d, d, d, d, i, s, p, n); - /* Uses of the - flag (valid on all non-%, non-n conversions). */ - printf ("%-d%-i%-o%-u%-x%-X%-f%-e%-E%-g%-G%-c%-s%-p", i, i, - u, u, u, u, d, d, d, d, d, i, s, p); - printf ("%-n", n); /* { dg-warning "flag" "bad use of %-n" } */ - /* Uses of the + flag (valid on signed conversions only). */ - printf ("%+d%+i%+f%+e%+E%+g%+G\n", i, i, d, d, d, d, d); - printf ("%+o", u); /* { dg-warning "flag" "bad use of + flag" } */ - printf ("%+u", u); /* { dg-warning "flag" "bad use of + flag" } */ - printf ("%+x", u); /* { dg-warning "flag" "bad use of + flag" } */ - printf ("%+X", u); /* { dg-warning "flag" "bad use of + flag" } */ - printf ("%+c", i); /* { dg-warning "flag" "bad use of + flag" } */ - printf ("%+s", s); /* { dg-warning "flag" "bad use of + flag" } */ - printf ("%+p", p); /* { dg-warning "flag" "bad use of + flag" } */ - printf ("%+n", n); /* { dg-warning "flag" "bad use of + flag" } */ - /* Uses of the space flag (valid on signed conversions only, and ignored - with +). - */ - printf ("% +d", i); /* { dg-warning "use of both|ignored" "use of space and + flags" } */ - printf ("%+ d", i); /* { dg-warning "use of both|ignored" "use of space and + flags" } */ - printf ("% d% i% f% e% E% g% G\n", i, i, d, d, d, d, d); - printf ("% o", u); /* { dg-warning "flag" "bad use of space flag" } */ - printf ("% u", u); /* { dg-warning "flag" "bad use of space flag" } */ - printf ("% x", u); /* { dg-warning "flag" "bad use of space flag" } */ - printf ("% X", u); /* { dg-warning "flag" "bad use of space flag" } */ - printf ("% c", i); /* { dg-warning "flag" "bad use of space flag" } */ - printf ("% s", s); /* { dg-warning "flag" "bad use of space flag" } */ - printf ("% p", p); /* { dg-warning "flag" "bad use of space flag" } */ - printf ("% n", n); /* { dg-warning "flag" "bad use of space flag" } */ - /* Uses of the # flag. */ - printf ("%#o%#x%#X%#e%#E%#f%#g%#G", u, u, u, d, d, d, - d, d); - printf ("%#d", i); /* { dg-warning "flag" "bad use of # flag" } */ - printf ("%#i", i); /* { dg-warning "flag" "bad use of # flag" } */ - printf ("%#u", u); /* { dg-warning "flag" "bad use of # flag" } */ - printf ("%#c", i); /* { dg-warning "flag" "bad use of # flag" } */ - printf ("%#s", s); /* { dg-warning "flag" "bad use of # flag" } */ - printf ("%#p", p); /* { dg-warning "flag" "bad use of # flag" } */ - printf ("%#n", n); /* { dg-warning "flag" "bad use of # flag" } */ - /* Uses of the 0 flag. */ - printf ("%08d%08i%08o%08u%08x%08X%08e%08E%08f%08g%08G", i, i, - u, u, u, u, d, d, d, d, d); - printf ("%0c", i); /* { dg-warning "flag" "bad use of 0 flag" } */ - printf ("%0s", s); /* { dg-warning "flag" "bad use of 0 flag" } */ - printf ("%0p", p); /* { dg-warning "flag" "bad use of 0 flag" } */ - printf ("%0n", n); /* { dg-warning "flag" "bad use of 0 flag" } */ - /* 0 flag ignored with - flag. */ - printf ("%-08d", i); /* { dg-warning "flags|ignored" "0 flag ignored with - flag" } */ - printf ("%-08i", i); /* { dg-warning "flags|ignored" "0 flag ignored with - flag" } */ - printf ("%-08o", u); /* { dg-warning "flags|ignored" "0 flag ignored with - flag" } */ - printf ("%-08u", u); /* { dg-warning "flags|ignored" "0 flag ignored with - flag" } */ - printf ("%-08x", u); /* { dg-warning "flags|ignored" "0 flag ignored with - flag" } */ - printf ("%-08X", u); /* { dg-warning "flags|ignored" "0 flag ignored with - flag" } */ - printf ("%-08e", d); /* { dg-warning "flags|ignored" "0 flag ignored with - flag" } */ - printf ("%-08E", d); /* { dg-warning "flags|ignored" "0 flag ignored with - flag" } */ - printf ("%-08f", d); /* { dg-warning "flags|ignored" "0 flag ignored with - flag" } */ - printf ("%-08F", d); /* { dg-warning "unknown|format" "0 flag ignored with - flag" } */ - printf ("%-08g", d); /* { dg-warning "flags|ignored" "0 flag ignored with - flag" } */ - printf ("%-08G", d); /* { dg-warning "flags|ignored" "0 flag ignored with - flag" } */ - printf ("%-08a", d); /* { dg-warning "unknown|format" "0 flag ignored with - flag" } */ - printf ("%-08A", d); /* { dg-warning "unknown|format" "0 flag ignored with - flag" } */ - /* Various tests of bad argument types. Mostly covered in c90-printf-1.c; - here just test for pointer target sign with %hhn. (Probably allowed - by the standard, but a bad idea, so GCC should diagnose if what - is used is not signed char *.) - */ - printf ("%hhn", s); /* { dg-warning "unknown|format" "%hhn is unsupported" } */ - printf ("%hhn", us); /* { dg-warning "unknown|format" "%hhn is unsupported" } */ -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_c99-printf-2.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_c99-printf-2.c deleted file mode 100644 index 0a4d3160d..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_c99-printf-2.c +++ /dev/null @@ -1,32 +0,0 @@ -/* Test for printf formats. Formats using extensions to the standard - should be rejected in strict pedantic mode. -*/ -/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ -/* { dg-do compile { target { *-*-mingw* } } } */ -/* { dg-options "-std=iso9899:1999 -pedantic -Wformat" } */ - -#define USE_SYSTEM_FORMATS -#include "format.h" - -void -foo (int i, long long ll, size_t z, wint_t lc, wchar_t *ls) -{ - /* The length modifiers q, Z and L as applied to integer formats are - extensions. - */ - printf ("%qd", ll); /* { dg-warning "unknown|format" "%q length is unsupported" } */ - printf ("%Ld", ll); /* { dg-warning "unknown|format" "%L length is unsupported" } */ - printf ("%Zd", z); /* { dg-warning "unknown|format" "%Z length is unsupported" } */ - /* The conversion specifiers C and S are X/Open extensions; the - conversion specifier m is a GNU extension. - */ - printf ("%m"); /* { dg-warning "unknown" "printf %m is unsupported" } */ - printf ("%C", lc); /* { dg-warning "C" "printf %C" } */ - printf ("%S", ls); /* { dg-warning "C" "printf %S" } */ - /* The flag character ', and the use of operand number $ formats, are - X/Open extensions. - */ - printf ("%'d", i); /* { dg-warning "C" "printf ' flag" } */ - printf ("%1$d", i); /* { dg-warning "C" "printf $ format" } */ - printf ("%Ix", z); /* { dg-warning "C" "printf I format" } */ -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_c99-printf-3.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_c99-printf-3.c deleted file mode 100644 index d8c51eaa0..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_c99-printf-3.c +++ /dev/null @@ -1,40 +0,0 @@ -/* Test for printf formats. Test that the C99 functions get their default - attributes in strict C99 mode, but the gettext functions do not. -*/ -/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ -/* { dg-do compile { target { *-*-mingw* } } } */ -/* { dg-options "-std=iso9899:1999 -pedantic -Wformat" } */ - -#define USE_SYSTEM_FORMATS -#include "format.h" - -void -foo (int i, char *s, size_t n, va_list v0, va_list v1, va_list v2, va_list v3, - va_list v4, va_list v5, va_list v6, va_list v7) -{ - fprintf (stdout, "%d", i); - fprintf (stdout, "%ld", i); /* { dg-warning "format" "fprintf" } */ - printf ("%d", i); - printf ("%ld", i); /* { dg-warning "format" "printf" } */ - /* The "unlocked" functions shouldn't warn in c99 mode. */ - fprintf_unlocked (stdout, "%ld", i); - printf_unlocked ("%ld", i); - sprintf (s, "%d", i); - sprintf (s, "%ld", i); /* { dg-warning "format" "sprintf" } */ - snprintf (s, n, "%d", i); - snprintf (s, n, "%ld", i); /* { dg-warning "format" "snprintf" } */ - vfprintf (stdout, "%d", v0); - vfprintf (stdout, "%Y", v1); /* { dg-warning "format" "vfprintf" } */ - vprintf ("%d", v0); - vprintf ("%Y", v1); /* { dg-warning "format" "vprintf" } */ - vsprintf (s, "%d", v0); - vsprintf (s, "%Y", v1); /* { dg-warning "format" "vsprintf" } */ - vsnprintf (s, n, "%d", v0); - vsnprintf (s, n, "%Y", v1); /* { dg-warning "format" "vsnprintf" } */ - printf (gettext ("%d"), i); - printf (gettext ("%ld"), (long) i); - printf (dgettext ("", "%d"), i); - printf (dgettext ("", "%ld"), (long) i); - printf (dcgettext ("", "%d", 0), i); - printf (dcgettext ("", "%ld", 0), (long) i); -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_c99-scanf-1.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_c99-scanf-1.c deleted file mode 100644 index f4ac706e7..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_c99-scanf-1.c +++ /dev/null @@ -1,63 +0,0 @@ -/* Test for scanf formats. Formats using C99 features, including cases - where C99 specifies some aspect of the format to be ignored or where - the behavior is undefined. -*/ -/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ -/* { dg-do compile { target { *-*-mingw* } } } */ -/* { dg-options "-std=iso9899:1999 -pedantic -Wformat" } */ - -#define USE_SYSTEM_FORMATS -#include "format.h" - -void -foo (int *ip, unsigned int *uip, short int *hp, unsigned short int *uhp, - signed char *hhp, unsigned char *uhhp, long int *lp, - unsigned long int *ulp, float *fp, double *dp, long double *ldp, char *s, - void **pp, int *n, long long *llp, unsigned long long *ullp, wchar_t *ls, - short int *hn, signed char *hhn, long int *ln, long long int *lln, - intmax_t *jp, uintmax_t *ujp, intmax_t *jn, size_t *zp, - signed_size_t *szp, signed_size_t *zn, ptrdiff_t *tp, - unsigned_ptrdiff_t *utp, ptrdiff_t *tn) -{ - /* See ISO/IEC 9899:1999 (E) subclause 7.19.6.2 (pages 281-288). - We do not repeat here most of the checks for correct C90 formats - or completely broken formats. - */ - /* Valid, invalid and silly assignment-suppression - and width constructions. - */ - scanf ("%*d%*i%*o%*u%*x%*X%*e%*E%*f%*g%*G%*s%*[abc]%*c%*p"); - scanf ("%*2d%*8s%*3c"); - scanf ("%*n", n); /* { dg-warning "suppress" "suppression of %n" } */ - scanf ("%*hd"); /* { dg-warning "together" "suppression with length" } */ - scanf ("%2d%3i%4o%5u%6x%7X%10e%11E%12f%14g%15G%16s%3[abc]%4c%5p", - ip, ip, uip, uip, uip, uip, fp, fp, fp, fp, fp, - s, s, s, pp); - scanf ("%0d", ip); /* { dg-warning "width" "warning for zero width" } */ - scanf ("%3n", n); /* { dg-warning "width" "width with %n" } */ - /* Valid and invalid %h, %hh, %l, %j, %z, %t, %L constructions. */ - scanf ("%hd%hi%ho%hu%hx%hX%hn", hp, hp, uhp, uhp, uhp, uhp, hn); - scanf ("%he", fp); /* { dg-warning "length" "bad use of %h" } */ - scanf ("%hE", fp); /* { dg-warning "length" "bad use of %h" } */ - scanf ("%hf", fp); /* { dg-warning "length" "bad use of %h" } */ - scanf ("%hg", fp); /* { dg-warning "length" "bad use of %h" } */ - scanf ("%hG", fp); /* { dg-warning "length" "bad use of %h" } */ - scanf ("%hs", hp); - scanf ("%h[ac]", s); /* { dg-warning "length" "bad use of %h" } */ - scanf ("%hc", (short *)s); - scanf ("%hp", pp); /* { dg-warning "length" "bad use of %h" } */ - scanf ("%hhd", hhp); /* { dg-warning "unknown|format" "%hh is unsupported" } */ - scanf ("%ld%li%lo%lu%lx%lX%ln", lp, lp, ulp, ulp, ulp, ulp, ln); - scanf ("%le%lE%lf%lg%lG", dp, dp, dp, dp, dp); - scanf ("%lp", pp); /* { dg-warning "length" "bad use of %l" } */ - scanf ("%ls", ls); - scanf ("%l[ac]", ls); - scanf ("%lc", ls); - scanf ("%jd", jp); /* { dg-warning "unknown|format" "%j not supported" } */ - scanf ("%zd", zp); /* { dg-warning "unknown|format" "%z not supported" } */ - scanf ("%td", tp); /* { dg-warning "unknown|format" "%t not supported" } */ - scanf ("%Lf", llp); /* { dg-warning "unknown|format" "bad use of %L is not supported" } */ - /* Valid uses of each bare conversion. */ - scanf ("%d%i%o%u%x%X%e%E%f%g%G%s%[abc]%c%p%n%%", ip, ip, uip, uip, uip, - uip, fp, fp, fp, fp, fp, s, s, s, pp, n); -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_c99-scanf-2.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_c99-scanf-2.c deleted file mode 100644 index e16f5bfc3..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_c99-scanf-2.c +++ /dev/null @@ -1,27 +0,0 @@ -/* Test for scanf formats. Formats using extensions to the standard - should be rejected in strict pedantic mode. -*/ -/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ -/* { dg-do compile { target { *-*-mingw* } } } */ -/* { dg-options "-std=iso9899:1999 -pedantic -Wformat" } */ - -#define USE_SYSTEM_FORMATS -#include "format.h" - -void -foo (int *ip, long long int *llp, wchar_t *ls) -{ - /* The length modifiers q and L as applied to integer formats are - extensions. - */ - scanf ("%qd", llp); /* { dg-warning "unknown|format" "%q is unsupported" } */ - scanf ("%Ld", llp); /* { dg-warning "unknown|format" "%L is unsupported" } */ - /* The conversion specifiers C and S are X/Open extensions. */ - scanf ("%C", ls); /* { dg-warning "C" "scanf %C" } */ - scanf ("%S", ls); /* { dg-warning "C" "scanf %S" } */ - /* The use of operand number $ formats is an X/Open extension. */ - scanf ("%1$d", ip); /* { dg-warning "C" "scanf $ format" } */ - /* glibc also supports flags ' and I on scanf formats as an extension. */ - scanf ("%'d", ip); /* { dg-warning "C" "scanf ' flag" } */ - scanf ("%Id", (ssize_t *)ip); /* { dg-warning "C" "scanf I flag" } */ -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_c99-scanf-3.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_c99-scanf-3.c deleted file mode 100644 index cde2f3703..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_c99-scanf-3.c +++ /dev/null @@ -1,33 +0,0 @@ -/* Test for scanf formats. Test that the C99 functions get their default - attributes in strict C99 mode, but the gettext functions do not. -*/ -/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ -/* { dg-do compile { target { *-*-mingw* } } } */ -/* { dg-options "-std=iso9899:1999 -pedantic -Wformat" } */ - -#define USE_SYSTEM_FORMATS -#include "format.h" - -void -foo (int *ip, char *s, va_list v0, va_list v1, va_list v2, va_list v3, - va_list v4, va_list v5) -{ - fscanf (stdin, "%d", ip); - fscanf (stdin, "%ld", ip); /* { dg-warning "format" "fscanf" } */ - scanf ("%d", ip); - scanf ("%ld", ip); /* { dg-warning "format" "scanf" } */ - sscanf (s, "%d", ip); - sscanf (s, "%ld", ip); /* { dg-warning "format" "sscanf" } */ - vfscanf (stdin, "%d", v0); - vfscanf (stdin, "%Y", v1); /* { dg-warning "format" "vfscanf" } */ - vscanf ("%d", v2); - vscanf ("%Y", v3); /* { dg-warning "format" "vscanf" } */ - vsscanf (s, "%d", v4); - vsscanf (s, "%Y", v5); /* { dg-warning "format" "vsscanf" } */ - scanf (gettext ("%d"), ip); - scanf (gettext ("%ld"), ip); - scanf (dgettext ("", "%d"), ip); - scanf (dgettext ("", "%ld"), ip); - scanf (dcgettext ("", "%d", 0), ip); - scanf (dcgettext ("", "%ld", 0), ip); -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_c99-scanf-4.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_c99-scanf-4.c deleted file mode 100644 index bddc11dd1..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_c99-scanf-4.c +++ /dev/null @@ -1,20 +0,0 @@ -/* Test for scanf formats. Formats using extensions to the standard - should be rejected in strict pedantic mode. -*/ -/* { dg-do compile { target { *-*-mingw* } } } */ -/* { dg-options "-std=iso9899:1999 -pedantic -Wformat" } */ - -#define USE_SYSTEM_FORMATS -#include "format.h" - -void -foo (char **sp, wchar_t **lsp) -{ - /* m assignment-allocation modifier, recognized in both C90 - and C99 modes, is a POSIX and ISO/IEC WDTR 24731-2 extension. */ - scanf ("%ms", sp); /* { dg-warning "unknown|format" "%ms is unsupported" } */ - scanf ("%mS", lsp); /* { dg-warning "unknown|format" "%mS is unsupported" } */ - scanf ("%mls", lsp); /* { dg-warning "unknown|format" "%mls is unsupported" } */ - scanf ("%m[bcd]", sp); /* { dg-warning "unknown|format" "%m[] is unsupported" } */ - scanf ("%ml[bcd]", lsp); /* { dg-warning "unknown|format" "%ml[] is unsupported" } */ -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_c99-strftime-1.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_c99-strftime-1.c deleted file mode 100644 index 743972efa..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_c99-strftime-1.c +++ /dev/null @@ -1,20 +0,0 @@ -/* Test for strftime formats. Formats using C99 features. */ -/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ -/* { dg-do compile { target { *-*-mingw* } } } */ -/* { dg-options "-std=iso9899:1999 -pedantic -Wformat -Wformat-y2k" } */ - -#define USE_SYSTEM_FORMATS -#include "format.h" - -void -foo (char *s, size_t m, const struct tm *tp) -{ - /* See ISO/IEC 9899:1990 (E) subclause 7.12.3.5 (pages 174-175). */ - /* Formats which are Y2K-compliant (no 2-digit years). */ - strftime (s, m, "%a%A%b%B%d%H%I%j%m%M%p%S%U%w%W%X%Y%z%Z%%", tp); - /* Formats with 2-digit years. */ - strftime (s, m, "%y", tp); /* { dg-warning "only last 2" "2-digit year" } */ - /* Formats with 2-digit years in some locales. */ - strftime (s, m, "%c", tp); /* { dg-warning "some locales" "2-digit year" } */ - strftime (s, m, "%x", tp); /* { dg-warning "some locales" "2-digit year" } */ -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_c99-strftime-2.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_c99-strftime-2.c deleted file mode 100644 index 9a6ae3545..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_c99-strftime-2.c +++ /dev/null @@ -1,20 +0,0 @@ -/* Test for strftime formats. Rejection of extensions in pedantic mode. */ -/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ -/* { dg-do compile { target { *-*-mingw* } } } */ -/* { dg-options "-std=iso9899:1999 -pedantic -Wformat" } */ - -#define USE_SYSTEM_FORMATS -#include "format.h" - -void -foo (char *s, size_t m, const struct tm *tp) -{ - /* %P is a lowercase version of %p. */ - strftime (s, m, "%P", tp); /* { dg-warning "unknown" "strftime %P" } */ - /* %k is %H but padded with a space rather than 0 if necessary. */ - strftime (s, m, "%k", tp); /* { dg-warning "unknown" "strftime %k" } */ - /* %l is %I but padded with a space rather than 0 if necessary. */ - strftime (s, m, "%l", tp); /* { dg-warning "unknown" "strftime %l" } */ - /* %s is the number of seconds since the Epoch. */ - strftime (s, m, "%s", tp); /* { dg-warning "unknown" "strftime %s" } */ -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_cast-1.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_cast-1.c deleted file mode 100644 index 08659616e..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_cast-1.c +++ /dev/null @@ -1,17 +0,0 @@ -/* Test for strings cast through integer types: should not be treated - as format strings unless the types are of the same width as - pointers (intptr_t or similar). */ -/* Origin: Joseph Myers <joseph@codesourcery.com> */ -/* { dg-do compile { target { *-*-mingw* } } } */ -/* { dg-options "-Wformat" } */ - -#define USE_SYSTEM_FORMATS -#include "format.h" - -void -f (int x) -{ - printf("%s", x); /* { dg-warning "format" } */ - printf((char *)(size_t)"%s", x); /* { dg-warning "format" } */ - printf((char *)(char)"%s", x); /* { dg-warning "cast from pointer to integer of different size" } */ -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_miss-1.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_miss-1.c deleted file mode 100644 index b6c71c04f..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_miss-1.c +++ /dev/null @@ -1,40 +0,0 @@ -/* Test for warnings for missing format attributes. */ -/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ -/* { dg-do compile { target { *-*-mingw* } } } */ -/* { dg-options "-std=gnu99 -Wmissing-format-attribute" } */ - -#define USE_SYSTEM_FORMATS -#include "format.h" - -void -foo (const char *fmt, ...) -{ - va_list ap; - va_start (ap, fmt); - vprintf (fmt, ap); /* { dg-warning "candidate" "printf attribute warning" } */ - va_end (ap); -} - -void -bar (const char *fmt, ...) -{ - va_list ap; - va_start (ap, fmt); - vscanf (fmt, ap); /* { dg-warning "candidate" "scanf attribute warning" } */ - va_end (ap); -} - -__attribute__((__format__(__ms_printf__, 1, 2))) void -foo2 (const char *fmt, ...) -{ - va_list ap; - va_start (ap, fmt); - vprintf (fmt, ap); - va_end (ap); -} - -void -vfoo (const char *fmt, va_list arg) -{ - vprintf (fmt, arg); /* { dg-warning "candidate" "printf attribute warning 2" } */ -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_miss-2.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_miss-2.c deleted file mode 100644 index e0dd465f8..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_miss-2.c +++ /dev/null @@ -1,17 +0,0 @@ -/* Test for warnings for missing format attributes. Don't warn if no - relevant parameters for a format attribute; see c/1017. */ -/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ -/* { dg-do compile { target { *-*-mingw* } } } */ -/* { dg-options "-std=gnu99 -Wmissing-format-attribute" } */ - -#define USE_SYSTEM_FORMATS -#include "format.h" - -void -foo (int i, ...) -{ - va_list ap; - va_start (ap, i); - vprintf ("Foo %s bar %s", ap); /* { dg-bogus "candidate" "bogus printf attribute warning" } */ - va_end (ap); -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_miss-3.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_miss-3.c deleted file mode 100644 index cf41756c0..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_miss-3.c +++ /dev/null @@ -1,27 +0,0 @@ -/* Test warnings for missing format attributes on function pointers. */ -/* Origin: Kaveh Ghazi <ghazi@caip.rutgers.edu> */ -/* { dg-do compile { target { *-*-mingw* } } } */ -/* { dg-options "-std=gnu99 -Wmissing-format-attribute" } */ - -#define USE_SYSTEM_FORMATS -#include "format.h" - -typedef void (*noattr_t) (const char *, ...); -typedef noattr_t __attribute__ ((__format__(__ms_printf__, 1, 2))) attr_t; - -typedef void (*vnoattr_t) (const char *, va_list); -typedef vnoattr_t __attribute__ ((__format__(__ms_printf__, 1, 0))) vattr_t; - -void -foo1 (noattr_t na, attr_t a, vnoattr_t vna, vattr_t va) -{ - noattr_t na1 = na; - noattr_t na2 = a; /* { dg-warning "candidate" "initialization warning" } */ - attr_t a1 = na; - attr_t a2 = a; - - vnoattr_t vna1 = vna; - vnoattr_t vna2 = va; /* { dg-warning "candidate" "initialization warning" } */ - vattr_t va1 = vna; - vattr_t va2 = va; -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_miss-4.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_miss-4.c deleted file mode 100644 index faacf5ce4..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_miss-4.c +++ /dev/null @@ -1,33 +0,0 @@ -/* Test warnings for missing format attributes on function pointers. */ -/* Origin: Kaveh Ghazi <ghazi@caip.rutgers.edu> */ -/* { dg-do compile { target { *-*-mingw* } } } */ -/* { dg-options "-std=gnu99 -Wmissing-format-attribute" } */ - -#define USE_SYSTEM_FORMATS -#include "format.h" - -typedef void (*noattr_t) (const char *, ...); -typedef noattr_t __attribute__ ((__format__(__ms_printf__, 1, 2))) attr_t; - -typedef void (*vnoattr_t) (const char *, va_list); -typedef vnoattr_t __attribute__ ((__format__(__ms_printf__, 1, 0))) vattr_t; - -void -foo1 (noattr_t na, attr_t a, vnoattr_t vna, vattr_t va) -{ - noattr_t na1, na2; - attr_t a1, a2; - - vnoattr_t vna1, vna2; - vattr_t va1, va2; - - na1 = na; - na2 = a; /* { dg-warning "candidate" "assignment warning" } */ - a1 = na; - a2 = a; - - vna1 = vna; - vna2 = va; /* { dg-warning "candidate" "assignment warning" } */ - va1 = vna; - va1 = va; -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_miss-5.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_miss-5.c deleted file mode 100644 index a9f54c3a8..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_miss-5.c +++ /dev/null @@ -1,49 +0,0 @@ -/* Test warnings for missing format attributes on function pointers. */ -/* Origin: Kaveh Ghazi <ghazi@caip.rutgers.edu> */ -/* { dg-do compile { target { *-*-mingw* } } } */ -/* { dg-options "-std=gnu99 -Wmissing-format-attribute" } */ - -#define USE_SYSTEM_FORMATS -#include "format.h" - -typedef void (*noattr_t) (const char *, ...); -typedef noattr_t __attribute__ ((__format__(__ms_printf__, 1, 2))) attr_t; - -typedef void (*vnoattr_t) (const char *, va_list); -typedef vnoattr_t __attribute__ ((__format__(__ms_printf__, 1, 0))) vattr_t; - -noattr_t -foo1 (noattr_t na, attr_t a, int i) -{ - if (i) - return na; - else - return a; /* { dg-warning "candidate" "return type warning" } */ -} - -attr_t -foo2 (noattr_t na, attr_t a, int i) -{ - if (i) - return na; - else - return a; -} - -vnoattr_t -foo3 (vnoattr_t vna, vattr_t va, int i) -{ - if (i) - return vna; - else - return va; /* { dg-warning "candidate" "return type warning" } */ -} - -vattr_t -foo4 (vnoattr_t vna, vattr_t va, int i) -{ - if (i) - return vna; - else - return va; -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_miss-6.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_miss-6.c deleted file mode 100644 index 3e210deee..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_miss-6.c +++ /dev/null @@ -1,32 +0,0 @@ -/* Test warnings for missing format attributes on function pointers. */ -/* Origin: Kaveh Ghazi <ghazi@caip.rutgers.edu> */ -/* { dg-do compile { target { *-*-mingw* } } } */ -/* { dg-options "-std=gnu99 -Wmissing-format-attribute" } */ - -#define USE_SYSTEM_FORMATS -#include "format.h" - -typedef void (*noattr_t) (const char *, ...); -typedef noattr_t __attribute__ ((__format__(__ms_printf__, 1, 2))) attr_t; - -typedef void (*vnoattr_t) (const char *, va_list); -typedef vnoattr_t __attribute__ ((__format__(__ms_printf__, 1, 0))) vattr_t; - -extern void foo1 (noattr_t); -extern void foo2 (attr_t); -extern void foo3 (vnoattr_t); -extern void foo4 (vattr_t); - -void -foo (noattr_t na, attr_t a, vnoattr_t vna, vattr_t va) -{ - foo1 (na); - foo1 (a); /* { dg-warning "candidate" "parameter passing warning" } */ - foo2 (na); - foo2 (a); - - foo3 (vna); - foo3 (va); /* { dg-warning "candidate" "parameter passing warning" } */ - foo4 (vna); - foo4 (va); -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_multattr-1.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_multattr-1.c deleted file mode 100644 index 0936f5f6e..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_multattr-1.c +++ /dev/null @@ -1,51 +0,0 @@ -/* Test for multiple format attributes. Test for printf and scanf attributes - together. */ -/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ -/* { dg-do compile { target { *-*-mingw* } } } */ -/* { dg-options "-std=gnu99 -Wformat" } */ - -#define USE_SYSTEM_FORMATS -#include "format.h" - -/* If we specify multiple attributes for a single function, they should - all apply. This should apply whether they are on the same declaration - or on different declarations. */ - -extern void my_vprintf_scanf (const char *, va_list, const char *, ...) - __attribute__((__format__(__ms_printf__, 1, 0))) - __attribute__((__format__(__ms_scanf__, 3, 4))); - -extern void my_vprintf_scanf2 (const char *, va_list, const char *, ...) - __attribute__((__format__(__ms_scanf__, 3, 4))) - __attribute__((__format__(__ms_printf__, 1, 0))); - -extern void my_vprintf_scanf3 (const char *, va_list, const char *, ...) - __attribute__((__format__(__ms_printf__, 1, 0))); -extern void my_vprintf_scanf3 (const char *, va_list, const char *, ...) - __attribute__((__format__(__ms_scanf__, 3, 4))); - -extern void my_vprintf_scanf4 (const char *, va_list, const char *, ...) - __attribute__((__format__(__ms_scanf__, 3, 4))); -extern void my_vprintf_scanf4 (const char *, va_list, const char *, ...) - __attribute__((__format__(__ms_printf__, 1, 0))); - -void -foo (va_list ap, int *ip, long *lp) -{ - my_vprintf_scanf ("%d", ap, "%d", ip); - my_vprintf_scanf ("%d", ap, "%ld", lp); - my_vprintf_scanf ("%", ap, "%d", ip); /* { dg-warning "format" "printf" } */ - my_vprintf_scanf ("%d", ap, "%ld", ip); /* { dg-warning "format" "scanf" } */ - my_vprintf_scanf2 ("%d", ap, "%d", ip); - my_vprintf_scanf2 ("%d", ap, "%ld", lp); - my_vprintf_scanf2 ("%", ap, "%d", ip); /* { dg-warning "format" "printf" } */ - my_vprintf_scanf2 ("%d", ap, "%ld", ip); /* { dg-warning "format" "scanf" } */ - my_vprintf_scanf3 ("%d", ap, "%d", ip); - my_vprintf_scanf3 ("%d", ap, "%ld", lp); - my_vprintf_scanf3 ("%", ap, "%d", ip); /* { dg-warning "format" "printf" } */ - my_vprintf_scanf3 ("%d", ap, "%ld", ip); /* { dg-warning "format" "scanf" } */ - my_vprintf_scanf4 ("%d", ap, "%d", ip); - my_vprintf_scanf4 ("%d", ap, "%ld", lp); - my_vprintf_scanf4 ("%", ap, "%d", ip); /* { dg-warning "format" "printf" } */ - my_vprintf_scanf4 ("%d", ap, "%ld", ip); /* { dg-warning "format" "scanf" } */ -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_multattr-2.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_multattr-2.c deleted file mode 100644 index 47e20e4d4..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_multattr-2.c +++ /dev/null @@ -1,40 +0,0 @@ -/* Test for multiple format attributes. Test for printf and scanf attributes - together, in different places on the declarations. */ -/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ -/* { dg-do compile { target { *-*-mingw* } } } */ -/* { dg-options "-std=gnu99 -Wformat" } */ - -#define USE_SYSTEM_FORMATS -#include "format.h" - -/* If we specify multiple attributes for a single function, they should - all apply, wherever they are placed on the declarations. */ - -extern __attribute__((__format__(__ms_printf__, 1, 0))) void - my_vprintf_scanf (const char *, va_list, const char *, ...) - __attribute__((__format__(__ms_scanf__, 3, 4))); - -extern void (__attribute__((__format__(__ms_printf__, 1, 0))) my_vprintf_scanf2) - (const char *, va_list, const char *, ...) - __attribute__((__format__(__ms_scanf__, 3, 4))); - -extern __attribute__((__format__(__ms_scanf__, 3, 4))) void - (__attribute__((__format__(__ms_printf__, 1, 0))) my_vprintf_scanf3) - (const char *, va_list, const char *, ...); - -void -foo (va_list ap, int *ip, long *lp) -{ - my_vprintf_scanf ("%d", ap, "%d", ip); - my_vprintf_scanf ("%d", ap, "%ld", lp); - my_vprintf_scanf ("%", ap, "%d", ip); /* { dg-warning "format" "printf" } */ - my_vprintf_scanf ("%d", ap, "%ld", ip); /* { dg-warning "format" "scanf" } */ - my_vprintf_scanf2 ("%d", ap, "%d", ip); - my_vprintf_scanf2 ("%d", ap, "%ld", lp); - my_vprintf_scanf2 ("%", ap, "%d", ip); /* { dg-warning "format" "printf" } */ - my_vprintf_scanf2 ("%d", ap, "%ld", ip); /* { dg-warning "format" "scanf" } */ - my_vprintf_scanf3 ("%d", ap, "%d", ip); - my_vprintf_scanf3 ("%d", ap, "%ld", lp); - my_vprintf_scanf3 ("%", ap, "%d", ip); /* { dg-warning "format" "printf" } */ - my_vprintf_scanf3 ("%d", ap, "%ld", ip); /* { dg-warning "format" "scanf" } */ -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_multattr-3.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_multattr-3.c deleted file mode 100644 index 1a247a7a1..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_multattr-3.c +++ /dev/null @@ -1,29 +0,0 @@ -/* Test for multiple format_arg attributes. Test for both branches - getting checked. */ -/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ -/* { dg-do compile { target { *-*-mingw* } } } */ -/* { dg-options "-std=gnu99 -Wformat" } */ - -#define USE_SYSTEM_FORMATS -#include "format.h" - -extern char *ngettext (const char *, const char *, unsigned long int) - __attribute__((__format_arg__(1))) __attribute__((__format_arg__(2))); - -void -foo (long l, int nfoo) -{ - printf (ngettext ("%d foo", "%d foos", nfoo), nfoo); - printf (ngettext ("%d foo", "%d foos", l), l); /* { dg-warning "int" "wrong type in conditional expr" } */ - printf (ngettext ("%d foo", "%ld foos", l), l); /* { dg-warning "int" "wrong type in conditional expr" } */ - printf (ngettext ("%ld foo", "%d foos", l), l); /* { dg-warning "int" "wrong type in conditional expr" } */ - /* Should allow one case to have extra arguments. */ - printf (ngettext ("1 foo", "%d foos", nfoo), nfoo); - printf (ngettext ("1 foo", "many foos", nfoo), nfoo); /* { dg-warning "too many" "too many args in all branches" } */ - printf (ngettext ("", "%d foos", nfoo), nfoo); - printf (ngettext ("1 foo", (nfoo > 0) ? "%d foos" : "no foos", nfoo), nfoo); - printf (ngettext ("%d foo", (nfoo > 0) ? "%d foos" : "no foos", nfoo), nfoo); - printf (ngettext ("%ld foo", (nfoo > 0) ? "%d foos" : "no foos", nfoo), nfoo); /* { dg-warning "long int" "wrong type" } */ - printf (ngettext ("%d foo", (nfoo > 0) ? "%ld foos" : "no foos", nfoo), nfoo); /* { dg-warning "long int" "wrong type" } */ - printf (ngettext ("%d foo", (nfoo > 0) ? "%d foos" : "%ld foos", nfoo), nfoo); /* { dg-warning "long int" "wrong type" } */ -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_no-exargs-1.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_no-exargs-1.c deleted file mode 100644 index 659ca3e0b..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_no-exargs-1.c +++ /dev/null @@ -1,15 +0,0 @@ -/* Test for warnings for extra format arguments being disabled by - -Wno-format-extra-args. */ -/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ -/* { dg-do compile { target { *-*-mingw* } } } */ -/* { dg-options "-std=gnu99 -Wformat -Wno-format-extra-args" } */ - -#define USE_SYSTEM_FORMATS -#include "format.h" - -void -foo (int i) -{ - printf ("foo", i); - printf ("%1$d", i, i); -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_no-exargs-2.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_no-exargs-2.c deleted file mode 100644 index 654241ddf..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_no-exargs-2.c +++ /dev/null @@ -1,28 +0,0 @@ -/* Test for warnings for extra format arguments being disabled by - -Wno-format-extra-args. Test which warnings still apply with $ - operand numbers. */ -/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ -/* { dg-do compile { target { *-*-mingw* } } } */ -/* { dg-options "-std=gnu99 -Wformat -Wno-format-extra-args" } */ - -#define USE_SYSTEM_FORMATS -#include "format.h" - -void -foo (int i, int *ip, va_list va) -{ - printf ("%3$d%1$d", i, i, i); /* { dg-warning "before used" "unused $ operand" } */ - printf ("%2$d%1$d", i, i, i); - vprintf ("%3$d%1$d", va); /* { dg-warning "before used" "unused $ operand" } */ - /* With scanf formats, gaps in the used arguments are allowed only if the - arguments are all pointers. In such a case, should only give the lesser - warning about unused arguments rather than the more serious one about - argument gaps. */ - scanf ("%3$d%1$d", ip, ip, ip); - /* If there are non-pointer arguments unused at the end, this is also OK. */ - scanf ("%3$d%1$d", ip, ip, ip, i); - scanf ("%3$d%1$d", ip, i, ip); /* { dg-warning "before used" "unused $ scanf non-pointer operand" } */ - /* Can't check the arguments in the vscanf case, so should suppose the - lesser problem. */ - vscanf ("%3$d%1$d", va); -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_no-y2k-1.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_no-y2k-1.c deleted file mode 100644 index aed760aab..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_no-y2k-1.c +++ /dev/null @@ -1,13 +0,0 @@ -/* Test for warnings for Y2K problems not being on by default. */ -/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ -/* { dg-do compile { target { *-*-mingw* } } } */ -/* { dg-options "-std=gnu99 -Wformat" } */ - -#define USE_SYSTEM_FORMATS -#include "format.h" - -void -foo (char *s, size_t m, const struct tm *tp) -{ - strftime (s, m, "%y%c%x", tp); -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_nonlit-1.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_nonlit-1.c deleted file mode 100644 index b29c0080e..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_nonlit-1.c +++ /dev/null @@ -1,14 +0,0 @@ -/* Test for warnings for non-string-literal formats. */ -/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ -/* { dg-do compile { target { *-*-mingw* } } } */ -/* { dg-options "-std=gnu99 -Wformat -Wformat-nonliteral" } */ - -#define USE_SYSTEM_FORMATS -#include "format.h" - -void -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" } */ -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_nonlit-2.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_nonlit-2.c deleted file mode 100644 index e60242187..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_nonlit-2.c +++ /dev/null @@ -1,14 +0,0 @@ -/* Test for warnings for non-string-literal formats. Test with -Wformat=2. */ -/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ -/* { dg-do compile { target { *-*-mingw* } } } */ -/* { dg-options "-std=gnu99 -Wformat=2" } */ - -#define USE_SYSTEM_FORMATS -#include "format.h" - -void -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" } */ -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_nonlit-3.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_nonlit-3.c deleted file mode 100644 index e8c8933bc..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_nonlit-3.c +++ /dev/null @@ -1,13 +0,0 @@ -/* Test for warnings for non-string-literal formats. Test for strftime formats. */ -/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ -/* { dg-do compile { target { *-*-mingw* } } } */ -/* { dg-options "-std=gnu99 -Wformat -Wformat-nonliteral" } */ - -#define USE_SYSTEM_FORMATS -#include "format.h" - -void -foo (char *s, size_t m, const struct tm *tp, char *fmt) -{ - strftime (s, m, fmt, tp); /* { dg-warning "format string" "non-literal" } */ -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_nul-1.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_nul-1.c deleted file mode 100644 index 50bfd546d..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_nul-1.c +++ /dev/null @@ -1,15 +0,0 @@ -/* Test diagnostics for suppressing contains nul - -Wformat. -Wformat. */ -/* Origin: Bruce Korb <bkorb@gnu.org> */ -/* { dg-do compile { target { *-*-mingw* } } } */ -/* { dg-options "-Wformat -Wno-format-contains-nul" } */ - -#define USE_SYSTEM_FORMATS -#include "format.h" - -void -foo (void) -{ - static char const fmt[] = "x%s\0%s\n\0abc"; - printf (fmt+4, fmt+8); /* { dg-bogus "embedded.*in format" "bogus embed warning" } */ -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_nul-2.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_nul-2.c deleted file mode 100644 index 3dfc3c62f..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_nul-2.c +++ /dev/null @@ -1,17 +0,0 @@ -/* Test diagnostics for options used on their own without - -Wformat. -Wformat-. */ -/* Origin: Bruce Korb <bkorb@gnu.org> */ -/* { dg-do compile { target { *-*-mingw* } } } */ -/* { dg-options "-Wformat" } */ - -/* { dg-warning "embedded .* in format" "ignored" { target *-*-* } 0 } */ - -#define USE_SYSTEM_FORMATS -#include "format.h" - -void -fumble (void) -{ - static char const fmt[] = "x%s\0%s\n\0abc"; - printf (fmt+4, fmt+8); -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_null-1.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_null-1.c deleted file mode 100644 index 91495016e..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_null-1.c +++ /dev/null @@ -1,28 +0,0 @@ -/* Test for some aspects of null format string handling. */ -/* Origin: Jason Thorpe <thorpej@wasabisystems.com> */ -/* { dg-do compile { target { *-*-mingw* } } } */ -/* { dg-options "-std=gnu99 -Wformat" } */ - -#define USE_SYSTEM_FORMATS -#include "format.h" - -extern void my_printf (const char *, ...) __attribute__((format(ms_printf,1,2))); -extern const char *my_format (const char *, const char *) - __attribute__((format_arg(2))); - -void -foo (int i1) -{ - /* Warning about a null format string has been decoupled from the actual - format check. However, we still expect to be warned about any excess - arguments after a null format string. */ - my_printf (NULL); - my_printf (NULL, i1); /* { dg-warning "too many" "null format with arguments" } */ - - my_printf (my_format ("", NULL)); - my_printf (my_format ("", NULL), i1); /* { dg-warning "too many" "null format_arg with arguments" } */ - - /* While my_printf allows a null argument, dgettext does not, so we expect - a null argument warning here. */ - my_printf (dgettext ("", NULL)); /* { dg-warning "null" "null format with dgettext" } */ -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_plus-1.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_plus-1.c deleted file mode 100644 index f6eba280a..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_plus-1.c +++ /dev/null @@ -1,21 +0,0 @@ -/* Test for printf formats using string literal plus constant. - */ -/* Origin: Jakub Jelinek <jakub@redhat.com> */ -/* { dg-do compile { target { *-*-mingw* } } } */ -/* { dg-options "-std=iso9899:1990 -pedantic -Wformat=2" } */ - -#define USE_SYSTEM_FORMATS -#include "format.h" - -void -foo (int i) -{ - printf ("%%d\n" + 1, i); - printf (5 + "%.-*d%3d\n", i); - printf ("%d%d" + 2, i, i); /* { dg-warning "arguments" "wrong number of args" } */ - printf (3 + "%d\n"); /* { dg-warning "zero-length" "zero-length string" } */ - printf ("%d\n" + i, i); /* { dg-warning "not a string" "non-constant addend" } */ - printf ("%d\n" + 10); /* { dg-warning "not a string" "too large addend" } */ - printf ("%d\n" - 1, i); /* { dg-warning "not a string" "minus constant" } */ - printf ("%d\n" + -1, i); /* { dg-warning "not a string" "negative addend" } */ -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_sec-1.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_sec-1.c deleted file mode 100644 index 5f6b76726..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_sec-1.c +++ /dev/null @@ -1,13 +0,0 @@ -/* Test for security warning when non-literal format has no arguments. */ -/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ -/* { dg-do compile { target { *-*-mingw* } } } */ -/* { dg-options "-std=gnu99 -Wformat -Wformat-security" } */ - -#define USE_SYSTEM_FORMATS -#include "format.h" - -void -foo (char *s) -{ - printf (s); /* { dg-warning "no format arguments" "security warning" } */ -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_unnamed-1.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_unnamed-1.c deleted file mode 100644 index ac1294282..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_unnamed-1.c +++ /dev/null @@ -1,25 +0,0 @@ -/* Test for warnings with possibly unnamed integer types. Bug 24329. */ -/* Origin: Joseph Myers <joseph@codesourcery.com> */ -/* { dg-do compile { target { *-*-mingw* } } } */ -/* { dg-options "-Wformat" } */ -/* { dg-options "-Wformat -msse" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */ -/* { dg-require-effective-target sse { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */ - -#define USE_SYSTEM_FORMATS -#include "format.h" - -/* Definition of TItype follows same logic as in gcc.dg/titype-1.c, - but must be a #define to avoid giving the type a name. */ -#if (defined(__LP64__) && !defined(__hppa__)) || defined(__SPU__) -#define TItype int __attribute__ ((mode (TI))) -#else -#define TItype long -#endif - -void -f (TItype x) -{ - printf("%d", x); /* { dg-warning "expects argument" } */ - printf("%d", 141592653589793238462643383279502884197169399375105820974944); /* { dg-warning "expects argument" } */ - /* { dg-warning "unsigned only|too large" "constant" { target *-*-* } 23 } */ -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_va-1.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_va-1.c deleted file mode 100644 index 97d2979e8..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_va-1.c +++ /dev/null @@ -1,14 +0,0 @@ -/* Test for strange warning in format checking. */ -/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ -/* { dg-do compile { target { *-*-mingw* } } } */ -/* { dg-options "-Wformat" } */ - -#define USE_SYSTEM_FORMATS -#include "format.h" - -void -foo (void *p) -{ - printf ("%d", p); /* { dg-bogus "va_list" "wrong type in format warning" } */ - /* { dg-warning "format" "format error" { target *-*-* } 12 } */ -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_zero-length-1.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_zero-length-1.c deleted file mode 100644 index d024458a4..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/ms_zero-length-1.c +++ /dev/null @@ -1,16 +0,0 @@ -/* Test the -Wno-format-zero-length option, which suppresses warnings - about zero-length formats. */ -/* Origin: Jason Thorpe <thorpej@wasabisystems.com> */ -/* { dg-do compile { target { *-*-mingw* } } } */ -/* { dg-options "-std=iso9899:1990 -pedantic -Wformat -Wno-format-zero-length" } */ - -#define USE_SYSTEM_FORMATS -#include "format.h" - -void -foo (void) -{ - /* See ISO/IEC 9899:1990 (E) subclause 7.9.6.1 (pages 131-134). */ - /* Zero-length format strings are allowed. */ - printf (""); -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/multattr-1.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/multattr-1.c deleted file mode 100644 index c7404bedf..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/multattr-1.c +++ /dev/null @@ -1,51 +0,0 @@ -/* Test for multiple format attributes. Test for printf and scanf attributes - together. */ -/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ -/* { dg-do compile } */ -/* { dg-options "-std=gnu99 -Wformat" } */ - -#define DONT_GNU_PROTOTYPE -#include "format.h" - -/* If we specify multiple attributes for a single function, they should - all apply. This should apply whether they are on the same declaration - or on different declarations. */ - -extern void my_vprintf_scanf (const char *, va_list, const char *, ...) - __attribute__((__format__(gnu_attr___printf__, 1, 0))) - __attribute__((__format__(gnu_attr___scanf__, 3, 4))); - -extern void my_vprintf_scanf2 (const char *, va_list, const char *, ...) - __attribute__((__format__(gnu_attr___scanf__, 3, 4))) - __attribute__((__format__(gnu_attr___printf__, 1, 0))); - -extern void my_vprintf_scanf3 (const char *, va_list, const char *, ...) - __attribute__((__format__(gnu_attr___printf__, 1, 0))); -extern void my_vprintf_scanf3 (const char *, va_list, const char *, ...) - __attribute__((__format__(gnu_attr___scanf__, 3, 4))); - -extern void my_vprintf_scanf4 (const char *, va_list, const char *, ...) - __attribute__((__format__(gnu_attr___scanf__, 3, 4))); -extern void my_vprintf_scanf4 (const char *, va_list, const char *, ...) - __attribute__((__format__(gnu_attr___printf__, 1, 0))); - -void -foo (va_list ap, int *ip, long *lp) -{ - my_vprintf_scanf ("%d", ap, "%d", ip); - my_vprintf_scanf ("%d", ap, "%ld", lp); - my_vprintf_scanf ("%", ap, "%d", ip); /* { dg-warning "format" "printf" } */ - my_vprintf_scanf ("%d", ap, "%ld", ip); /* { dg-warning "format" "scanf" } */ - my_vprintf_scanf2 ("%d", ap, "%d", ip); - my_vprintf_scanf2 ("%d", ap, "%ld", lp); - my_vprintf_scanf2 ("%", ap, "%d", ip); /* { dg-warning "format" "printf" } */ - my_vprintf_scanf2 ("%d", ap, "%ld", ip); /* { dg-warning "format" "scanf" } */ - my_vprintf_scanf3 ("%d", ap, "%d", ip); - my_vprintf_scanf3 ("%d", ap, "%ld", lp); - my_vprintf_scanf3 ("%", ap, "%d", ip); /* { dg-warning "format" "printf" } */ - my_vprintf_scanf3 ("%d", ap, "%ld", ip); /* { dg-warning "format" "scanf" } */ - my_vprintf_scanf4 ("%d", ap, "%d", ip); - my_vprintf_scanf4 ("%d", ap, "%ld", lp); - my_vprintf_scanf4 ("%", ap, "%d", ip); /* { dg-warning "format" "printf" } */ - my_vprintf_scanf4 ("%d", ap, "%ld", ip); /* { dg-warning "format" "scanf" } */ -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/multattr-2.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/multattr-2.c deleted file mode 100644 index 4011bf145..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/multattr-2.c +++ /dev/null @@ -1,40 +0,0 @@ -/* Test for multiple format attributes. Test for printf and scanf attributes - together, in different places on the declarations. */ -/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ -/* { dg-do compile } */ -/* { dg-options "-std=gnu99 -Wformat" } */ - -#define DONT_GNU_PROTOTYPE -#include "format.h" - -/* If we specify multiple attributes for a single function, they should - all apply, wherever they are placed on the declarations. */ - -extern __attribute__((__format__(gnu_attr___printf__, 1, 0))) void - my_vprintf_scanf (const char *, va_list, const char *, ...) - __attribute__((__format__(gnu_attr___scanf__, 3, 4))); - -extern void (__attribute__((__format__(gnu_attr___printf__, 1, 0))) my_vprintf_scanf2) - (const char *, va_list, const char *, ...) - __attribute__((__format__(gnu_attr___scanf__, 3, 4))); - -extern __attribute__((__format__(gnu_attr___scanf__, 3, 4))) void - (__attribute__((__format__(gnu_attr___printf__, 1, 0))) my_vprintf_scanf3) - (const char *, va_list, const char *, ...); - -void -foo (va_list ap, int *ip, long *lp) -{ - my_vprintf_scanf ("%d", ap, "%d", ip); - my_vprintf_scanf ("%d", ap, "%ld", lp); - my_vprintf_scanf ("%", ap, "%d", ip); /* { dg-warning "format" "printf" } */ - my_vprintf_scanf ("%d", ap, "%ld", ip); /* { dg-warning "format" "scanf" } */ - my_vprintf_scanf2 ("%d", ap, "%d", ip); - my_vprintf_scanf2 ("%d", ap, "%ld", lp); - my_vprintf_scanf2 ("%", ap, "%d", ip); /* { dg-warning "format" "printf" } */ - my_vprintf_scanf2 ("%d", ap, "%ld", ip); /* { dg-warning "format" "scanf" } */ - my_vprintf_scanf3 ("%d", ap, "%d", ip); - my_vprintf_scanf3 ("%d", ap, "%ld", lp); - my_vprintf_scanf3 ("%", ap, "%d", ip); /* { dg-warning "format" "printf" } */ - my_vprintf_scanf3 ("%d", ap, "%ld", ip); /* { dg-warning "format" "scanf" } */ -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/multattr-3.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/multattr-3.c deleted file mode 100644 index 1d4979a4e..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/multattr-3.c +++ /dev/null @@ -1,28 +0,0 @@ -/* Test for multiple format_arg attributes. Test for both branches - getting checked. */ -/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ -/* { dg-do compile } */ -/* { dg-options "-std=gnu99 -Wformat" } */ - -#include "format.h" - -extern char *ngettext (const char *, const char *, unsigned long int) - __attribute__((__format_arg__(1))) __attribute__((__format_arg__(2))); - -void -foo (long l, int nfoo) -{ - printf (ngettext ("%d foo", "%d foos", nfoo), nfoo); - printf (ngettext ("%d foo", "%d foos", l), l); /* { dg-warning "int" "wrong type in conditional expr" } */ - printf (ngettext ("%d foo", "%ld foos", l), l); /* { dg-warning "int" "wrong type in conditional expr" } */ - printf (ngettext ("%ld foo", "%d foos", l), l); /* { dg-warning "int" "wrong type in conditional expr" } */ - /* Should allow one case to have extra arguments. */ - printf (ngettext ("1 foo", "%d foos", nfoo), nfoo); - printf (ngettext ("1 foo", "many foos", nfoo), nfoo); /* { dg-warning "too many" "too many args in all branches" } */ - printf (ngettext ("", "%d foos", nfoo), nfoo); - printf (ngettext ("1 foo", (nfoo > 0) ? "%d foos" : "no foos", nfoo), nfoo); - printf (ngettext ("%d foo", (nfoo > 0) ? "%d foos" : "no foos", nfoo), nfoo); - printf (ngettext ("%ld foo", (nfoo > 0) ? "%d foos" : "no foos", nfoo), nfoo); /* { dg-warning "long int" "wrong type" } */ - printf (ngettext ("%d foo", (nfoo > 0) ? "%ld foos" : "no foos", nfoo), nfoo); /* { dg-warning "long int" "wrong type" } */ - printf (ngettext ("%d foo", (nfoo > 0) ? "%d foos" : "%ld foos", nfoo), nfoo); /* { dg-warning "long int" "wrong type" } */ -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/no-exargs-1.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/no-exargs-1.c deleted file mode 100644 index 75247087f..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/no-exargs-1.c +++ /dev/null @@ -1,14 +0,0 @@ -/* Test for warnings for extra format arguments being disabled by - -Wno-format-extra-args. */ -/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ -/* { dg-do compile } */ -/* { dg-options "-std=gnu99 -Wformat -Wno-format-extra-args" } */ - -#include "format.h" - -void -foo (int i) -{ - printf ("foo", i); - printf ("%1$d", i, i); -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/no-exargs-2.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/no-exargs-2.c deleted file mode 100644 index 3fa928578..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/no-exargs-2.c +++ /dev/null @@ -1,27 +0,0 @@ -/* Test for warnings for extra format arguments being disabled by - -Wno-format-extra-args. Test which warnings still apply with $ - operand numbers. */ -/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ -/* { dg-do compile } */ -/* { dg-options "-std=gnu99 -Wformat -Wno-format-extra-args" } */ - -#include "format.h" - -void -foo (int i, int *ip, va_list va) -{ - printf ("%3$d%1$d", i, i, i); /* { dg-warning "before used" "unused $ operand" } */ - printf ("%2$d%1$d", i, i, i); - vprintf ("%3$d%1$d", va); /* { dg-warning "before used" "unused $ operand" } */ - /* With scanf formats, gaps in the used arguments are allowed only if the - arguments are all pointers. In such a case, should only give the lesser - warning about unused arguments rather than the more serious one about - argument gaps. */ - scanf ("%3$d%1$d", ip, ip, ip); - /* If there are non-pointer arguments unused at the end, this is also OK. */ - scanf ("%3$d%1$d", ip, ip, ip, i); - scanf ("%3$d%1$d", ip, i, ip); /* { dg-warning "before used" "unused $ scanf non-pointer operand" } */ - /* Can't check the arguments in the vscanf case, so should suppose the - lesser problem. */ - vscanf ("%3$d%1$d", va); -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/no-y2k-1.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/no-y2k-1.c deleted file mode 100644 index 4dfd5a04e..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/no-y2k-1.c +++ /dev/null @@ -1,12 +0,0 @@ -/* Test for warnings for Y2K problems not being on by default. */ -/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ -/* { dg-do compile } */ -/* { dg-options "-std=gnu99 -Wformat" } */ - -#include "format.h" - -void -foo (char *s, size_t m, const struct tm *tp) -{ - strftime (s, m, "%y%c%x", tp); -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/nonlit-1.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/nonlit-1.c deleted file mode 100644 index af0cd3723..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/nonlit-1.c +++ /dev/null @@ -1,13 +0,0 @@ -/* Test for warnings for non-string-literal formats. */ -/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ -/* { dg-do compile } */ -/* { dg-options "-std=gnu99 -Wformat -Wformat-nonliteral" } */ - -#include "format.h" - -void -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" } */ -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/nonlit-2.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/nonlit-2.c deleted file mode 100644 index 2ca2e4803..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/nonlit-2.c +++ /dev/null @@ -1,13 +0,0 @@ -/* Test for warnings for non-string-literal formats. Test with -Wformat=2. */ -/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ -/* { dg-do compile } */ -/* { dg-options "-std=gnu99 -Wformat=2" } */ - -#include "format.h" - -void -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" } */ -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/nonlit-3.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/nonlit-3.c deleted file mode 100644 index ce94c8c36..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/nonlit-3.c +++ /dev/null @@ -1,12 +0,0 @@ -/* Test for warnings for non-string-literal formats. Test for strftime formats. */ -/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ -/* { dg-do compile } */ -/* { dg-options "-std=gnu99 -Wformat -Wformat-nonliteral" } */ - -#include "format.h" - -void -foo (char *s, size_t m, const struct tm *tp, char *fmt) -{ - strftime (s, m, fmt, tp); /* { dg-warning "format string" "non-literal" } */ -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/nul-1.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/nul-1.c deleted file mode 100644 index c45453dba..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/nul-1.c +++ /dev/null @@ -1,14 +0,0 @@ -/* Test diagnostics for suppressing contains nul - -Wformat. -Wformat. */ -/* Origin: Bruce Korb <bkorb@gnu.org> */ -/* { dg-do compile } */ -/* { dg-options "-Wformat -Wno-format-contains-nul" } */ - -#include "format.h" - -void -foo (void) -{ - static char const fmt[] = "x%s\0%s\n\0abc"; - printf (fmt+4, fmt+8); /* { dg-bogus "embedded.*in format" "bogus embed warning" } */ -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/nul-2.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/nul-2.c deleted file mode 100644 index 4c9159658..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/nul-2.c +++ /dev/null @@ -1,16 +0,0 @@ -/* Test diagnostics for options used on their own without - -Wformat. -Wformat-. */ -/* Origin: Bruce Korb <bkorb@gnu.org> */ -/* { dg-do compile } */ -/* { dg-options "-Wformat" } */ - -/* { dg-warning "embedded .* in format" "ignored" { target *-*-* } 0 } */ - -#include "format.h" - -void -fumble (void) -{ - static char const fmt[] = "x%s\0%s\n\0abc"; - printf (fmt+4, fmt+8); -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/null-1.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/null-1.c deleted file mode 100644 index ed714442b..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/null-1.c +++ /dev/null @@ -1,28 +0,0 @@ -/* Test for some aspects of null format string handling. */ -/* Origin: Jason Thorpe <thorpej@wasabisystems.com> */ -/* { dg-do compile } */ -/* { dg-options "-std=gnu99 -Wformat" } */ - -#define DONT_GNU_PROTOTYPE -#include "format.h" - -extern void my_printf (const char *, ...) __attribute__((format(gnu_attr_printf,1,2))); -extern const char *my_format (const char *, const char *) - __attribute__((format_arg(2))); - -void -foo (int i1) -{ - /* Warning about a null format string has been decoupled from the actual - format check. However, we still expect to be warned about any excess - arguments after a null format string. */ - my_printf (NULL); - my_printf (NULL, i1); /* { dg-warning "too many" "null format with arguments" } */ - - my_printf (my_format ("", NULL)); - my_printf (my_format ("", NULL), i1); /* { dg-warning "too many" "null format_arg with arguments" } */ - - /* While my_printf allows a null argument, dgettext does not, so we expect - a null argument warning here. */ - my_printf (dgettext ("", NULL)); /* { dg-warning "null" "null format with dgettext" } */ -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/opt-1.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/opt-1.c deleted file mode 100644 index f8f370448..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/opt-1.c +++ /dev/null @@ -1,7 +0,0 @@ -/* Test diagnostics for options used on their own without - -Wformat. -Wformat-extra-args. */ -/* Origin: Joseph Myers <joseph@codesourcery.com> */ -/* { dg-do compile } */ -/* { dg-options "-Wformat-extra-args" } */ - -/* { dg-warning "-Wformat-extra-args ignored without -Wformat" "ignored" { target *-*-* } 0 } */ diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/opt-2.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/opt-2.c deleted file mode 100644 index 1ec9f0141..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/opt-2.c +++ /dev/null @@ -1,7 +0,0 @@ -/* Test diagnostics for options used on their own without - -Wformat. -Wformat-nonliteral. */ -/* Origin: Joseph Myers <joseph@codesourcery.com> */ -/* { dg-do compile } */ -/* { dg-options "-Wformat-nonliteral" } */ - -/* { dg-warning "-Wformat-nonliteral ignored without -Wformat" "ignored" { target *-*-* } 0 } */ diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/opt-3.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/opt-3.c deleted file mode 100644 index 03f55e436..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/opt-3.c +++ /dev/null @@ -1,7 +0,0 @@ -/* Test diagnostics for options used on their own without - -Wformat. -Wformat-security. */ -/* Origin: Joseph Myers <joseph@codesourcery.com> */ -/* { dg-do compile } */ -/* { dg-options "-Wformat-security" } */ - -/* { dg-warning "-Wformat-security ignored without -Wformat" "ignored" { target *-*-* } 0 } */ diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/opt-4.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/opt-4.c deleted file mode 100644 index f02b6c094..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/opt-4.c +++ /dev/null @@ -1,7 +0,0 @@ -/* Test diagnostics for options used on their own without - -Wformat. -Wformat-y2k. */ -/* Origin: Joseph Myers <joseph@codesourcery.com> */ -/* { dg-do compile } */ -/* { dg-options "-Wformat-y2k" } */ - -/* { dg-warning "-Wformat-y2k ignored without -Wformat" "ignored" { target *-*-* } 0 } */ diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/opt-5.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/opt-5.c deleted file mode 100644 index 3315e3358..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/opt-5.c +++ /dev/null @@ -1,7 +0,0 @@ -/* Test diagnostics for options used on their own without - -Wformat. -Wformat-zero-length. */ -/* Origin: Joseph Myers <joseph@codesourcery.com> */ -/* { dg-do compile } */ -/* { dg-options "-Wformat-zero-length" } */ - -/* { dg-warning "-Wformat-zero-length ignored without -Wformat" "ignored" { target *-*-* } 0 } */ diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/opt-6.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/opt-6.c deleted file mode 100644 index 29dedfae5..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/opt-6.c +++ /dev/null @@ -1,7 +0,0 @@ -/* Test diagnostics for options used on their own without - -Wformat. -Wformat-contains-nul. */ -/* Origin: Bruce Korb <bkorb@gnu.org> */ -/* { dg-do compile } */ -/* { dg-options "-Wformat-contains-nul" } */ - -/* { dg-warning "-Wformat-contains-nul ignored without -Wformat" "ignored" { target *-*-* } 0 } */ diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/plus-1.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/plus-1.c deleted file mode 100644 index 02a213d41..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/plus-1.c +++ /dev/null @@ -1,20 +0,0 @@ -/* Test for printf formats using string literal plus constant. - */ -/* Origin: Jakub Jelinek <jakub@redhat.com> */ -/* { dg-do compile } */ -/* { dg-options "-std=iso9899:1990 -pedantic -Wformat=2" } */ - -#include "format.h" - -void -foo (int i) -{ - printf ("%%d\n" + 1, i); - printf (5 + "%.-*d%3d\n", i); - printf ("%d%d" + 2, i, i); /* { dg-warning "arguments" "wrong number of args" } */ - printf (3 + "%d\n"); /* { dg-warning "zero-length" "zero-length string" } */ - printf ("%d\n" + i, i); /* { dg-warning "not a string" "non-constant addend" } */ - printf ("%d\n" + 10); /* { dg-warning "not a string" "too large addend" } */ - printf ("%d\n" - 1, i); /* { dg-warning "not a string" "minus constant" } */ - printf ("%d\n" + -1, i); /* { dg-warning "not a string" "negative addend" } */ -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/sec-1.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/sec-1.c deleted file mode 100644 index 9189b51e1..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/sec-1.c +++ /dev/null @@ -1,12 +0,0 @@ -/* Test for security warning when non-literal format has no arguments. */ -/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ -/* { dg-do compile } */ -/* { dg-options "-std=gnu99 -Wformat -Wformat-security" } */ - -#include "format.h" - -void -foo (char *s) -{ - printf (s); /* { dg-warning "no format arguments" "security warning" } */ -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/sentinel-1.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/sentinel-1.c deleted file mode 100644 index 0c8a2ac77..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/sentinel-1.c +++ /dev/null @@ -1,73 +0,0 @@ -/* Test for attribute sentinel. */ -/* Origin: Kaveh Ghazi <ghazi@caip.rutgers.edu> */ -/* { dg-do compile } */ -/* { dg-options "-Wformat" } */ - -#include <stddef.h> /* For NULL, which must be (ptr)0. */ - -extern int execl (const char *, const char *, ...); -extern int execlp (const char *, const char *, ...); -extern int execle (const char *, const char *, ...); -extern char *envp[]; - -#define ATTR __attribute__ ((__sentinel__)) - -extern int a ATTR; /* { dg-warning "applies to function types" "sentinel" } */ - -extern void foo1 (const char *, ...) ATTR; /* { dg-message "note: declared here" } */ -extern void foo2 (...) ATTR; /* { dg-error "ISO C requires|named arguments" "sentinel" } */ -extern void foo3 () ATTR; /* { dg-warning "named arguments" "sentinel" } */ -extern void foo4 (const char *, int) ATTR; /* { dg-warning "variadic functions" "sentinel" } */ -extern void foo5 (const char *, ...) __attribute__ ((__sentinel__(1))); -extern void foo6 (const char *, ...) __attribute__ ((__sentinel__(5))); -extern void foo7 (const char *, ...) __attribute__ ((__sentinel__(0))); -extern void foo8 (const char *, ...) __attribute__ ((__sentinel__("a"))); /* { dg-warning "not an integer constant" "sentinel" } */ -extern void foo9 (const char *, ...) __attribute__ ((__sentinel__(-1))); /* { dg-warning "less than zero" "sentinel" } */ -extern void foo10 (const char *, ...) __attribute__ ((__sentinel__(1,3))); /* { dg-error "wrong number of arguments" "sentinel" } */ - -extern void bar(void) -{ - foo1 (); /* { dg-error "not enough|too few arguments" "sentinel" } */ - foo1 (NULL); /* { dg-warning "not enough" "sentinel" } */ - foo1 ("a"); /* { dg-warning "not enough" "sentinel" } */ - foo1 ("a", 1); /* { dg-warning "missing sentinel" "sentinel" } */ - foo1 ("a", 0); /* { dg-warning "missing sentinel" "sentinel" } */ - foo1 ("a", (void*)1); /* { dg-warning "missing sentinel" "sentinel" } */ - foo1 ("a", NULL, 1); /* { dg-warning "missing sentinel" "sentinel" } */ - foo1 ("a", NULL); - - foo5 (NULL); /* { dg-warning "not enough" "sentinel" } */ - foo5 (NULL, 1); /* { dg-warning "not enough" "sentinel" } */ - foo5 ("a", NULL); /* { dg-warning "not enough" "sentinel" } */ - foo5 ("a", NULL, 1); - foo5 ("a", 1, 2, 3, NULL); /* { dg-warning "missing sentinel" "sentinel" } */ - foo5 ("a", 1, 2, NULL, 3); - foo5 ("a", 1, NULL, 2, 3); /* { dg-warning "missing sentinel" "sentinel" } */ - foo5 ("a", NULL, 1, 2, 3); /* { dg-warning "missing sentinel" "sentinel" } */ - foo5 ("a", 0, 1, 2, 3); /* { dg-warning "missing sentinel" "sentinel" } */ - - foo6 ("a", 1, NULL); /* { dg-warning "not enough" "sentinel" } */ - foo6 ("a", 1, NULL, 2); /* { dg-warning "not enough" "sentinel" } */ - foo6 ("a", 1, NULL, 2, 3); /* { dg-warning "not enough" "sentinel" } */ - foo6 ("a", NULL, 1, 2, 3); /* { dg-warning "not enough" "sentinel" } */ - foo6 ("a", NULL, 1, 2, 3, 4); /* { dg-warning "not enough" "sentinel" } */ - foo6 (NULL, 1, 2, 3, 4, 5); /* { dg-warning "not enough" "sentinel" } */ - foo6 ("a", NULL, 1, 2, 3, 4, 5); - foo6 ("a", 0, NULL, 1, 2, 3, 4, 5); - foo6 ("a", 0, 1, 2, 3, 4, 5); /* { dg-warning "missing sentinel" "sentinel" } */ - foo6 ("a", NULL, 1, 2, 3, 4, 5, 6); /* { dg-warning "missing sentinel" "sentinel" } */ - - foo7 ("a", 1, 2, 3, NULL); - - execl ("/bin/ls", "/bin/ls", "-aFC"); /* { dg-warning "missing sentinel" "sentinel" } */ - execl ("/bin/ls", "/bin/ls", "-aFC", 0); /* { dg-warning "missing sentinel" "sentinel" } */ - execl ("/bin/ls", "/bin/ls", "-aFC", NULL); - - execlp ("ls", "ls", "-aFC"); /* { dg-warning "missing sentinel" "sentinel" } */ - execlp ("ls", "ls", "-aFC", 0); /* { dg-warning "missing sentinel" "sentinel" } */ - execlp ("ls", "ls", "-aFC", NULL); - - execle ("ls", "ls", "-aFC", ".", envp); /* { dg-warning "missing sentinel" "sentinel" } */ - execle ("ls", "ls", "-aFC", ".", 0, envp); /* { dg-warning "missing sentinel" "sentinel" } */ - execle ("ls", "ls", "-aFC", ".", NULL, envp); -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/strfmon-1.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/strfmon-1.c deleted file mode 100644 index 934242a23..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/strfmon-1.c +++ /dev/null @@ -1,63 +0,0 @@ -/* Test for strfmon format checking. */ -/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ -/* { dg-do compile } */ -/* { dg-options "-std=gnu99 -Wformat" } */ - -#include "format.h" - -void -foo (char *s, size_t m, double d, long double ld) -{ - /* Examples of valid formats from Austin Group draft 7. */ - strfmon (s, m, "%n", d); - strfmon (s, m, "%11n", d); - strfmon (s, m, "%#5n", d); - strfmon (s, m, "%=*#5n", d); - strfmon (s, m, "%=0#5n", d); - strfmon (s, m, "%^#5n", d); - strfmon (s, m, "%^#5.0n", d); - strfmon (s, m, "%^#5.4n", d); - strfmon (s, m, "%(#5n", d); - strfmon (s, m, "%!(#5n", d); - strfmon (s, m, "%-14#5.4n", d); - strfmon (s, m, "%14#5.4n", d); - /* Some more valid formats, including the GNU L length extension. */ - strfmon (s, m, "abc%-11ndef%==i%%", d, d); - strfmon (s, m, "%%abc%-11ndef%==Li%=%i", d, ld, d); - strfmon (s, m, "%Li", ld); - strfmon (s, m, "%11Li", ld); - strfmon (s, m, "%#5Li", ld); - strfmon (s, m, "%=*#5Li", ld); - strfmon (s, m, "%=0#5Li", ld); - strfmon (s, m, "%^#5Li", ld); - strfmon (s, m, "%^#5.0Li", ld); - strfmon (s, m, "%^#5.4Li", ld); - strfmon (s, m, "%(#5Li", ld); - strfmon (s, m, "%!(#5Li", ld); - strfmon (s, m, "%-14#5.4Li", ld); - strfmon (s, m, "%14#5.4Li", ld); - /* Formats with the wrong types used. */ - strfmon (s, m, "%Ln", d); /* { dg-warning "format" "wrong type" } */ - strfmon (s, m, "%n", ld); /* { dg-warning "format" "wrong type" } */ - /* The + and ( flags cannot be used together. */ - strfmon (s, m, "%+(i", d); /* { dg-warning "flag" "+ and ( flags" } */ - strfmon (s, m, "%(+i", d); /* { dg-warning "flag" "+ and ( flags" } */ - /* Although empty precision is OK for printf, it isn't here. */ - strfmon (s, m, "%#.5n", d); /* { dg-warning "empty" "empty left precision" } */ - strfmon (s, m, "%#5.n", d); /* { dg-warning "empty" "empty right precision" } */ - /* However, zero is a valid value for width and precisions. */ - strfmon (s, m, "%0#0.0n", d); - /* Test bogus %% constructions. */ - strfmon (s, m, "%^%"); /* { dg-warning "format" "bogus %%" } */ - strfmon (s, m, "%!%\n"); /* { dg-warning "format" "bogus %%" } */ - strfmon (s, m, "%5%\n"); /* { dg-warning "format" "bogus %%" } */ - strfmon (s, m, "%.5%\n"); /* { dg-warning "format" "bogus %%" } */ - strfmon (s, m, "%#5%\n"); /* { dg-warning "format" "bogus %%" } */ - /* Miscellaneous bogus formats. */ - strfmon (s, m, "%n%n", d); /* { dg-warning "matching" "too few args" } */ - strfmon (s, m, ""); /* { dg-warning "zero-length" "empty" } */ - strfmon (s, m, NULL); /* { dg-warning "null" "null format string" } */ - strfmon (s, m, "%"); /* { dg-warning "trailing" "tailing %" } */ - strfmon (s, m, "%n\0", d); /* { dg-warning "embedded" "embedded NUL" } */ - strfmon (s, m, "%^^n", d); /* { dg-warning "repeated" "repeated flag" } */ -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/strfmon-2.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/strfmon-2.c deleted file mode 100644 index 1ecef711d..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/strfmon-2.c +++ /dev/null @@ -1,13 +0,0 @@ -/* Test for strfmon format checking. Test for missing fill character - at end of format. */ -/* Origin: Joseph Myers <joseph@codesourcery.com> */ -/* { dg-do compile } */ -/* { dg-options "-std=gnu99 -Wformat" } */ - -#include "format.h" - -void -foo (char *s, size_t m) -{ - strfmon (s, m, "%="); /* { dg-warning "missing fill character at end" } */ -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/sys_format.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/sys_format.c deleted file mode 100755 index b69ae5bc5..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/sys_format.c +++ /dev/null @@ -1,14 +0,0 @@ -/* Test system default printf formatter specifiers. */ -/* Origin: Kai Tietz <KaiTietz.@onevision.com> */ -/* { dg-do compile { target { *-*-mingw* } } } */ -/* { dg-options "-std=gnu89" } */ - -#define USE_SYSTEM_FORMATS -#include "format.h" - -__attribute__((format(printf, 1, 2))) void foo (const char *, ...); - -void bar (long long v1, long v2, int v3) -{ - foo ("%I64d %I32d %ld %d\n", v1, v2, v2, v3); -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/unnamed-1.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/unnamed-1.c deleted file mode 100644 index e54b06f36..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/unnamed-1.c +++ /dev/null @@ -1,25 +0,0 @@ -/* Test for warnings with possibly unnamed integer types. Bug 24329. */ -/* Origin: Joseph Myers <joseph@codesourcery.com> */ -/* { dg-do compile } */ -/* { dg-options "-Wformat" } */ -/* { dg-options "-Wformat -msse" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */ -/* { dg-require-effective-target sse { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */ - - -#include "format.h" - -/* Definition of TItype follows same logic as in gcc.dg/titype-1.c, - but must be a #define to avoid giving the type a name. */ -#if (defined(__LP64__) && !defined(__hppa__)) || defined(__SPU__) -#define TItype int __attribute__ ((mode (TI))) -#else -#define TItype long -#endif - -void -f (TItype x) -{ - printf("%d", x); /* { dg-warning "expects argument" } */ - printf("%d", 141592653589793238462643383279502884197169399375105820974944); /* { dg-warning "expects argument" } */ - /* { dg-warning "unsigned only|too large" "constant" { target *-*-* } 23 } */ -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/va-1.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/va-1.c deleted file mode 100644 index 5f5eeab4e..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/va-1.c +++ /dev/null @@ -1,13 +0,0 @@ -/* Test for strange warning in format checking. */ -/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ -/* { dg-do compile } */ -/* { dg-options "-Wformat" } */ - -#include "format.h" - -void -foo (void *p) -{ - printf ("%d", p); /* { dg-bogus "va_list" "wrong type in format warning" } */ - /* { dg-warning "format" "format error" { target *-*-* } 11 } */ -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/warnll-1.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/warnll-1.c deleted file mode 100644 index 2d2277693..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/warnll-1.c +++ /dev/null @@ -1,45 +0,0 @@ -/* Test for printf formats. C99 "long long" formats should be accepted with - -Wno-long-long. -*/ -/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ -/* { dg-do compile } */ -/* { dg-options "-std=iso9899:1990 -pedantic -Wformat -Wno-long-long" } */ - -#include "format.h" - -void -foo (long long ll, unsigned long long ull, long long *lln, - long long *llp, unsigned long long *ullp) -{ - /* Test for accepting standard "long long" formats. */ - printf ("%lld%lli%llo%llu%llx%llX%lln", ll, ll, ull, ull, ull, ull, lln); - scanf ("%lld%lli%llo%llu%llx%llX%lln", llp, llp, - ullp, ullp, ullp, ullp, lln); - /* Use of "q" and "L" should still be warned about. */ - printf ("%qd", ll); /* { dg-warning "C" "printf %qd" } */ - printf ("%qi", ll); /* { dg-warning "C" "printf %qi" } */ - printf ("%qo", ull); /* { dg-warning "C" "printf %qo" } */ - printf ("%qu", ull); /* { dg-warning "C" "printf %qu" } */ - printf ("%qx", ull); /* { dg-warning "C" "printf %qx" } */ - printf ("%qX", ull); /* { dg-warning "C" "printf %qX" } */ - printf ("%qn", lln); /* { dg-warning "C" "printf %qn" } */ - printf ("%Ld", ll); /* { dg-warning "C" "printf %Ld" } */ - printf ("%Li", ll); /* { dg-warning "C" "printf %Li" } */ - printf ("%Lo", ull); /* { dg-warning "C" "printf %oL" } */ - printf ("%Lu", ull); /* { dg-warning "C" "printf %Lu" } */ - printf ("%Lx", ull); /* { dg-warning "C" "printf %Lx" } */ - printf ("%LX", ull); /* { dg-warning "C" "printf %LX" } */ - scanf ("%qd", llp); /* { dg-warning "C" "scanf %qd" } */ - scanf ("%qi", llp); /* { dg-warning "C" "scanf %qi" } */ - scanf ("%qo", ullp); /* { dg-warning "C" "scanf %qo" } */ - scanf ("%qu", ullp); /* { dg-warning "C" "scanf %qu" } */ - scanf ("%qx", ullp); /* { dg-warning "C" "scanf %qx" } */ - scanf ("%qX", ullp); /* { dg-warning "C" "scanf %qX" } */ - scanf ("%qn", lln); /* { dg-warning "C" "scanf %qn" } */ - scanf ("%Ld", llp); /* { dg-warning "C" "scanf %Ld" } */ - scanf ("%Li", llp); /* { dg-warning "C" "scanf %Li" } */ - scanf ("%Lo", ullp); /* { dg-warning "C" "scanf %oL" } */ - scanf ("%Lu", ullp); /* { dg-warning "C" "scanf %Lu" } */ - scanf ("%Lx", ullp); /* { dg-warning "C" "scanf %Lx" } */ - scanf ("%LX", ullp); /* { dg-warning "C" "scanf %LX" } */ -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/xopen-1.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/xopen-1.c deleted file mode 100644 index 9b098fb1c..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/xopen-1.c +++ /dev/null @@ -1,125 +0,0 @@ -/* Test for X/Open format extensions, as found in the - Single Unix Specification and in Austin Group draft 7. -*/ -/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ -/* { dg-do compile } */ -/* { dg-options "-std=gnu99 -Wformat" } */ - -#include "format.h" - -void -foo (int i, unsigned int u, wint_t lc, wchar_t *ls, int *ip, double d, - char *s, void *p, int *n, long int l, int i2, float *fp, long int *lp, - va_list va) -{ - /* The conversion specifiers C and S, for both printf and scanf, - are X/Open extensions. - */ - printf ("%C", lc); - printf ("%3C", lc); - printf ("%.3C", lc); /* { dg-warning "precision" "precision with %C" } */ - printf ("%hC", lc); /* { dg-warning "length" "bad %hC" } */ - printf ("%hhC", lc); /* { dg-warning "length" "bad %hhC" } */ - printf ("%lC", lc); /* { dg-warning "length" "bad %lC" } */ - printf ("%llC", lc); /* { dg-warning "length" "bad %llC" } */ - printf ("%jC", lc); /* { dg-warning "length" "bad %jC" } */ - printf ("%zC", lc); /* { dg-warning "length" "bad %zC" } */ - printf ("%tC", lc); /* { dg-warning "length" "bad %tC" } */ - printf ("%LC", lc); /* { dg-warning "length" "bad %LC" } */ - printf ("%-C", lc); - printf ("%+C", lc); /* { dg-warning "flag" "bad %+C" } */ - printf ("% C", lc); /* { dg-warning "flag" "bad % C" } */ - printf ("%#C", lc); /* { dg-warning "flag" "bad %#C" } */ - printf ("%0C", lc); /* { dg-warning "flag" "bad %0C" } */ - printf ("%'C", lc); /* { dg-warning "flag" "bad %'C" } */ - printf ("%S", ls); - printf ("%3S", ls); - printf ("%.3S", ls); - printf ("%hS", ls); /* { dg-warning "length" "bad %hS" } */ - printf ("%hhS", ls); /* { dg-warning "length" "bad %hhS" } */ - printf ("%lS", ls); /* { dg-warning "length" "bad %lS" } */ - printf ("%llS", ls); /* { dg-warning "length" "bad %llS" } */ - printf ("%jS", ls); /* { dg-warning "length" "bad %jS" } */ - printf ("%zS", ls); /* { dg-warning "length" "bad %zS" } */ - printf ("%tS", ls); /* { dg-warning "length" "bad %tS" } */ - printf ("%LS", ls); /* { dg-warning "length" "bad %LS" } */ - printf ("%-S", ls); - printf ("%+S", ls); /* { dg-warning "flag" "bad %+S" } */ - printf ("% S", ls); /* { dg-warning "flag" "bad % S" } */ - printf ("%#S", ls); /* { dg-warning "flag" "bad %#S" } */ - printf ("%0S", ls); /* { dg-warning "flag" "bad %0S" } */ - printf ("%'S", ls); /* { dg-warning "flag" "bad %'S" } */ - scanf ("%C", ls); - scanf ("%S", ls); - scanf ("%*C%*S"); - scanf ("%2C%3S", ls, ls); - scanf ("%hC", ls); /* { dg-warning "length" "bad %hC" } */ - scanf ("%hhC", ls); /* { dg-warning "length" "bad %hhC" } */ - scanf ("%lC", ls); /* { dg-warning "length" "bad %lC" } */ - scanf ("%llC", ls); /* { dg-warning "length" "bad %llC" } */ - scanf ("%jC", ls); /* { dg-warning "length" "bad %jC" } */ - scanf ("%zC", ls); /* { dg-warning "length" "bad %zC" } */ - scanf ("%tC", ls); /* { dg-warning "length" "bad %tC" } */ - scanf ("%LC", ls); /* { dg-warning "length" "bad %LC" } */ - scanf ("%hS", ls); /* { dg-warning "length" "bad %hS" } */ - scanf ("%hhS", ls); /* { dg-warning "length" "bad %hhS" } */ - scanf ("%lS", ls); /* { dg-warning "length" "bad %lS" } */ - scanf ("%llS", ls); /* { dg-warning "length" "bad %llS" } */ - scanf ("%jS", ls); /* { dg-warning "length" "bad %jS" } */ - scanf ("%zS", ls); /* { dg-warning "length" "bad %zS" } */ - scanf ("%tS", ls); /* { dg-warning "length" "bad %tS" } */ - scanf ("%LS", ls); /* { dg-warning "length" "bad %LS" } */ - /* In C99 mode (even with extensions), %aS is a floating point - format followed by an S. - */ - scanf ("%aS", fp); - /* The printf flag character ' is an X/Open extension. */ - printf ("%'d%'i%'u%'f%'F%'g%'G", i, i, u, d, d, d, d); - printf ("%'o", u); /* { dg-warning "flag" "bad use of ' flag" } */ - printf ("%'x", u); /* { dg-warning "flag" "bad use of ' flag" } */ - printf ("%'X", u); /* { dg-warning "flag" "bad use of ' flag" } */ - printf ("%'e", d); /* { dg-warning "flag" "bad use of ' flag" } */ - printf ("%'E", d); /* { dg-warning "flag" "bad use of ' flag" } */ - printf ("%'a", d); /* { dg-warning "flag" "bad use of ' flag" } */ - printf ("%'A", d); /* { dg-warning "flag" "bad use of ' flag" } */ - printf ("%'c", i); /* { dg-warning "flag" "bad use of ' flag" } */ - printf ("%'s", s); /* { dg-warning "flag" "bad use of ' flag" } */ - printf ("%'p", p); /* { dg-warning "flag" "bad use of ' flag" } */ - printf ("%'n", n); /* { dg-warning "flag" "bad use of ' flag" } */ - /* The use of operand number $ formats is an X/Open extension. */ - scanf ("%1$d", ip); - printf ("%1$d", i); - printf ("%1$d", l); /* { dg-warning "arg 2|argument 2" "mismatched args with $ format" } */ - printf ("%3$*2$.*1$ld", i2, i, l); - printf ("%4$ld%7$ld%5$d%6$d%3$d%1$d%2$d", i, i, i, l, i, i, l); - scanf ("%4$ld%7$ld%5$d%6$d%3$d%1$d%2$d", ip, ip, ip, lp, ip, ip, lp); - printf ("%1$d%d", i, i); /* { dg-warning "missing" "mixing $ and non-$ formats" } */ - printf ("%%%1$d%%%2$d", i, i); - printf ("%d%2$d", i); /* { dg-warning "used after format" "mixing $ and non-$ formats" } */ - printf ("%1$*d", i, i); /* { dg-warning "missing" "mixing $ and non-$ formats" } */ - printf ("%*1$d", i); /* { dg-warning "missing" "mixing $ and non-$ formats" } */ - scanf ("%1$d%d", ip, ip); /* { dg-warning "missing" "mixing $ and non-$ formats" } */ - scanf ("%*f%%%1$d%%%2$d", ip, ip); - printf ("%2$d", i); /* { dg-warning "operand" "$ number too large" } */ - printf ("%0$d", i); /* { dg-warning "operand" "$ number too small" } */ - printf ("%3$d%1$d", i, i, i); /* { dg-warning "before used" "unused $ operand" } */ - printf ("%2$d%1$d", i, i, i); /* { dg-warning "unused" "unused $ operand" } */ - vprintf ("%3$d%1$d", va); /* { dg-warning "before used" "unused $ operand" } */ - /* With scanf formats, gaps in the used arguments are allowed only if the - arguments are all pointers. In such a case, should only give the lesser - warning about unused arguments rather than the more serious one about - argument gaps. */ - scanf ("%3$d%1$d", ip, ip, ip); /* { dg-bogus "before used" "unused $ scanf pointer operand" } */ - /* { dg-warning "unused" "unused $ scanf pointer operand" { target *-*-* } 112 } */ - /* If there are non-pointer arguments unused at the end, this is also OK. */ - scanf ("%3$d%1$d", ip, ip, ip, i); /* { dg-bogus "before used" "unused $ scanf pointer operand" } */ - /* { dg-warning "unused" "unused $ scanf pointer operand" { target *-*-* } 115 } */ - scanf ("%3$d%1$d", ip, i, ip); /* { dg-warning "before used" "unused $ scanf non-pointer operand" } */ - /* Can't check the arguments in the vscanf case, so should suppose the - lesser problem. */ - vscanf ("%3$d%1$d", va); /* { dg-bogus "before used" "unused $ scanf pointer operand" } */ - /* { dg-warning "unused" "unused $ scanf pointer operand" { target *-*-* } 120 } */ - scanf ("%2$*d%1$d", ip, ip); /* { dg-warning "operand" "operand number with suppression" } */ - printf ("%1$d%1$d", i); - scanf ("%1$d%1$d", ip); /* { dg-warning "more than once" "multiple use of scanf argument" } */ -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/xopen-2.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/xopen-2.c deleted file mode 100644 index 4aee191ea..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/xopen-2.c +++ /dev/null @@ -1,21 +0,0 @@ -/* Test for X/Open format extensions, as found in the - Single Unix Specification. Test for bug reported by - Pierre-Canalsat PETIT <pierrecanalsat.petit.canalsat@canal-plus.com> - in PR c/6547. The test for absence of a parameter for a * width was done - too early in the case of operand numbers and vprintf formats. -*/ -/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ -/* { dg-do compile } */ -/* { dg-options "-std=gnu99 -Wformat" } */ - -#include "format.h" - -void vbar (va_list, const char *) __attribute__((__format__(__printf__, 2, 0))); - -void -foo (int i, int j, va_list va) -{ - printf("%2$*1$c", i, j); - printf("%2$*1$c %2$*1$c", i, j); /* { dg-bogus "matching" "bogus too few dollar" } */ - vbar(va, "%*s"); /* { dg-bogus "matching" "bogus too few vprintf" } */ -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/xopen-3.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/xopen-3.c deleted file mode 100644 index 5f78d77c5..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/xopen-3.c +++ /dev/null @@ -1,15 +0,0 @@ -/* Test for warnings for $ operand numbers after ordinary formats. - Bug c/15444 from james-gcc-bugzilla-501qll3d at and dot org. */ -/* Origin: Joseph Myers <jsm@polyomino.org.uk> */ -/* { dg-do compile } */ -/* { dg-options "-std=gnu99 -Wformat" } */ - -#include "format.h" - -void -foo (int i) -{ - printf ("%d%2$d", i); /* { dg-warning "used after format" "mixing $ and non-$ formats" } */ - printf ("%d%*1$d", i, i); /* { dg-warning "used after format" "mixing $ and non-$ formats" } */ - printf ("%d%.*1$d", i, i); /* { dg-warning "used after format" "mixing $ and non-$ formats" } */ -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/z-1.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/z-1.c deleted file mode 100644 index 7916201ff..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/z-1.c +++ /dev/null @@ -1,28 +0,0 @@ -/* Test for bugs with %z and %Z formats. See PRs c/89, c/156, c/376. */ -/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ -/* { dg-do compile } */ -/* { dg-options "-Wformat" } */ - -#include "format.h" - -size_t -foo (void) -{ - size_t t; - scanf ("%zu", &t); /* { dg-bogus "length|format" "bogus scanf warning" } */ - return t; -} - -void -bar (size_t t) -{ - printf ("%zu\n", t); /* { dg-bogus "format" "bogus printf warning" } */ -} - -/* The %Z printf format is an old GNU libc extension to do the same thing. */ - -void -baz (size_t t) -{ - printf ("%Zu\n", t); /* { dg-bogus "format" "bogus printf warning" } */ -} diff --git a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/zero-length-1.c b/gcc-4.8.1/gcc/testsuite/gcc.dg/format/zero-length-1.c deleted file mode 100644 index 4cf37f320..000000000 --- a/gcc-4.8.1/gcc/testsuite/gcc.dg/format/zero-length-1.c +++ /dev/null @@ -1,15 +0,0 @@ -/* Test the -Wno-format-zero-length option, which suppresses warnings - about zero-length formats. */ -/* Origin: Jason Thorpe <thorpej@wasabisystems.com> */ -/* { dg-do compile } */ -/* { dg-options "-std=iso9899:1990 -pedantic -Wformat -Wno-format-zero-length" } */ - -#include "format.h" - -void -foo (void) -{ - /* See ISO/IEC 9899:1990 (E) subclause 7.9.6.1 (pages 131-134). */ - /* Zero-length format strings are allowed. */ - printf (""); -} |