Mercurial > hg > CbC > CbC_gcc
comparison gcc/testsuite/gcc.dg/format/gcc_diag-10.c @ 131:84e7813d76e9
gcc-8.2
author | mir3636 |
---|---|
date | Thu, 25 Oct 2018 07:37:49 +0900 |
parents | 04ced10e8804 |
children | 1830386684a0 |
comparison
equal
deleted
inserted
replaced
111:04ced10e8804 | 131:84e7813d76e9 |
---|---|
13 } location_t; | 13 } location_t; |
14 | 14 |
15 union tree_node; | 15 union tree_node; |
16 typedef union tree_node *tree; | 16 typedef union tree_node *tree; |
17 | 17 |
18 /* Define gcall as a dummy type. The typedef must be provided for | 18 /* Define gimple as a dummy type. The typedef must be provided for |
19 the C test to find the symbol. */ | 19 the C test to find the symbol. */ |
20 typedef struct gcall gcall; | 20 typedef struct gimple gimple; |
21 | |
22 /* Likewise for gimple. */ | |
23 typedef struct gimple gimple; | |
21 | 24 |
22 #define FORMAT(kind) __attribute__ ((format (__gcc_## kind ##__, 1, 2))) | 25 #define FORMAT(kind) __attribute__ ((format (__gcc_## kind ##__, 1, 2))) |
23 | 26 |
24 void diag (const char*, ...) FORMAT (diag); | 27 void diag (const char*, ...) FORMAT (diag); |
25 void cdiag (const char*, ...) FORMAT (cdiag); | 28 void cdiag (const char*, ...) FORMAT (cdiag); |
26 void tdiag (const char*, ...) FORMAT (tdiag); | 29 void tdiag (const char*, ...) FORMAT (tdiag); |
27 void cxxdiag (const char*, ...) FORMAT (cxxdiag); | 30 void cxxdiag (const char*, ...) FORMAT (cxxdiag); |
31 void dump (const char*, ...) FORMAT (dump_printf); | |
28 | 32 |
29 void test_diag (tree t, gcall *gc) | 33 void test_diag (tree t, gimple *gc) |
30 { | 34 { |
31 diag ("%<"); /* { dg-warning "unterminated quoting directive" } */ | 35 diag ("%<"); /* { dg-warning "unterminated quoting directive" } */ |
32 diag ("%>"); /* { dg-warning "unmatched quoting directive " } */ | 36 diag ("%>"); /* { dg-warning "unmatched quoting directive " } */ |
33 diag ("%<foo%<bar%>%>"); /* { dg-warning "nested quoting directive" } */ | 37 diag ("%<foo%<bar%>%>"); /* { dg-warning "nested quoting directive" } */ |
34 | 38 |
35 diag ("%G", gc); | 39 diag ("%G", gc); /* { dg-warning "format" } */ |
36 diag ("%K", t); | 40 diag ("%K", t); /* { dg-warning "format" } */ |
37 | 41 |
38 diag ("%R"); /* { dg-warning "unmatched color reset directive" } */ | 42 diag ("%R"); /* { dg-warning "unmatched color reset directive" } */ |
39 diag ("%r", ""); /* { dg-warning "unterminated color directive" } */ | 43 diag ("%r", ""); /* { dg-warning "unterminated color directive" } */ |
40 diag ("%r%r", "", ""); /* { dg-warning "unterminated color directive" } */ | 44 diag ("%r%r", "", ""); /* { dg-warning "unterminated color directive" } */ |
41 diag ("%r%R", ""); | 45 diag ("%r%R", ""); |
42 diag ("%r%r%R", "", ""); | 46 diag ("%r%r%R", "", ""); |
43 diag ("%r%R%r%R", "", ""); | 47 diag ("%r%R%r%R", "", ""); |
44 | 48 |
45 diag ("%<%G%>", gc); /* { dg-warning ".G. conversion used within a quoted sequence" } */ | |
46 diag ("%<%K%>", t); /* { dg-warning ".K. conversion used within a quoted sequence" } */ | |
47 | |
48 diag ("%<%R%>"); /* { dg-warning "unmatched color reset directive" } */ | 49 diag ("%<%R%>"); /* { dg-warning "unmatched color reset directive" } */ |
49 diag ("%<%r%>", ""); /* { dg-warning "unterminated color directive" } */ | 50 diag ("%<%r%>", ""); /* { dg-warning "unterminated color directive" } */ |
50 diag ("%<%r%R%>", ""); | 51 diag ("%<%r%R%>", ""); |
51 } | 52 } |
52 | 53 |
53 void test_cdiag (tree t, gcall *gc) | 54 void test_cdiag (tree t, gimple *gc) |
54 { | 55 { |
55 cdiag ("%<"); /* { dg-warning "unterminated quoting directive" } */ | 56 cdiag ("%<"); /* { dg-warning "unterminated quoting directive" } */ |
56 cdiag ("%>"); /* { dg-warning "unmatched quoting directive " } */ | 57 cdiag ("%>"); /* { dg-warning "unmatched quoting directive " } */ |
57 cdiag ("%<foo%<bar%>%>"); /* { dg-warning "nested quoting directive" } */ | 58 cdiag ("%<foo%<bar%>%>"); /* { dg-warning "nested quoting directive" } */ |
58 | 59 |
88 cdiag ("%<%qD%>", t); /* { dg-warning ".q. flag used within a quoted sequence" } */ | 89 cdiag ("%<%qD%>", t); /* { dg-warning ".q. flag used within a quoted sequence" } */ |
89 cdiag ("%<%qE%>", t); /* { dg-warning ".q. flag used within a quoted sequence" } */ | 90 cdiag ("%<%qE%>", t); /* { dg-warning ".q. flag used within a quoted sequence" } */ |
90 cdiag ("%<%qT%>", t); /* { dg-warning ".q. flag used within a quoted sequence" } */ | 91 cdiag ("%<%qT%>", t); /* { dg-warning ".q. flag used within a quoted sequence" } */ |
91 } | 92 } |
92 | 93 |
93 void test_tdiag (tree t, gcall *gc) | 94 void test_tdiag (tree t, gimple *gc) |
94 { | 95 { |
95 tdiag ("%<"); /* { dg-warning "unterminated quoting directive" } */ | 96 tdiag ("%<"); /* { dg-warning "unterminated quoting directive" } */ |
96 tdiag ("%>"); /* { dg-warning "unmatched quoting directive " } */ | 97 tdiag ("%>"); /* { dg-warning "unmatched quoting directive " } */ |
97 tdiag ("%<foo%<bar%>%>"); /* { dg-warning "nested quoting directive" } */ | 98 tdiag ("%<foo%<bar%>%>"); /* { dg-warning "nested quoting directive" } */ |
98 | 99 |
125 tdiag ("%<%qD%>", t); /* { dg-warning ".q. flag used within a quoted sequence" } */ | 126 tdiag ("%<%qD%>", t); /* { dg-warning ".q. flag used within a quoted sequence" } */ |
126 tdiag ("%<%qE%>", t); /* { dg-warning ".q. flag used within a quoted sequence" } */ | 127 tdiag ("%<%qE%>", t); /* { dg-warning ".q. flag used within a quoted sequence" } */ |
127 tdiag ("%<%qT%>", t); /* { dg-warning ".q. flag used within a quoted sequence" } */ | 128 tdiag ("%<%qT%>", t); /* { dg-warning ".q. flag used within a quoted sequence" } */ |
128 } | 129 } |
129 | 130 |
130 void test_cxxdiag (tree t, gcall *gc) | 131 void test_cxxdiag (tree t, gimple *gc) |
131 { | 132 { |
132 cxxdiag ("%A", t); /* { dg-warning ".A. conversion used unquoted" } */ | 133 cxxdiag ("%A", t); /* { dg-warning ".A. conversion used unquoted" } */ |
133 cxxdiag ("%D", t); /* { dg-warning ".D. conversion used unquoted" } */ | 134 cxxdiag ("%D", t); /* { dg-warning ".D. conversion used unquoted" } */ |
134 cxxdiag ("%E", t); | 135 cxxdiag ("%E", t); |
135 cxxdiag ("%F", t); /* { dg-warning ".F. conversion used unquoted" } */ | 136 cxxdiag ("%F", t); /* { dg-warning ".F. conversion used unquoted" } */ |
158 cxxdiag ("%<%S%>", t); | 159 cxxdiag ("%<%S%>", t); |
159 cxxdiag ("%<%T%>", t); | 160 cxxdiag ("%<%T%>", t); |
160 cxxdiag ("%<%V%>", t); | 161 cxxdiag ("%<%V%>", t); |
161 cxxdiag ("%<%X%>", t); | 162 cxxdiag ("%<%X%>", t); |
162 } | 163 } |
164 | |
165 void test_dump (tree t, gimple *stmt) | |
166 { | |
167 dump ("%<"); /* { dg-warning "unterminated quoting directive" } */ | |
168 dump ("%>"); /* { dg-warning "unmatched quoting directive " } */ | |
169 dump ("%<foo%<bar%>%>"); /* { dg-warning "nested quoting directive" } */ | |
170 | |
171 dump ("%R"); /* { dg-warning "unmatched color reset directive" } */ | |
172 dump ("%r", ""); /* { dg-warning "unterminated color directive" } */ | |
173 dump ("%r%r", "", ""); /* { dg-warning "unterminated color directive" } */ | |
174 dump ("%r%R", ""); | |
175 dump ("%r%r%R", "", ""); | |
176 dump ("%r%R%r%R", "", ""); | |
177 | |
178 dump ("%<%R%>"); /* { dg-warning "unmatched color reset directive" } */ | |
179 dump ("%<%r%>", ""); /* { dg-warning "unterminated color directive" } */ | |
180 dump ("%<%r%R%>", ""); | |
181 | |
182 dump ("%E", stmt); | |
183 dump ("%T", t); | |
184 dump ("%G", stmt); | |
185 } |