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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.dg/] [warn/] [miss-format-1.C] - Blame information for rev 715

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

Line No. Rev Author Line
1 693 jeremybenn
/* Test for warnings for missing format attributes.  */
2
/* Origin: Joseph Myers  */
3
/* { dg-do compile } */
4
/* { dg-options "-Wmissing-format-attribute" } */
5
/* { dg-options "-Wmissing-format-attribute -Wno-abi" { target arm_eabi } } */
6
/* VxWorks does not provide vscanf, either in kernel or RTP mode.  */
7
/* { dg-error "not declared" "" { target { *-*-solaris2.8 *-*-vxworks* alpha*-dec-osf* } } 26 } */
8
 
9
#include 
10
#include 
11
 
12
void
13
foo (const char *fmt, ...)
14
{
15
  va_list ap;
16
  va_start (ap, fmt);
17
  vprintf (fmt, ap); /* { dg-warning "candidate" "printf attribute warning" } */
18
  va_end (ap);
19
}
20
 
21
void
22
bar (const char *fmt, ...)
23
{
24
  va_list ap;
25
  va_start (ap, fmt);
26
  vscanf (fmt, ap); /* { dg-warning "candidate" "scanf attribute warning" { xfail *-*-solaris2.8 *-*-vxworks* alpha*-dec-osf* } } */
27
  va_end (ap);
28
}
29
 
30
__attribute__((__format__(__printf__, 1, 2))) void
31
foo2 (const char *fmt, ...)
32
{
33
  va_list ap;
34
  va_start (ap, fmt);
35
  vprintf (fmt, ap);
36
  va_end (ap);
37
}
38
 
39
void
40
vfoo (const char *fmt, va_list arg)
41
{
42
  vprintf (fmt, arg); /* { dg-warning "candidate" "printf attribute warning 2" } */
43
}

powered by: WebSVN 2.1.0

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