Commit 851ef036 by Neil Booth Committed by Neil Booth

c-lex.c (lex_lineno): Remove.

        * c-lex.c (lex_lineno): Remove.
        (init_c_lex, c_lex): Remove lex_lineno.
        (cb_change_file): Update lineno correctly, both before calling
        push_srcloc and before leaving the function.
        (cb_def_pragma): Set lineno before outputting diagnostics.

From-SVN: r38342
parent 33ba48b6
2000-12-18 Neil Booth <neil@daikokuya.demon.co.uk>
* c-lex.c (lex_lineno): Remove.
(init_c_lex, c_lex): Remove lex_lineno.
(cb_change_file): Update lineno correctly, both before calling
push_srcloc and before leaving the function.
(cb_def_pragma): Set lineno before outputting diagnostics.
Sun Dec 17 18:45:41 2000 Richard Kenner <kenner@vlsi1.ultra.nyu.edu> Sun Dec 17 18:45:41 2000 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
* print-tree.c (print_node): Print DECL_USER_ALIGN and TYPE_USER_ALIGN. * print-tree.c (print_node): Print DECL_USER_ALIGN and TYPE_USER_ALIGN.
......
...@@ -56,9 +56,6 @@ Boston, MA 02111-1307, USA. */ ...@@ -56,9 +56,6 @@ Boston, MA 02111-1307, USA. */
/* The original file name, before changing "-" to "stdin". */ /* The original file name, before changing "-" to "stdin". */
static const char *orig_filename; static const char *orig_filename;
/* Private idea of the line number. See discussion in c_lex(). */
static int lex_lineno;
/* We may keep statistics about how long which files took to compile. */ /* We may keep statistics about how long which files took to compile. */
static int header_time, body_time; static int header_time, body_time;
static splay_tree file_info_tree; static splay_tree file_info_tree;
...@@ -129,9 +126,8 @@ init_c_lex (filename) ...@@ -129,9 +126,8 @@ init_c_lex (filename)
if (filename == 0 || !strcmp (filename, "-")) if (filename == 0 || !strcmp (filename, "-"))
filename = "stdin"; filename = "stdin";
/* Start it at 0, because check_newline is called at the very beginning /* Start it at 0. */
and will increment it to 1. */ lineno = 0;
lineno = lex_lineno = 0;
return filename; return filename;
} }
...@@ -240,7 +236,7 @@ cb_change_file (pfile, fc) ...@@ -240,7 +236,7 @@ cb_change_file (pfile, fc)
/* Don't stack the main buffer on the input stack. */ /* Don't stack the main buffer on the input stack. */
if (fc->from.filename) if (fc->from.filename)
{ {
lineno = lex_lineno; lineno = fc->from.lineno;
push_srcloc (fc->to.filename, 1); push_srcloc (fc->to.filename, 1);
input_file_stack->indent_level = indent_level; input_file_stack->indent_level = indent_level;
debug_start_source_file (fc->to.filename); debug_start_source_file (fc->to.filename);
...@@ -290,7 +286,7 @@ cb_change_file (pfile, fc) ...@@ -290,7 +286,7 @@ cb_change_file (pfile, fc)
update_header_times (fc->to.filename); update_header_times (fc->to.filename);
in_system_header = fc->sysp; in_system_header = fc->sysp;
input_filename = fc->to.filename; input_filename = fc->to.filename;
lex_lineno = fc->to.lineno; lineno = fc->to.lineno; /* Do we need this? */
/* Hook for C++. */ /* Hook for C++. */
extract_interface_info (); extract_interface_info ();
...@@ -314,6 +310,7 @@ cb_def_pragma (pfile) ...@@ -314,6 +310,7 @@ cb_def_pragma (pfile)
if (s.type == CPP_NAME) if (s.type == CPP_NAME)
name = cpp_token_as_text (pfile, &s); name = cpp_token_as_text (pfile, &s);
lineno = cpp_get_line (parse_in)->line;
if (name) if (name)
warning ("ignoring #pragma %s %s", space, name); warning ("ignoring #pragma %s %s", space, name);
else else
...@@ -950,10 +947,9 @@ c_lex (value) ...@@ -950,10 +947,9 @@ c_lex (value)
/* The C++ front end does horrible things with the current line /* The C++ front end does horrible things with the current line
number. To ensure an accurate line number, we must reset it number. To ensure an accurate line number, we must reset it
every time we return a token. */ every time we return a token. */
lex_lineno = cpp_get_line (parse_in)->line; lineno = cpp_get_line (parse_in)->line;
*value = NULL_TREE; *value = NULL_TREE;
lineno = lex_lineno;
type = tok.type; type = tok.type;
switch (type) switch (type)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment