summaryrefslogtreecommitdiffstats
path: root/gcc/cpplib.c
diff options
context:
space:
mode:
authorneil <neil@138bc75d-0d04-0410-961f-82ee72b054a4>2001-08-04 16:28:14 +0000
committerneil <neil@138bc75d-0d04-0410-961f-82ee72b054a4>2001-08-04 16:28:14 +0000
commitf8d396cdeac903221bb452637843d2a89c59b989 (patch)
treed9a94dd57cbcb162a1616b5fe4623e5c76a95412 /gcc/cpplib.c
parentedbd9f4cce37c1f3336d8390ffb01e6d6145ab24 (diff)
downloadppe42-gcc-f8d396cdeac903221bb452637843d2a89c59b989.tar.gz
ppe42-gcc-f8d396cdeac903221bb452637843d2a89c59b989.zip
* cpphash.h (struct cpp_reader): New member directive_line.
* cpplib.h (struct cpp_callbacks): Update prototypes of callbacks. * cpplib.c (do_define, do_undef, do_ident, do_include_common, do_pragma): Pass line to callbacks. (start_directive): Record line of directive. * cppmain.c (cb_ident, cb_define, cb_undef, cb_def_pragma, cb_include): Similarly. * c-lex.c (cb_ident, cb_define, cb_undef, cb_def_pragma): Similarly. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@44637 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cpplib.c')
-rw-r--r--gcc/cpplib.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/gcc/cpplib.c b/gcc/cpplib.c
index 76e5355d740..d46fb93154d 100644
--- a/gcc/cpplib.c
+++ b/gcc/cpplib.c
@@ -225,6 +225,7 @@ start_directive (pfile)
/* Some handlers need the position of the # for diagnostics. */
pfile->directive_pos = pfile->lexer_pos;
+ pfile->directive_line = pfile->line;
/* Don't save directive tokens for external clients. */
pfile->la_saved = pfile->la_write;
@@ -476,7 +477,7 @@ do_define (pfile)
{
if (_cpp_create_definition (pfile, node))
if (pfile->cb.define)
- (*pfile->cb.define) (pfile, node);
+ (*pfile->cb.define) (pfile, pfile->directive_line, node);
}
}
@@ -492,7 +493,7 @@ do_undef (pfile)
if (node && node->type == NT_MACRO)
{
if (pfile->cb.undef)
- (*pfile->cb.undef) (pfile, node);
+ (*pfile->cb.undef) (pfile, pfile->directive_line, node);
if (node->flags & NODE_WARN)
cpp_warning (pfile, "undefining \"%s\"", NODE_NAME (node));
@@ -625,7 +626,8 @@ do_include_common (pfile, type)
/* Get out of macro context, if we are. */
end_directive (pfile, 1);
if (pfile->cb.include)
- (*pfile->cb.include) (pfile, pfile->directive->name, &header);
+ (*pfile->cb.include) (pfile, pfile->directive_line,
+ pfile->directive->name, &header);
_cpp_execute_include (pfile, &header, type);
}
@@ -888,7 +890,7 @@ do_ident (pfile)
if (str.type != CPP_STRING)
cpp_error (pfile, "invalid #ident");
else if (pfile->cb.ident)
- (*pfile->cb.ident) (pfile, &str.val.str);
+ (*pfile->cb.ident) (pfile, pfile->directive_line, &str.val.str);
check_eol (pfile);
}
@@ -1042,7 +1044,7 @@ do_pragma (pfile)
if (handler)
(*handler) (pfile);
else if (pfile->cb.def_pragma)
- (*pfile->cb.def_pragma) (pfile);
+ (*pfile->cb.def_pragma) (pfile, pfile->directive_line);
}
static void
OpenPOWER on IntegriCloud