]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/testsuite/g++.dg/warn/miss-format-1.C
Remove obsolete Tru64 UNIX V5.1B support
[thirdparty/gcc.git] / gcc / testsuite / g++.dg / warn / miss-format-1.C
CommitLineData
104f8784
KG
1/* Test for warnings for missing format attributes. */
2/* Origin: Joseph Myers <jsm28@cam.ac.uk> */
3/* { dg-do compile } */
4/* { dg-options "-Wmissing-format-attribute" } */
07d8efe3 5/* { dg-options "-Wmissing-format-attribute -Wno-abi" { target arm_eabi } } */
c6fee227 6/* VxWorks does not provide vscanf, either in kernel or RTP mode. */
5c30094f 7/* { dg-error "not declared" "" { target { *-*-solaris2.8 *-*-vxworks* } } 26 } */
104f8784
KG
8
9#include <stdio.h>
10#include <stdarg.h>
11
12void
13foo (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
21void
22bar (const char *fmt, ...)
23{
24 va_list ap;
25 va_start (ap, fmt);
5c30094f 26 vscanf (fmt, ap); /* { dg-warning "candidate" "scanf attribute warning" { xfail *-*-solaris2.8 *-*-vxworks* } } */
104f8784
KG
27 va_end (ap);
28}
29
30__attribute__((__format__(__printf__, 1, 2))) void
31foo2 (const char *fmt, ...)
32{
33 va_list ap;
34 va_start (ap, fmt);
35 vprintf (fmt, ap);
36 va_end (ap);
37}
38
39void
40vfoo (const char *fmt, va_list arg)
41{
42 vprintf (fmt, arg); /* { dg-warning "candidate" "printf attribute warning 2" } */
43}