Commit 574a0ef5 by Mark Mitchell Committed by Mark Mitchell

lex.c (check_newline): Use push_srcloc and pop_srcloc, rather than duplicating functionality here.

	* lex.c (check_newline): Use push_srcloc and pop_srcloc, rather
	than duplicating functionality here.
	* optimize.c: Include input.h.
	(expand_call_inline): Use push_srcloc and pop_srcloc.
	* parse.y (maybe_cv_qualifier): Remove calls to emit_line_note.
	* parse.c: Regenerated.
	* Makefile.in (lex.o): Depend on input.h.
	(optimize.o): Likewise.

From-SVN: r32142
parent 68723fae
2000-02-24 Mark Mitchell <mark@codesourcery.com>
* lex.c (check_newline): Use push_srcloc and pop_srcloc, rather
than duplicating functionality here.
* optimize.c: Include input.h.
(expand_call_inline): Use push_srcloc and pop_srcloc.
* parse.y (maybe_cv_qualifier): Remove calls to emit_line_note.
* parse.c: Regenerated.
* Makefile.in (lex.o): Depend on input.h.
(optimize.o): Likewise.
2000-02-24 Nathan Sidwell <nathan@codesourcery.com> 2000-02-24 Nathan Sidwell <nathan@codesourcery.com>
* decl.c (grokdeclarator): Diagnose qualifiers on non-member * decl.c (grokdeclarator): Diagnose qualifiers on non-member
......
# Makefile for GNU C++ compiler. # Makefile for GNU C++ compiler.
# Copyright (C) 1987, 88, 90-5, 1998, 1999 Free Software Foundation, Inc. # Copyright (C) 1987, 88, 90-5, 1998, 1999, 2000 Free Software Foundation, Inc.
#This file is part of GNU CC. #This file is part of GNU CC.
...@@ -246,7 +246,8 @@ spew.o : spew.c $(CXX_TREE_H) $(PARSE_H) $(srcdir)/../flags.h \ ...@@ -246,7 +246,8 @@ spew.o : spew.c $(CXX_TREE_H) $(PARSE_H) $(srcdir)/../flags.h \
lex.o : lex.c $(CXX_TREE_H) \ lex.o : lex.c $(CXX_TREE_H) \
$(PARSE_H) input.c $(srcdir)/../flags.h hash.h lex.h \ $(PARSE_H) input.c $(srcdir)/../flags.h hash.h lex.h \
$(srcdir)/../c-pragma.h $(srcdir)/../toplev.h \ $(srcdir)/../c-pragma.h $(srcdir)/../toplev.h \
$(srcdir)/../output.h $(srcdir)/../mbchar.h $(srcdir)/../ggc.h $(srcdir)/../output.h $(srcdir)/../mbchar.h $(srcdir)/../ggc.h \
$(srcdir)/../input.h
decl.o : decl.c $(CXX_TREE_H) $(srcdir)/../flags.h \ decl.o : decl.c $(CXX_TREE_H) $(srcdir)/../flags.h \
lex.h decl.h $(srcdir)/../stack.h $(srcdir)/../output.h \ lex.h decl.h $(srcdir)/../stack.h $(srcdir)/../output.h \
$(srcdir)/../except.h $(srcdir)/../toplev.h \ $(srcdir)/../except.h $(srcdir)/../toplev.h \
...@@ -301,7 +302,8 @@ semantics.o: semantics.c $(CXX_TREE_H) lex.h \ ...@@ -301,7 +302,8 @@ semantics.o: semantics.c $(CXX_TREE_H) lex.h \
$(srcdir)/../output.h $(RTL_H) $(srcdir)/../output.h $(RTL_H)
dump.o: dump.c $(CXX_TREE_H) dump.o: dump.c $(CXX_TREE_H)
optimize.o: optimize.c $(CXX_TREE_H) \ optimize.o: optimize.c $(CXX_TREE_H) \
$(srcdir)/../rtl.h $(srcdir)/../integrate.h ../insn-config.h $(srcdir)/../rtl.h $(srcdir)/../integrate.h ../insn-config.h \
$(srcdir)/../input.h
# #
# These exist for maintenance purposes. # These exist for maintenance purposes.
......
...@@ -2322,8 +2322,9 @@ check_newline () ...@@ -2322,8 +2322,9 @@ check_newline ()
register int token; register int token;
int saw_line; int saw_line;
enum { act_none, act_push, act_pop } action; enum { act_none, act_push, act_pop } action;
int old_lineno, action_number, l; int action_number, l;
int entering_c_header; int entering_c_header;
char *new_file;
restart: restart:
/* Read first nonwhite char on the line. Do this before incrementing the /* Read first nonwhite char on the line. Do this before incrementing the
...@@ -2531,9 +2532,9 @@ linenum: ...@@ -2531,9 +2532,9 @@ linenum:
body_time = this_time; body_time = this_time;
} }
input_filename = TREE_STRING_POINTER (yylval.ttype); new_file = TREE_STRING_POINTER (yylval.ttype);
GNU_xref_file (input_filename); GNU_xref_file (new_file);
if (main_input_filename == 0) if (main_input_filename == 0)
{ {
...@@ -2543,29 +2544,24 @@ linenum: ...@@ -2543,29 +2544,24 @@ linenum:
{ {
while (ifiles->next) while (ifiles->next)
ifiles = ifiles->next; ifiles = ifiles->next;
ifiles->filename = file_name_nondirectory (input_filename); ifiles->filename = file_name_nondirectory (new_file);
} }
main_input_filename = input_filename; main_input_filename = new_file;
} }
extract_interface_info ();
old_lineno = lineno;
action = act_none; action = act_none;
action_number = 0; action_number = 0;
lineno = l;
/* Each change of file name /* Each change of file name
reinitializes whether we are now in a system header. */ reinitializes whether we are now in a system header. */
in_system_header = 0; in_system_header = 0;
entering_c_header = 0; entering_c_header = 0;
if (!read_line_number (&action_number)) if (!read_line_number (&action_number) && input_file_stack)
{ {
/* Update the name in the top element of input_file_stack. */ input_file_stack->name = input_filename = new_file;
if (input_file_stack) input_file_stack->line = lineno = l;
input_file_stack->name = input_filename;
} }
/* `1' after file name means entering new file. /* `1' after file name means entering new file.
...@@ -2599,14 +2595,8 @@ linenum: ...@@ -2599,14 +2595,8 @@ linenum:
if (action == act_push) if (action == act_push)
{ {
/* Pushing to a new file. */ /* Pushing to a new file. */
struct file_stack *p push_srcloc (new_file, l);
= (struct file_stack *) xmalloc (sizeof (struct file_stack)); input_file_stack->indent_level = indent_level;
input_file_stack->line = old_lineno;
p->next = input_file_stack;
p->name = input_filename;
p->indent_level = indent_level;
input_file_stack = p;
input_file_stack_tick++;
debug_start_source_file (input_filename); debug_start_source_file (input_filename);
if (c_header_level) if (c_header_level)
++c_header_level; ++c_header_level;
...@@ -2621,8 +2611,6 @@ linenum: ...@@ -2621,8 +2611,6 @@ linenum:
/* Popping out of a file. */ /* Popping out of a file. */
if (input_file_stack->next) if (input_file_stack->next)
{ {
struct file_stack *p = input_file_stack;
if (c_header_level && --c_header_level == 0) if (c_header_level && --c_header_level == 0)
{ {
if (entering_c_header) if (entering_c_header)
...@@ -2630,27 +2618,25 @@ linenum: ...@@ -2630,27 +2618,25 @@ linenum:
--pending_lang_change; --pending_lang_change;
} }
if (indent_level != p->indent_level) if (indent_level != input_file_stack->indent_level)
{ {
warning_with_file_and_line warning_with_file_and_line
(p->name, old_lineno, (input_filename, lineno,
"This file contains more `%c's than `%c's.", "This file contains more `%c's than `%c's.",
indent_level > p->indent_level ? '{' : '}', indent_level > input_file_stack->indent_level ? '{' : '}',
indent_level > p->indent_level ? '}' : '{'); indent_level > input_file_stack->indent_level ? '}' : '{');
} }
input_file_stack = p->next;
free (p); pop_srcloc ();
input_file_stack_tick++; input_file_stack->name = new_file;
lineno = l;
debug_end_source_file (input_file_stack->line); debug_end_source_file (input_file_stack->line);
} }
else else
error ("#-lines for entering and leaving files don't match"); error ("#-lines for entering and leaving files don't match");
} }
/* Now that we've pushed or popped the input stack, extract_interface_info ();
update the name in the top element. */
if (input_file_stack)
input_file_stack->name = input_filename;
/* skip the rest of this line. */ /* skip the rest of this line. */
skipline: skipline:
......
...@@ -25,6 +25,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA ...@@ -25,6 +25,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#include "cp-tree.h" #include "cp-tree.h"
#include "rtl.h" #include "rtl.h"
#include "insn-config.h" #include "insn-config.h"
#include "input.h"
#include "integrate.h" #include "integrate.h"
#include "varray.h" #include "varray.h"
...@@ -569,6 +570,13 @@ expand_call_inline (tp, walk_subtrees, data) ...@@ -569,6 +570,13 @@ expand_call_inline (tp, walk_subtrees, data)
if (!inlinable_function_p (fn, id)) if (!inlinable_function_p (fn, id))
return NULL_TREE; return NULL_TREE;
/* Set the current filename and line number to the function we are
inlining so that when we create new _STMT nodes here they get
line numbers corresponding to the function we are calling. We
wrap the whole inlined body in an EXPR_WITH_FILE_AND_LINE as well
because individual statements don't record the filename. */
push_srcloc (fn->decl.filename, fn->decl.linenum);
/* Build a statement-expression containing code to initialize the /* Build a statement-expression containing code to initialize the
arguments, the actual inline expansion of the body, and a label arguments, the actual inline expansion of the body, and a label
for the return statements within the function to jump to. The for the return statements within the function to jump to. The
...@@ -660,6 +668,7 @@ expand_call_inline (tp, walk_subtrees, data) ...@@ -660,6 +668,7 @@ expand_call_inline (tp, walk_subtrees, data)
/*col=*/0); /*col=*/0);
EXPR_WFL_EMIT_LINE_NOTE (*tp) = 1; EXPR_WFL_EMIT_LINE_NOTE (*tp) = 1;
TREE_CHAIN (*tp) = chain; TREE_CHAIN (*tp) = chain;
pop_srcloc ();
/* If the value of the new expression is ignored, that's OK. We /* If the value of the new expression is ignored, that's OK. We
don't warn about this for CALL_EXPRs, so we shouldn't warn about don't warn about this for CALL_EXPRs, so we shouldn't warn about
......
...@@ -3429,10 +3429,8 @@ for.init.statement: ...@@ -3429,10 +3429,8 @@ for.init.statement:
maybe_cv_qualifier: maybe_cv_qualifier:
/* empty */ /* empty */
{ emit_line_note (input_filename, lineno); { $$ = NULL_TREE; }
$$ = NULL_TREE; }
| CV_QUALIFIER | CV_QUALIFIER
{ emit_line_note (input_filename, lineno); }
; ;
xexpr: xexpr:
......
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