Mercurial > hg > CbC > CbC_gcc
comparison gcc/testsuite/gcc.dg/format/plus-1.c @ 111:04ced10e8804
gcc 7
author | kono |
---|---|
date | Fri, 27 Oct 2017 22:46:09 +0900 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
68:561a7518be6b | 111:04ced10e8804 |
---|---|
1 /* Test for printf formats using string literal plus constant. | |
2 */ | |
3 /* Origin: Jakub Jelinek <jakub@redhat.com> */ | |
4 /* { dg-do compile } */ | |
5 /* { dg-options "-std=iso9899:1990 -pedantic -Wformat=2" } */ | |
6 | |
7 #include "format.h" | |
8 | |
9 void | |
10 foo (int i) | |
11 { | |
12 printf ("%%d\n" + 1, i); | |
13 printf (5 + "%.-*d%3d\n", i); | |
14 printf ("%d%d" + 2, i, i); /* { dg-warning "arguments" "wrong number of args" } */ | |
15 printf (3 + "%d\n"); /* { dg-warning "zero-length" "zero-length string" } */ | |
16 printf ("%d\n" + i, i); /* { dg-warning "not a string" "non-constant addend" } */ | |
17 printf ("%d\n" + 10); /* { dg-warning "not a string" "too large addend" } */ | |
18 printf ("%d\n" - 1, i); /* { dg-warning "not a string" "minus constant" } */ | |
19 printf ("%d\n" + -1, i); /* { dg-warning "not a string" "negative addend" } */ | |
20 } |