diff options
Diffstat (limited to 'gcc/cpperror.c')
-rw-r--r-- | gcc/cpperror.c | 51 |
1 files changed, 23 insertions, 28 deletions
diff --git a/gcc/cpperror.c b/gcc/cpperror.c index cb681f00f24..4926cb24ac5 100644 --- a/gcc/cpperror.c +++ b/gcc/cpperror.c @@ -25,40 +25,39 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "config.h" #include "system.h" -#include "coretypes.h" -#include "tm.h" #include "cpplib.h" #include "cpphash.h" #include "intl.h" -static void print_location (cpp_reader *, unsigned int, unsigned int); +static void print_location (cpp_reader *, fileline, unsigned int); /* Print the logical file location (LINE, COL) in preparation for a diagnostic. Outputs the #include chain if it has changed. A line of zero suppresses the include stack, and outputs the program name instead. */ static void -print_location (cpp_reader *pfile, unsigned int line, unsigned int col) +print_location (cpp_reader *pfile, fileline line, unsigned int col) { - if (!pfile->buffer || line == 0) + if (line == 0) fprintf (stderr, "%s: ", progname); else { const struct line_map *map; + unsigned int lin; - map = lookup_line (&pfile->line_maps, line); - print_containing_files (&pfile->line_maps, map); + map = linemap_lookup (&pfile->line_maps, line); + linemap_print_containing_files (&pfile->line_maps, map); - line = SOURCE_LINE (map, line); + lin = SOURCE_LINE (map, line); if (col == 0) col = 1; - if (line == 0) + if (lin == 0) fprintf (stderr, "%s:", map->to_file); else if (CPP_OPTION (pfile, show_column) == 0) - fprintf (stderr, "%s:%u:", map->to_file, line); + fprintf (stderr, "%s:%u:", map->to_file, lin); else - fprintf (stderr, "%s:%u:%u:", map->to_file, line, col); + fprintf (stderr, "%s:%u:%u:", map->to_file, lin, col); fputc (' ', stderr); } @@ -70,7 +69,7 @@ print_location (cpp_reader *pfile, unsigned int line, unsigned int col) the correct place by default. Returns 0 if the error has been suppressed. */ int -_cpp_begin_message (cpp_reader *pfile, int code, unsigned int line, +_cpp_begin_message (cpp_reader *pfile, int code, fileline line, unsigned int column) { int level = DL_EXTRACT (code); @@ -126,29 +125,25 @@ _cpp_begin_message (cpp_reader *pfile, int code, unsigned int line, void cpp_error (cpp_reader * pfile, int level, const char *msgid, ...) { - unsigned int line, column; + fileline line; + unsigned int column; va_list ap; va_start (ap, msgid); - if (pfile->buffer) + if (CPP_OPTION (pfile, traditional)) { - if (CPP_OPTION (pfile, traditional)) - { - if (pfile->state.in_directive) - line = pfile->directive_line; - else - line = pfile->line; - column = 0; - } + if (pfile->state.in_directive) + line = pfile->directive_line; else - { - line = pfile->cur_token[-1].line; - column = pfile->cur_token[-1].col; - } + line = pfile->line; + column = 0; } else - line = column = 0; + { + line = pfile->cur_token[-1].line; + column = pfile->cur_token[-1].col; + } if (_cpp_begin_message (pfile, level, line, column)) v_message (msgid, ap); @@ -159,7 +154,7 @@ cpp_error (cpp_reader * pfile, int level, const char *msgid, ...) /* Print an error at a specific location. */ void cpp_error_with_line (cpp_reader *pfile, int level, - unsigned int line, unsigned int column, + fileline line, unsigned int column, const char *msgid, ...) { va_list ap; |