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" } */
7 #define DONT_GNU_PROTOTYPE
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 *, ...);
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" } */