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" } */
6
7/* We can't #include "format.h" here.  */
8
9/* This scanf declaration is static, so can't be the system function.  */
10static int scanf(const char *restrict, ...);
11
12/* This sscanf declaration doesn't have variable arguments, so isn't
13   compatible with a format attribute.  */
14extern int sscanf(const char *restrict, const char *restrict, int *); /* { dg-warning "conflict" "conflict" } */
15
16void
17foo (const char *s, int *p)
18{
19  scanf("%ld", p); /* { dg-bogus "format" "static" } */
20  sscanf(s, "%ld", p); /* { dg-bogus "format" "wrong type" } */
21}
22
23/* Dummy definition of scanf.  */
24static int
25scanf (const char *restrict fmt, ...)
26{
27  return 0;
28}
29