summaryrefslogtreecommitdiff
path: root/gcc/cpplib.c
diff options
context:
space:
mode:
authorneil <neil@138bc75d-0d04-0410-961f-82ee72b054a4>2001-09-14 22:04:46 +0000
committerneil <neil@138bc75d-0d04-0410-961f-82ee72b054a4>2001-09-14 22:04:46 +0000
commit5621a3645f8d24e20cb362058f3dc24c5bccff94 (patch)
tree4c00cb933362af65600541484760cce6502de1a6 /gcc/cpplib.c
parent0812d83c21c766dd94d25afa4a6e30dd54bd97d0 (diff)
downloadgcc-5621a3645f8d24e20cb362058f3dc24c5bccff94.tar.gz
* cpperror.c (print_location): Take line and column, for
default positioning use the previously lexed token. (_cpp_begin_message): Take line and column. (cpp_ice, cpp_fatal, cpp_error, cpp_error_with_line, cpp_warning, cpp_warning_with_line, cpp_pedwarn, cpp_pedwarn_with_line): Update. * cpphash.h (_cpp_begin_message): Update prototype. * cppinit.c (push_include): Don't set output line. * cpplex.c (_cpp_lex_token): Callback for start of new output lines. * cpplib.c (do_diagnostic, _cpp_pop_buffer): Update. (do_pragma): Kludge for front ends. Don't expand macros at all. * cpplib.h (cpp_lookahead, cpp_token_with_pos, cpp_get_line): Remove. (struct cpp_token): Remove output_line. (struct cpp_callbacks): New member line_change. * cppmacro.c (builtin_macro, paste_all_tokens, replace_args, cpp_get_token): Preserve BOL flag. (cpp_get_line): Remove. (_cpp_backup_tokens): Remove useless abort(). * cppmain.c (cb_line_change): New. (scan_translation_unit): Don't worry about starting new lines here. * scan-decls.c (scan_decls): Update. * c-lex.c (c_lex, init_c_lex): Update. (cb_line_change, src_lineno): New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@45613 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cpplib.c')
-rw-r--r--gcc/cpplib.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/gcc/cpplib.c b/gcc/cpplib.c
index 5fe4b1ef8ee..06541ad9ecf 100644
--- a/gcc/cpplib.c
+++ b/gcc/cpplib.c
@@ -799,7 +799,7 @@ do_diagnostic (pfile, code, print_dir)
enum error_type code;
int print_dir;
{
- if (_cpp_begin_message (pfile, code, 0))
+ if (_cpp_begin_message (pfile, code, 0, 0))
{
if (print_dir)
fprintf (stderr, "#%s ", pfile->directive->name);
@@ -987,7 +987,14 @@ do_pragma (pfile)
}
}
- pfile->state.prevent_expansion--;
+ /* FIXME. This is an awful kludge to get the front ends to update
+ their notion of line number for diagnostic purposes. The line
+ number should be passed to the handler and they should do it
+ themselves. Stand-alone CPP must ignore us, otherwise it will
+ prefix the directive with spaces, hence the 1. Ugh. */
+ if (pfile->cb.line_change)
+ (*pfile->cb.line_change)(pfile, &tok, 1);
+
if (handler)
(*handler) (pfile);
else if (pfile->cb.def_pragma)
@@ -995,6 +1002,7 @@ do_pragma (pfile)
_cpp_backup_tokens (pfile, count);
(*pfile->cb.def_pragma) (pfile, pfile->directive_line);
}
+ pfile->state.prevent_expansion--;
}
static void
@@ -1773,11 +1781,7 @@ _cpp_pop_buffer (pfile)
cpp_error_with_line (pfile, ifs->pos.line, ifs->pos.col,
"unterminated #%s", dtable[ifs->type].name);
- /* The output line can fall out of sync if we missed the final
- newline from the previous buffer, for example because of an
- unterminated comment. Similarly, skipping needs to be cleared in
- case of a missing #endif. */
- pfile->lexer_pos.output_line = pfile->line;
+ /* In case of a missing #endif. */
pfile->state.skipping = 0;
/* Update the reader's buffer before _cpp_do_file_change. */