Update concepts branch to revision 131834
[official-gcc.git] / gcc / testsuite / gcc.dg / format / ms_attr-4.c
blob45f09ef22782dbcff5d5b59b467b5ba4e71674df
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 { target { *-*-mingw* } } } */
5 /* { dg-options "-std=gnu99 -Wformat" } */
7 #define USE_SYSTEM_FORMATS
8 #include "format.h"
10 extern __attribute__((format(ms_printf, 1, 2))) void tformatprintf0 (const char *, ...);
11 extern void __attribute__((format(ms_printf, 1, 2))) tformatprintf1 (const char *, ...);
12 extern void foo (void), __attribute__((format(ms_printf, 1, 2))) tformatprintf2 (const char *, ...);
13 extern __attribute__((noreturn)) void bar (void), __attribute__((format(ms_printf, 1, 2))) tformatprintf3 (const char *, ...);
15 void
16 baz (int i, int *ip, double d)
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" } */