2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / gcc / testsuite / gcc.dg / format / attr-6.c
blob4e95cfb00f6ed8319166960a203c1abca04ff6f7
1 /* Test for format attributes: test default attributes are applied
2 to implicit declarations. */
3 /* Origin: Joseph Myers <jsm28@cam.ac.uk> */
4 /* { dg-do compile } */
5 /* { dg-options "-std=gnu89 -Wformat" } */
7 /* We can't #include "format.h" here. */
9 /* Technically, none of the format functions should be implicitly declared;
10 either the implicit type is wrong, the function has variable arguments
11 or it requires a type declared in a header. However, some bad programming
12 practice uses implicit declarations of some of these functions.
14 Note that printf is not used in this test because of the declaration
15 of it as a built-in function. */
17 void
18 foo (const char *s, int *p)
20 scanf("%ld", p); /* { dg-warning "format" "implicit scanf" } */