diff options
Diffstat (limited to 'gcc/testsuite/gcc.dg/format/nonlit-2.c')
-rw-r--r-- | gcc/testsuite/gcc.dg/format/nonlit-2.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/format/nonlit-2.c b/gcc/testsuite/gcc.dg/format/nonlit-2.c new file mode 100644 index 0000000..9c3eee8 --- /dev/null +++ b/gcc/testsuite/gcc.dg/format/nonlit-2.c @@ -0,0 +1,13 @@ +/* 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" } */ + +extern int printf (const char *, ...); + +void +foo (char *s, __SIZE_TYPE__ i) +{ + printf ((const char *)i, i); /* { dg-warning "argument types" "non-literal" } */ + printf (s, i); /* { dg-warning "argument types" "non-literal" } */ +} |