annotate gcc/testsuite/gcc.dg/format/ms_plus-1.c @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 /* Test for printf formats using string literal plus constant.
kono
parents:
diff changeset
2 */
kono
parents:
diff changeset
3 /* Origin: Jakub Jelinek <jakub@redhat.com> */
kono
parents:
diff changeset
4 /* { dg-do compile { target { *-*-mingw* } } } */
kono
parents:
diff changeset
5 /* { dg-options "-std=iso9899:1990 -pedantic -Wformat=2" } */
kono
parents:
diff changeset
6
kono
parents:
diff changeset
7 #define USE_SYSTEM_FORMATS
kono
parents:
diff changeset
8 #include "format.h"
kono
parents:
diff changeset
9
kono
parents:
diff changeset
10 void
kono
parents:
diff changeset
11 foo (int i)
kono
parents:
diff changeset
12 {
kono
parents:
diff changeset
13 printf ("%%d\n" + 1, i);
kono
parents:
diff changeset
14 printf (5 + "%.-*d%3d\n", i);
kono
parents:
diff changeset
15 printf ("%d%d" + 2, i, i); /* { dg-warning "arguments" "wrong number of args" } */
kono
parents:
diff changeset
16 printf (3 + "%d\n"); /* { dg-warning "zero-length" "zero-length string" } */
kono
parents:
diff changeset
17 printf ("%d\n" + i, i); /* { dg-warning "not a string" "non-constant addend" } */
kono
parents:
diff changeset
18 printf ("%d\n" + 10); /* { dg-warning "not a string" "too large addend" } */
kono
parents:
diff changeset
19 printf ("%d\n" - 1, i); /* { dg-warning "not a string" "minus constant" } */
kono
parents:
diff changeset
20 printf ("%d\n" + -1, i); /* { dg-warning "not a string" "negative addend" } */
kono
parents:
diff changeset
21 }