OSDN Git Service

ms format support for mingw.
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / format / attr-4.c
1 /* Test for format attributes: test use of __attribute__
2    in prefix attributes.  */
3 /* Origin: Joseph Myers <jsm28@cam.ac.uk> */
4 /* { dg-do compile } */
5 /* { dg-options "-std=gnu99 -Wformat" } */
6
7 #define DONT_GNU_PROTOTYPE
8 #include "format.h"
9
10 extern __attribute__((format(gnu_attr_printf, 1, 2))) void tformatprintf0 (const char *, ...);
11 extern void __attribute__((format(gnu_attr_printf, 1, 2))) tformatprintf1 (const char *, ...);
12 extern void foo (void), __attribute__((format(gnu_attr_printf, 1, 2))) tformatprintf2 (const char *, ...);
13 extern __attribute__((noreturn)) void bar (void), __attribute__((format(gnu_attr_printf, 1, 2))) tformatprintf3 (const char *, ...);
14
15 void
16 baz (int i, int *ip, double d)
17 {
18   tformatprintf0 ("%d", i);
19   tformatprintf0 ("%"); /* { dg-warning "format" "attribute format printf case 0" } */
20   tformatprintf1 ("%d", i);
21   tformatprintf1 ("%"); /* { dg-warning "format" "attribute format printf case 1" } */
22   tformatprintf2 ("%d", i);
23   tformatprintf2 ("%"); /* { dg-warning "format" "attribute format printf case 2" } */
24   tformatprintf3 ("%d", i);
25   tformatprintf3 ("%"); /* { dg-warning "format" "attribute format printf case 3" } */
26 }