| 1 |
// Test that formats get checked according to C94. |
| 2 |
// Origin: Joseph Myers <[email protected]>. |
| 3 |
// { dg-do compile } |
| 4 |
// { dg-options "-ansi -pedantic -Wformat" } |
| 5 |
// { dg-skip-if "requires hosted libstdc++ for cstdio" { ! hostedlib } } |
| 6 |
|
| 7 |
#include <cstdio> |
| 8 |
|
| 9 |
void |
| 10 |
foo (int i, int *ip, __WINT_TYPE__ lc, wchar_t *ls) |
| 11 |
{ |
| 12 |
std::printf ("%d%ls%lc\n", i, ls, lc); |
| 13 |
std::printf ("%d", ls); // { dg-warning "format" "printf warning" } |
| 14 |
std::scanf ("%d%lc%ls%l[abc]", ip, ls, ls, ls); |
| 15 |
std::scanf ("%hd", ip); // { dg-warning "format" "scanf warning" } |
| 16 |
} |