diff options
Diffstat (limited to 'gcc/testsuite/gcc.dg/format-diag-1.c')
-rw-r--r-- | gcc/testsuite/gcc.dg/format-diag-1.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/format-diag-1.c b/gcc/testsuite/gcc.dg/format-diag-1.c new file mode 100644 index 00000000000..33364d75159 --- /dev/null +++ b/gcc/testsuite/gcc.dg/format-diag-1.c @@ -0,0 +1,18 @@ +/* Test for format diagnostics. */ +/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ +/* { dg-do compile } */ +/* { dg-options "-std=gnu99 -Wformat" } */ + +extern int printf (const char *, ...); + +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 format', not to + `unsigned int format' or similar. */ + printf ("%zu", d); /* { dg-warning "size_t format" "size_t format warning" } */ +} |