gcc/testsuite/g++.dg/warn/warn_format_signedness.C
raw| 1 | /* { dg-do compile } */ |
| 2 | /* { dg-options "-Wformat -Wformat-signedness" } */ |
| 3 | |
| 4 | /* PR c/60194 */ |
| 5 | |
| 6 | void foo(unsigned u, int i, unsigned char uc, signed char sc) { |
| 7 | __builtin_printf("%d\n", u); /* { dg-warning "expects argument of type 'int', but argument 2 has type 'unsigned int'" } */ |
| 8 | __builtin_printf("%u\n", i); /* { dg-warning "expects argument of type 'unsigned int', but argument 2 has type 'int'" } */ |
| 9 | __builtin_printf("%c\n", sc); |
| 10 | __builtin_printf("%c\n", uc); |
| 11 | } |