comparison libcpp/errors.c @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents 84e7813d76e9
children
comparison
equal deleted inserted replaced
131:84e7813d76e9 145:1830386684a0
1 /* Default error handlers for CPP Library. 1 /* Default error handlers for CPP Library.
2 Copyright (C) 1986-2018 Free Software Foundation, Inc. 2 Copyright (C) 1986-2020 Free Software Foundation, Inc.
3 Written by Per Bothner, 1994. 3 Written by Per Bothner, 1994.
4 Based on CCCP program by Paul Rubin, June 1986 4 Based on CCCP program by Paul Rubin, June 1986
5 Adapted to ANSI C, Richard Stallman, Jan 1987 5 Adapted to ANSI C, Richard Stallman, Jan 1987
6 6
7 This program is free software; you can redistribute it and/or modify it 7 This program is free software; you can redistribute it and/or modify it
50 static bool 50 static bool
51 cpp_diagnostic (cpp_reader * pfile, enum cpp_diagnostic_level level, 51 cpp_diagnostic (cpp_reader * pfile, enum cpp_diagnostic_level level,
52 enum cpp_warning_reason reason, 52 enum cpp_warning_reason reason,
53 const char *msgid, va_list *ap) 53 const char *msgid, va_list *ap)
54 { 54 {
55 source_location src_loc; 55 location_t src_loc;
56 56
57 if (CPP_OPTION (pfile, traditional)) 57 if (CPP_OPTION (pfile, traditional))
58 { 58 {
59 if (pfile->state.in_directive) 59 if (pfile->state.in_directive)
60 src_loc = pfile->directive_line; 60 src_loc = pfile->directive_line;
148 148
149 ATTRIBUTE_FPTR_PRINTF(6,0) 149 ATTRIBUTE_FPTR_PRINTF(6,0)
150 static bool 150 static bool
151 cpp_diagnostic_with_line (cpp_reader * pfile, enum cpp_diagnostic_level level, 151 cpp_diagnostic_with_line (cpp_reader * pfile, enum cpp_diagnostic_level level,
152 enum cpp_warning_reason reason, 152 enum cpp_warning_reason reason,
153 source_location src_loc, unsigned int column, 153 location_t src_loc, unsigned int column,
154 const char *msgid, va_list *ap) 154 const char *msgid, va_list *ap)
155 { 155 {
156 bool ret; 156 bool ret;
157 157
158 if (!pfile->cb.diagnostic) 158 if (!pfile->cb.diagnostic)
167 167
168 /* Print a warning or error, depending on the value of LEVEL. */ 168 /* Print a warning or error, depending on the value of LEVEL. */
169 169
170 bool 170 bool
171 cpp_error_with_line (cpp_reader *pfile, enum cpp_diagnostic_level level, 171 cpp_error_with_line (cpp_reader *pfile, enum cpp_diagnostic_level level,
172 source_location src_loc, unsigned int column, 172 location_t src_loc, unsigned int column,
173 const char *msgid, ...) 173 const char *msgid, ...)
174 { 174 {
175 va_list ap; 175 va_list ap;
176 bool ret; 176 bool ret;
177 177
186 186
187 /* Print a warning. The warning reason may be given in REASON. */ 187 /* Print a warning. The warning reason may be given in REASON. */
188 188
189 bool 189 bool
190 cpp_warning_with_line (cpp_reader *pfile, enum cpp_warning_reason reason, 190 cpp_warning_with_line (cpp_reader *pfile, enum cpp_warning_reason reason,
191 source_location src_loc, unsigned int column, 191 location_t src_loc, unsigned int column,
192 const char *msgid, ...) 192 const char *msgid, ...)
193 { 193 {
194 va_list ap; 194 va_list ap;
195 bool ret; 195 bool ret;
196 196
205 205
206 /* Print a pedantic warning. The warning reason may be given in REASON. */ 206 /* Print a pedantic warning. The warning reason may be given in REASON. */
207 207
208 bool 208 bool
209 cpp_pedwarning_with_line (cpp_reader *pfile, enum cpp_warning_reason reason, 209 cpp_pedwarning_with_line (cpp_reader *pfile, enum cpp_warning_reason reason,
210 source_location src_loc, unsigned int column, 210 location_t src_loc, unsigned int column,
211 const char *msgid, ...) 211 const char *msgid, ...)
212 { 212 {
213 va_list ap; 213 va_list ap;
214 bool ret; 214 bool ret;
215 215
225 /* Print a warning, including system headers. The warning reason may be 225 /* Print a warning, including system headers. The warning reason may be
226 given in REASON. */ 226 given in REASON. */
227 227
228 bool 228 bool
229 cpp_warning_with_line_syshdr (cpp_reader *pfile, enum cpp_warning_reason reason, 229 cpp_warning_with_line_syshdr (cpp_reader *pfile, enum cpp_warning_reason reason,
230 source_location src_loc, unsigned int column, 230 location_t src_loc, unsigned int column,
231 const char *msgid, ...) 231 const char *msgid, ...)
232 { 232 {
233 va_list ap; 233 va_list ap;
234 bool ret; 234 bool ret;
235 235
245 /* As cpp_error, but use SRC_LOC as the location of the error, without 245 /* As cpp_error, but use SRC_LOC as the location of the error, without
246 a column override. */ 246 a column override. */
247 247
248 bool 248 bool
249 cpp_error_at (cpp_reader * pfile, enum cpp_diagnostic_level level, 249 cpp_error_at (cpp_reader * pfile, enum cpp_diagnostic_level level,
250 source_location src_loc, const char *msgid, ...) 250 location_t src_loc, const char *msgid, ...)
251 { 251 {
252 va_list ap; 252 va_list ap;
253 bool ret; 253 bool ret;
254 254
255 va_start (ap, msgid); 255 va_start (ap, msgid);
296 that is not localized, but "" is replaced with localized "stdout". */ 296 that is not localized, but "" is replaced with localized "stdout". */
297 297
298 bool 298 bool
299 cpp_errno_filename (cpp_reader *pfile, enum cpp_diagnostic_level level, 299 cpp_errno_filename (cpp_reader *pfile, enum cpp_diagnostic_level level,
300 const char *filename, 300 const char *filename,
301 source_location loc) 301 location_t loc)
302 { 302 {
303 if (filename[0] == '\0') 303 if (filename[0] == '\0')
304 filename = _("stdout"); 304 filename = _("stdout");
305 305
306 return cpp_error_at (pfile, level, loc, "%s: %s", filename, 306 return cpp_error_at (pfile, level, loc, "%s: %s", filename,