PR tree-optimization/81303
[official-gcc.git] / gcc / testsuite / gcc.dg / format / gcc_gfc-1.c
blob7e079b776920cc3afdb3b73bd4aece2eca1ab5d6
1 /* Test for gcc_gfc formats. */
2 /* Origin: Kaveh Ghazi <ghazi@caip.rutgers.edu> */
3 /* { dg-do compile } */
4 /* { dg-options "-Wformat" } */
6 #include "format.h"
8 /* Magic identifier must be set before the attribute is used. */
9 typedef struct locus locus;
11 extern int gfc_warn (const char *, ...) __attribute__ ((__format__ (__gcc_gfc__, 1, 2))) __attribute__ ((__nonnull__));
13 void
14 foo (unsigned int u, int i, char *s, unsigned long int ul, long int l,
15 llong ll, locus *loc)
17 /* Acceptable C90 specifiers, flags and modifiers. */
18 gfc_warn ("%%");
19 gfc_warn ("%u%d%i%c%s%%", u, i, i, i, s);
20 gfc_warn ("%lu%ld%li%%", ul, l, l);
22 /* Extensions provided in gfc_warn. */
23 gfc_warn ("%C");
24 gfc_warn ("%L", loc);
26 /* Various tests of bad argument types. */
27 gfc_warn ("%d", l); /* { dg-warning "format" "bad argument types" } */
28 gfc_warn ("%d", ll); /* { dg-warning "format" "bad argument types" } */
29 gfc_warn ("%s", &i); /* { dg-warning "format" "bad argument types" } */
30 gfc_warn ("%L", &i); /* { dg-warning "format" "bad argument types" } */
31 gfc_warn ("%C", i); /* { dg-warning "format" "too many arguments" } */