OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.2.2/] [gcc/] [testsuite/] [g++.dg/] [warn/] [miss-format-6.C] - Blame information for rev 149

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
/* Test warnings for missing format attributes on function pointers.  */
2
/* Origin: Kaveh Ghazi  */
3
/* { dg-do compile } */
4
/* { dg-options "-Wmissing-format-attribute" } */
5
 
6
#include 
7
 
8
typedef void (*noattr_t) (const char *, ...);
9
typedef noattr_t __attribute__ ((__format__(__printf__, 1, 2))) attr_t;
10
 
11
typedef void (*vnoattr_t) (const char *, va_list);
12
typedef vnoattr_t __attribute__ ((__format__(__printf__, 1, 0))) vattr_t;
13
 
14
extern void foo1 (noattr_t);
15
extern void foo2 (attr_t);
16
extern void foo3 (vnoattr_t);
17
extern void foo4 (vattr_t);
18
 
19
void
20
foo (noattr_t na, attr_t a, vnoattr_t vna, vattr_t va)
21
{
22
  foo1 (na);
23
  foo1 (a); /* { dg-warning "candidate" "parameter passing warning" } */
24
  foo2 (na);
25
  foo2 (a);
26
 
27
  foo3 (vna);
28
  foo3 (va); /* { dg-warning "candidate" "parameter passing warning" } */
29
  foo4 (vna);
30
  foo4 (va);
31
}

powered by: WebSVN 2.1.0

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