OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.2.2/] [gcc/] [testsuite/] [gcc.dg/] [format/] [attr-5.c] - Blame information for rev 154

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
/* 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.  */
10
static int scanf(const char *restrict, ...);
11
 
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" } */
15
 
16
void
17
foo (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.  */
24
static int
25
scanf (const char *restrict fmt, ...)
26
{
27
  return 0;
28
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.