2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / gcc / testsuite / g++.dg / warn / format1.C
blob27bc414b098aed820a198b1670aa5c0cc18ad0a2
1 // Test that formats get checked according to C94.
2 // Origin: Joseph Myers <jsm28@cam.ac.uk>.
3 // { dg-do compile }
4 // { dg-options "-ansi -pedantic -Wformat" }
6 #include <cstdio>
8 void
9 foo (int i, int *ip, __WINT_TYPE__ lc, wchar_t *ls)
11   std::printf ("%d%ls%lc\n", i, ls, lc);
12   std::printf ("%d", ls); // { dg-warning "format" "printf warning" }
13   std::scanf ("%d%lc%ls%l[abc]", ip, ls, ls, ls);
14   std::scanf ("%hd", ip); // { dg-warning "format" "scanf warning" }