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" } */ 6 7#define USE_SYSTEM_FORMATS 8#include "format.h" 9 10extern __attribute__((format(ms_printf, 1, 2))) void tformatprintf0 (const char *, ...); 11extern void __attribute__((format(ms_printf, 1, 2))) tformatprintf1 (const char *, ...); 12extern void foo (void), __attribute__((format(ms_printf, 1, 2))) tformatprintf2 (const char *, ...); 13extern __attribute__((noreturn)) void bar (void), __attribute__((format(ms_printf, 1, 2))) tformatprintf3 (const char *, ...); 14 15void 16baz (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} 27