diff options
author | Per Bothner <per@bothner.com> | 2004-04-22 19:22:27 -0700 |
---|---|---|
committer | Per Bothner <bothner@gcc.gnu.org> | 2004-04-22 19:22:27 -0700 |
commit | 500bee0adc06da520a9b8b3afde33afee6f314f3 (patch) | |
tree | 04a13ceb8485dc1405388eb42a55f0a9c7a8ebbc /gcc/cpplex.c | |
parent | 9344fdb9407d69218d02c2e509a358e80cf64eb6 (diff) | |
download | gcc-500bee0adc06da520a9b8b3afde33afee6f314f3.zip gcc-500bee0adc06da520a9b8b3afde33afee6f314f3.tar.gz gcc-500bee0adc06da520a9b8b3afde33afee6f314f3.tar.bz2 |
line-map.h (struct line_maps): New field highest_line.
* line-map.h (struct line_maps): New field highest_line.
(linemap_position_for_column): Make non-inline function.
(LINEMAP_POSITION_FOR_COLUMN): New macro.
* line-map.c (linemap_init): Clear highest_line field.
(linemap_add): Set highest_line field.
(linemap_line_start): Minor optimization - use highest_line field.
Reduce maximum column hint to 10000. Update highest_line field.
(linemap_position_for_column): Moved from line-map.h. Optimize a bit.
* cpphash.h (struct cpp_reader): Remove line field - instead use
line_table->highest_line.
(saved_line): Remove unused field.
(CPP_INCREMENT_FILE): Don't do linemap_lookup - just use newest map.
Use line_table's highest_line field instead of cpp_reader's line.
* cpplib.c (start_directive): Likewise use highest_line field.
(do_line, do_linemarker): Likewise just use newest map.
(_cpp_do_file_change): Don't need to set cpp_reader's line field.
* cpperror.c (cpp_error): Likewise use highest_line field.
* cppfiles.c (open_file_failed: Likewise.
(cpp_make_system_header): Likewise use newest map and highest_line.
* cppinit.c (cpp_create_reader): Don't initialize removed field.
* cpplex.c (_cpp_process_line_notes, _cpp_skip_block_comment,
skip_line_comment, skip_whitespace, _cpp_get_fresh_line,
_cpp_lex_direct): Likewise use highest_line.
(_cpp_lex_direct): Use new LINEMAP_POSITION_FOR_COLUMN macro.
* cppmacro.c (_cpp_builtin_macro_text): Likewise use highest_line,
and use newest map.
* cpppch.c (cpp_read_state): Don't save+restore cpp_reader's line.
* cpptrad.c (_cpp_overlay_buffer): Don't save cpp_reader's line.
(copy_comment, _cpp_scan_out_logical_line): Likewise use highest_line.
From-SVN: r81074
Diffstat (limited to 'gcc/cpplex.c')
-rw-r--r-- | gcc/cpplex.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/gcc/cpplex.c b/gcc/cpplex.c index 9912aac..d03096c 100644 --- a/gcc/cpplex.c +++ b/gcc/cpplex.c @@ -270,12 +270,12 @@ _cpp_process_line_notes (cpp_reader *pfile, int in_comment) if (note->type == '\\' || note->type == ' ') { if (note->type == ' ' && !in_comment) - cpp_error_with_line (pfile, CPP_DL_WARNING, pfile->line, col, + cpp_error_with_line (pfile, CPP_DL_WARNING, pfile->line_table->highest_line, col, "backslash and newline separated by space"); if (buffer->next_line > buffer->rlimit) { - cpp_error_with_line (pfile, CPP_DL_PEDWARN, pfile->line, col, + cpp_error_with_line (pfile, CPP_DL_PEDWARN, pfile->line_table->highest_line, col, "backslash-newline at end of file"); /* Prevent "no newline at end of file" warning. */ buffer->next_line = buffer->rlimit; @@ -290,14 +290,14 @@ _cpp_process_line_notes (cpp_reader *pfile, int in_comment) && (!in_comment || warn_in_comment (pfile, note))) { if (CPP_OPTION (pfile, trigraphs)) - cpp_error_with_line (pfile, CPP_DL_WARNING, pfile->line, col, + cpp_error_with_line (pfile, CPP_DL_WARNING, pfile->line_table->highest_line, col, "trigraph ??%c converted to %c", note->type, (int) _cpp_trigraph_map[note->type]); else { cpp_error_with_line - (pfile, CPP_DL_WARNING, pfile->line, col, + (pfile, CPP_DL_WARNING, pfile->line_table->highest_line, col, "trigraph ??%c ignored, use -trigraphs to enable", note->type); } @@ -343,7 +343,7 @@ _cpp_skip_block_comment (cpp_reader *pfile) { buffer->cur = cur; cpp_error_with_line (pfile, CPP_DL_WARNING, - pfile->line, CPP_BUF_COL (buffer), + pfile->line_table->highest_line, CPP_BUF_COL (buffer), "\"/*\" within comment"); } } @@ -375,13 +375,13 @@ static int skip_line_comment (cpp_reader *pfile) { cpp_buffer *buffer = pfile->buffer; - unsigned int orig_line = pfile->line; + unsigned int orig_line = pfile->line_table->highest_line; while (*buffer->cur != '\n') buffer->cur++; _cpp_process_line_notes (pfile, true); - return orig_line != pfile->line; + return orig_line != pfile->line_table->highest_line; } /* Skips whitespace, saving the next non-whitespace character. */ @@ -400,7 +400,7 @@ skip_whitespace (cpp_reader *pfile, cppchar_t c) else if (c == '\0') saw_NUL = true; else if (pfile->state.in_directive && CPP_PEDANTIC (pfile)) - cpp_error_with_line (pfile, CPP_DL_PEDWARN, pfile->line, + cpp_error_with_line (pfile, CPP_DL_PEDWARN, pfile->line_table->highest_line, CPP_BUF_COL (buffer), "%s in preprocessing directive", c == '\f' ? "form feed" : "vertical tab"); @@ -777,7 +777,7 @@ _cpp_get_fresh_line (cpp_reader *pfile) { /* Only warn once. */ buffer->next_line = buffer->rlimit; - cpp_error_with_line (pfile, CPP_DL_PEDWARN, pfile->line, + cpp_error_with_line (pfile, CPP_DL_PEDWARN, pfile->line_table->highest_line, CPP_BUF_COLUMN (buffer, buffer->cur), "no newline at end of file"); } @@ -828,7 +828,7 @@ _cpp_lex_direct (cpp_reader *pfile) if (!pfile->state.in_directive) { /* Tell the compiler the line number of the EOF token. */ - result->src_loc = pfile->line; + result->src_loc = pfile->line_table->highest_line; result->flags = BOL; } return result; @@ -845,19 +845,19 @@ _cpp_lex_direct (cpp_reader *pfile) } buffer = pfile->buffer; update_tokens_line: - result->src_loc = pfile->line; + result->src_loc = pfile->line_table->highest_line; skipped_white: if (buffer->cur >= buffer->notes[buffer->cur_note].pos && !pfile->overlaid_buffer) { _cpp_process_line_notes (pfile, false); - result->src_loc = pfile->line; + result->src_loc = pfile->line_table->highest_line; } c = *buffer->cur++; - result->src_loc = linemap_position_for_column (pfile->line_table, - CPP_BUF_COLUMN (buffer, buffer->cur)); + LINEMAP_POSITION_FOR_COLUMN (result->src_loc, pfile->line_table, + CPP_BUF_COLUMN (buffer, buffer->cur)); switch (c) { |