2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / gcc / testsuite / gcc.dg / format / attr-4.c
blobef50c494f35d1a8a6bea850c8918ac205cc7e367
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 #include "format.h"
9 extern __attribute__((format(printf, 1, 2))) void tformatprintf0 (const char *, ...);
10 extern void __attribute__((format(printf, 1, 2))) tformatprintf1 (const char *, ...);
11 extern void foo (void), __attribute__((format(printf, 1, 2))) tformatprintf2 (const char *, ...);
12 extern __attribute__((noreturn)) void bar (void), __attribute__((format(printf, 1, 2))) tformatprintf3 (const char *, ...);
14 void
15 baz (int i, int *ip, double d)
17 tformatprintf0 ("%d", i);
18 tformatprintf0 ("%"); /* { dg-warning "format" "attribute format printf case 0" } */
19 tformatprintf1 ("%d", i);
20 tformatprintf1 ("%"); /* { dg-warning "format" "attribute format printf case 1" } */
21 tformatprintf2 ("%d", i);
22 tformatprintf2 ("%"); /* { dg-warning "format" "attribute format printf case 2" } */
23 tformatprintf3 ("%d", i);
24 tformatprintf3 ("%"); /* { dg-warning "format" "attribute format printf case 3" } */