S/390: Allow immediates in loc expander
[official-gcc.git] / gcc / testsuite / gcc.dg / format / attr-7.c
blobe434fa534b61bc73c54f2d7d0e1aa881bed10462
1 /* Test for format attributes: test applying them to types. */
2 /* Origin: Joseph Myers <jsm28@cam.ac.uk> */
3 /* { dg-do compile } */
4 /* { dg-options "-std=gnu99 -Wformat" } */
6 #define DONT_GNU_PROTOTYPE
7 #include "format.h"
9 __attribute__((format(gnu_attr_printf, 1, 2))) void (*tformatprintf0) (const char *, ...);
10 void (*tformatprintf1) (const char *, ...) __attribute__((format(gnu_attr_printf, 1, 2)));
11 void (__attribute__((format(gnu_attr_printf, 1, 2))) *tformatprintf2) (const char *, ...);
12 void (__attribute__((format(gnu_attr_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 "23: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" } */