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

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [tags/] [gnu-src/] [gcc-4.5.1/] [gcc-4.5.1-or32-1.0rc2/] [gcc/] [testsuite/] [gcc.dg/] [format/] [attr-5.c] - Rev 384

Compare with Previous | Blame | View Log

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

Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

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