diff options
author | jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-01-15 22:27:07 +0000 |
---|---|---|
committer | jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-01-15 22:27:07 +0000 |
commit | 204ca66e9757c09e16bd375a5831abafc1c8f111 (patch) | |
tree | 9dec30bd55dcecc61d1bc99e776548971a77e3dd /gcc/c-semantics.c | |
parent | c4f51a023e85088c707d57342fa4a08ebfbc5f9e (diff) | |
download | gcc-204ca66e9757c09e16bd375a5831abafc1c8f111.tar.gz |
* c-common.def (FILE_STMT): New code.
* c-common.c (statement_code_p): It's a statement.
* c-common.h (stmt_tree_s): Add x_last_filename.
(FILE_STMT_FILENAME_NODE, FILE_STMT_FILENAME): New macros.
(last_expr_filename): New macro.
* c-semantics.c (begin_stmt_tree): Initialize it.
(add_stmt): If the filename changed, also insert a
FILE_STMT.
(expand_stmt): Handle seeing one.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@48881 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-semantics.c')
-rw-r--r-- | gcc/c-semantics.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/gcc/c-semantics.c b/gcc/c-semantics.c index 4bab4d3aaa6..682943f17c2 100644 --- a/gcc/c-semantics.c +++ b/gcc/c-semantics.c @@ -60,6 +60,7 @@ begin_stmt_tree (t) *t = build_nt (EXPR_STMT, void_zero_node); last_tree = *t; last_expr_type = NULL_TREE; + last_expr_filename = input_filename; } /* T is a statement. Add it to the statement-tree. */ @@ -68,6 +69,19 @@ tree add_stmt (t) tree t; { + if (input_filename != last_expr_filename) + { + /* If the filename has changed, also add in a FILE_STMT. Do a string + compare first, though, as it might be an equivalent string. */ + int add = (strcmp (input_filename, last_expr_filename) != 0); + last_expr_filename = input_filename; + if (add) + { + tree pos = build_nt (FILE_STMT, get_identifier (input_filename)); + add_stmt (pos); + } + } + /* Add T to the statement-tree. */ TREE_CHAIN (last_tree) = t; last_tree = t; @@ -760,6 +774,10 @@ expand_stmt (t) switch (TREE_CODE (t)) { + case FILE_STMT: + input_filename = FILE_STMT_FILENAME (t); + break; + case RETURN_STMT: genrtl_return_stmt (t); break; @@ -845,4 +863,3 @@ expand_stmt (t) t = TREE_CHAIN (t); } } - |