Update concepts branch to revision 131834
[official-gcc.git] / gcc / testsuite / gcc.dg / format / ms_attr-7.c
blobb169e2c3ab51e6440309a78b4610551d32298a50
1 /* Test for format attributes: test applying them to types. */
2 /* Origin: Joseph Myers <jsm28@cam.ac.uk> */
3 /* { dg-do compile { target { *-*-mingw* } } } */
4 /* { dg-options "-std=gnu99 -Wformat" } */
6 #define DONT_GNU_PROTOTYPE
7 #include "format.h"
9 __attribute__((format(ms_printf, 1, 2))) void (*tformatprintf0) (const char *, ...);
10 void (*tformatprintf1) (const char *, ...) __attribute__((format(ms_printf, 1, 2)));
11 void (__attribute__((format(ms_printf, 1, 2))) *tformatprintf2) (const char *, ...);
12 void (__attribute__((format(ms_printf, 1, 2))) ****tformatprintf3) (const char *, ...);
14 char * (__attribute__((format_arg(1))) *tformat_arg) (const char *);
16 void
17 baz (int i)
19 (*tformatprintf0) ("%d", i);
20 (*tformatprintf0) ((*tformat_arg) ("%d"), i);
21 (*tformatprintf0) ("%"); /* { dg-warning "format" "prefix" } */
22 (*tformatprintf0) ((*tformat_arg) ("%")); /* { dg-warning "format" "prefix" } */
23 (*tformatprintf1) ("%d", i);
24 (*tformatprintf1) ((*tformat_arg) ("%d"), i);
25 (*tformatprintf1) ("%"); /* { dg-warning "format" "postfix" } */
26 (*tformatprintf1) ((*tformat_arg) ("%")); /* { dg-warning "format" "postfix" } */
27 (*tformatprintf2) ("%d", i);
28 (*tformatprintf2) ((*tformat_arg) ("%d"), i);
29 (*tformatprintf2) ("%"); /* { dg-warning "format" "nested" } */
30 (*tformatprintf2) ((*tformat_arg) ("%")); /* { dg-warning "format" "nested" } */
31 (****tformatprintf3) ("%d", i);
32 (****tformatprintf3) ((*tformat_arg) ("%d"), i);
33 (****tformatprintf3) ("%"); /* { dg-warning "format" "nested 2" } */
34 (****tformatprintf3) ((*tformat_arg) ("%")); /* { dg-warning "format" "nested 2" } */