OSDN Git Service

* varasm.c (make_decl_rtl): Restore leading star on
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / c90-printf-2.c
1 /* Test for printf formats.  Formats using C99 features should be rejected
2    outside of C99 mode.
3 */
4 /* Origin: Joseph Myers <jsm28@cam.ac.uk> */
5 /* { dg-do compile } */
6 /* { dg-options "-std=iso9899:1990 -pedantic -Wformat" } */
7
8 typedef __SIZE_TYPE__ size_t;
9 typedef __PTRDIFF_TYPE__ ptrdiff_t;
10
11 __extension__ typedef long long int llong;
12
13 /* This next definition is broken.  When GCC has a <stdint.h> and
14    an internal understanding of intmax_t, it should be
15    replaced by an include of <stdint.h> or by a definition for internal
16    macros or typedefs.
17 */
18 __extension__ typedef long long int intmax_t;
19
20 extern int printf (const char *, ...);
21
22 void
23 foo (int i, double d, llong ll, intmax_t j, size_t z, ptrdiff_t t)
24 {
25   /* Some tests already in c90-printf-1.c, e.g. %lf.  */
26   /* The widths hh, ll, j, z, t are new.  */
27   printf ("%hhd", i); /* { dg-warning "length|C" "%hh in C90" } */
28   printf ("%lld", ll); /* { dg-warning "length|C" "%ll in C90" } */
29   printf ("%jd", j); /* { dg-warning "length|C" "%j in C90" } */
30   printf ("%zu", z); /* { dg-warning "length|C" "%z in C90" } */
31   printf ("%td", t); /* { dg-warning "length|C" "%t in C90" } */
32   /* The formats F, a, A are new.  */
33   printf ("%F", d); /* { dg-warning "C" "%F in C90" } */
34   printf ("%a", d); /* { dg-warning "C" "%a in C90" } */
35   printf ("%A", d); /* { dg-warning "C" "%A in C90" } */
36 }