1 /* Test to verify that parameters of qualified narrow char pointer type 2 are accepted for attribute format printf, but others are rejected. 3 { dg-do compile } 4 { dg-options "-std=gnu99 -Wformat" } */ 5 6 #define DONT_GNU_PROTOTYPE 7 #include "format.h" 8 9 #define FORMAT(archetype, arg1, arg2) \ 10 __attribute__ ((format (archetype, arg1, arg2))) 11 12 FORMAT (gnu_attr_printf, 1, 2) 13 void fpc_1_2 (char *, ...); 14 15 FORMAT (gnu_attr_printf, 1, 2) 16 void fpcc_1_2 (const char *, ...); 17 18 FORMAT (gnu_attr_printf, 1, 2) 19 void frpc_1_2 (char * restrict, ...); 20 21 FORMAT (gnu_attr_printf, 1, 2) 22 void fpvc_1_2 (volatile char *, ...); 23 24 FORMAT (gnu_attr_printf, 1, 2) 25 void fpcvc_1_2 (const volatile char *, ...); 26 27 FORMAT (gnu_attr_printf, 1, 2) 28 void fpv_1_2 (void *, ...); /* { dg-error ".format. attribute argument 2 value .1. refers to parameter type .void \\\*." } */ 29 30 FORMAT (gnu_attr_printf, 1, 2) 31 void fppc_1_2 (char **, ...); /* { dg-error ".format. attribute argument 2 value .1. refers to parameter type .char \\\*\\\*." } */ 32 33 FORMAT (gnu_attr_printf, 1, 2) 34 void fpwc_1_2 (wchar_t *, ...); /* { dg-error ".format. attribute argument 2 value .1. refers to parameter type .wchar_t \\\*." } */ 35