Daily bump.
[gcc.git] / gcc / testsuite / g++.dg / warn / Wformat-gcc_diag-2.C
blob0cce53c9c36df0358de304ad98afb2a9d66ec8ce
1 // Test of -Wformat for subclasses of pp_element
2 // { dg-do compile }
3 // { dg-options "-Wformat" }
5 /* Magic identifiers must be set before the attribute is used.  */
7 typedef long long __gcc_host_wide_int__;
9 typedef struct location_s
11   const char *file;
12   int line;
13 } location_t;
15 union tree_node;
16 typedef union tree_node *tree;
18 /* Define gimple as a dummy type.  The typedef must be provided for
19    the C test to find the symbol.  */
20 typedef struct gimple gimple;
22 /* Likewise for gimple.  */
23 typedef struct cgraph_node cgraph_node;
25 /* Likewise for diagnostic_event_id_t.  */
26 typedef struct diagnostic_event_id_t diagnostic_event_id_t;
28 namespace pp_markup {
29 class element
32 } // namespace pp_markup
33 typedef pp_markup::element pp_element;
35 #define FORMAT(kind) __attribute__ ((format (__gcc_## kind ##__, 1, 2)))
37 void diag (const char*, ...) FORMAT (diag);
39 class sub_element : public pp_element
43 class sub_sub_element : public sub_element
47 void test_diag ()
49   sub_element e1;
50   sub_sub_element e2;
51   diag ("%e %e", &e1, &e2);