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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [gcc.dg/] [format/] [miss-5.c] - Blame information for rev 816

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 <ghazi@caip.rutgers.edu> */
3
/* { dg-do compile } */
4
/* { dg-options "-std=gnu99 -Wmissing-format-attribute" } */
5
 
6
#include "format.h"
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
noattr_t
15
foo1 (noattr_t na, attr_t a, int i)
16
{
17
  if (i)
18
    return na;
19
  else
20
    return a; /* { dg-warning "candidate" "return type warning" } */
21
}
22
 
23
attr_t
24
foo2 (noattr_t na, attr_t a, int i)
25
{
26
  if (i)
27
    return na;
28
  else
29
    return a;
30
}
31
 
32
vnoattr_t
33
foo3 (vnoattr_t vna, vattr_t va, int i)
34
{
35
  if (i)
36
    return vna;
37
  else
38
    return va; /* { dg-warning "candidate" "return type warning" } */
39
}
40
 
41
vattr_t
42
foo4 (vnoattr_t vna, vattr_t va, int i)
43
{
44
  if (i)
45
    return vna;
46
  else
47
    return va;
48
}

powered by: WebSVN 2.1.0

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