OSDN Git Service

* Makefile.in (local-distclean): Remove leftover built files.
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / formatz-1.c
1 /* Test for bugs with %z and %Z formats.  See PRs c/89, c/156, c/376.  */
2 /* Origin: Joseph Myers <jsm28@cam.ac.uk> */
3 /* { dg-do compile } */
4 /* { dg-options "-Wformat" } */
5
6 typedef __SIZE_TYPE__ size_t;
7
8 extern int printf (const char *, ...);
9 extern int scanf (const char *, ...);
10
11 size_t
12 foo (void)
13 {
14   size_t t;
15   scanf ("%zu", &t); /* { dg-bogus "length|format" "bogus scanf warning" } */
16   return t;
17 }
18
19 void
20 bar (size_t t)
21 {
22   printf ("%zu\n", t); /* { dg-bogus "format" "bogus printf warning" } */
23 }
24
25 /* The %Z printf format is an old GNU libc extension to do the same thing.  */
26
27 void
28 baz (size_t t)
29 {
30   printf ("%Zu\n", t); /* { dg-bogus "format" "bogus printf warning" } */
31 }