1 /* Test for format attributes: test default attributes are silently ignored
2 when a function is redeclared in an inappropriate manner. */
3 /* Origin: Joseph Myers <jsm28@cam.ac.uk> */
4 /* { dg-do compile } */
5 /* { dg-options "-std=gnu99 -Wformat" } */
7 /* We can't #include "format.h" here. */
9 /* This scanf declaration is static, so can't be the system function. */
10 static int scanf(const char *restrict
, ...);
12 /* This sscanf declaration doesn't have variable arguments, so isn't
13 compatible with a format attribute. */
14 extern int sscanf(const char *restrict
, const char *restrict
, int *); /* { dg-warning "conflict" "conflict" } */
17 foo (const char *s
, int *p
)
19 scanf("%ld", p
); /* { dg-bogus "format" "static" } */
20 sscanf(s
, "%ld", p
); /* { dg-bogus "format" "wrong type" } */
23 /* Dummy definition of scanf. */
25 scanf (const char *restrict fmt
, ...)