annotate gcc/testsuite/gcc.dg/format/ms_cast-1.c @ 158:494b0b89df80 default tip

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 25 May 2020 18:13:55 +0900
parents 04ced10e8804
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 /* Test for strings cast through integer types: should not be treated
kono
parents:
diff changeset
2 as format strings unless the types are of the same width as
kono
parents:
diff changeset
3 pointers (intptr_t or similar). */
kono
parents:
diff changeset
4 /* Origin: Joseph Myers <joseph@codesourcery.com> */
kono
parents:
diff changeset
5 /* { dg-do compile { target { *-*-mingw* } } } */
kono
parents:
diff changeset
6 /* { dg-options "-Wformat" } */
kono
parents:
diff changeset
7
kono
parents:
diff changeset
8 #define USE_SYSTEM_FORMATS
kono
parents:
diff changeset
9 #include "format.h"
kono
parents:
diff changeset
10
kono
parents:
diff changeset
11 void
kono
parents:
diff changeset
12 f (int x)
kono
parents:
diff changeset
13 {
kono
parents:
diff changeset
14 printf("%s", x); /* { dg-warning "format" } */
kono
parents:
diff changeset
15 printf((char *)(size_t)"%s", x); /* { dg-warning "format" } */
kono
parents:
diff changeset
16 printf((char *)(char)"%s", x); /* { dg-warning "cast from pointer to integer of different size" } */
kono
parents:
diff changeset
17 }