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-1.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 for warnings for missing format attributes.  */
2
/* Origin: Joseph Myers  */
3
/* { dg-do compile } */
4
/* { dg-options "-Wmissing-format-attribute" } */
5
/* { dg-error "not declared" "" { target *-*-solaris2.5.1 *-*-solaris2.[5-8] } 24 } */
6
 
7
#include 
8
#include 
9
 
10
void
11
foo (const char *fmt, ...)
12
{
13
  va_list ap;
14
  va_start (ap, fmt);
15
  vprintf (fmt, ap); /* { dg-warning "candidate" "printf attribute warning" } */
16
  va_end (ap);
17
}
18
 
19
void
20
bar (const char *fmt, ...)
21
{
22
  va_list ap;
23
  va_start (ap, fmt);
24
  vscanf (fmt, ap); /* { dg-warning "candidate" "scanf attribute warning" { xfail *-*-solaris2.5.1 *-*-solaris2.[5-8] } } */
25
  va_end (ap);
26
}
27
 
28
__attribute__((__format__(__printf__, 1, 2))) void
29
foo2 (const char *fmt, ...)
30
{
31
  va_list ap;
32
  va_start (ap, fmt);
33
  vprintf (fmt, ap);
34
  va_end (ap);
35
}
36
 
37
void
38
vfoo (const char *fmt, va_list arg)
39
{
40
  vprintf (fmt, arg); /* { dg-warning "candidate" "printf attribute warning 2" } */
41
}

powered by: WebSVN 2.1.0

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