summaryrefslogtreecommitdiff
path: root/gcc/cppmacro.c
diff options
context:
space:
mode:
authorneil <neil@138bc75d-0d04-0410-961f-82ee72b054a4>2001-08-01 06:19:39 +0000
committerneil <neil@138bc75d-0d04-0410-961f-82ee72b054a4>2001-08-01 06:19:39 +0000
commit36a0aa7ca717583de4d0d2eda4ab721ed5907cdb (patch)
tree31a44a63f5280d362281e3aedf7c120f4aed024a /gcc/cppmacro.c
parentddc639964860fe71f46b6c3a679372d24af4a9ce (diff)
downloadgcc-36a0aa7ca717583de4d0d2eda4ab721ed5907cdb.tar.gz
* cpphash.h (struct cpp_reader): New members line, pseudo_newlines.
* cpplex.c (handle_newline): Update prototype. Maintain logical line number. (skip_escaped_newlines, skip_block_comment, parse_string): Update accordingly. (_cpp_lex_token): Update, and store token position within the token. * cpplib.h (struct cpp_token): Add line and column entries. * cppmacro.c (replace_args): Position stringified tokens correctly. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@44533 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cppmacro.c')
-rw-r--r--gcc/cppmacro.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/gcc/cppmacro.c b/gcc/cppmacro.c
index a4569a3e073..f8b3a2b0f90 100644
--- a/gcc/cppmacro.c
+++ b/gcc/cppmacro.c
@@ -761,7 +761,12 @@ replace_args (pfile, macro, args, list)
arg = &args[src->val.arg_no - 1];
if (src->flags & STRINGIFY_ARG)
- from = arg->stringified, count = 1;
+ {
+ from = arg->stringified, count = 1;
+ /* Ugh. Maintain position of original argument. */
+ arg->stringified->line = src->line;
+ arg->stringified->col = src->col;
+ }
else if (src->flags & PASTE_LEFT)
count = arg->count, from = arg->first;
else if (src > macro->expansion && (src[-1].flags & PASTE_LEFT))
@@ -923,6 +928,7 @@ cpp_get_token (pfile, token)
/* PASTE_LEFT tokens can only appear in macro expansions. */
if (token->flags & PASTE_LEFT)
{
+ /* Maintains position of original token. */
paste_all_tokens (pfile, token);
pfile->buffer->saved_flags = AVOID_LPASTE;
}
@@ -957,6 +963,7 @@ cpp_get_token (pfile, token)
if (node->flags & NODE_BUILTIN)
{
+ /* Maintains position of original token. */
builtin_macro (pfile, token);
pfile->buffer->saved_flags = AVOID_LPASTE;
break;