aboutsummaryrefslogtreecommitdiff
path: root/gcc/cppmacro.c
diff options
context:
space:
mode:
authorNeil Booth <neil@daikokuya.demon.co.uk>2001-08-17 22:23:49 +0000
committerNeil Booth <neil@gcc.gnu.org>2001-08-17 22:23:49 +0000
commitbb74c963017da6f462498f75a5b09ff782e0137c (patch)
tree1119c95193138295f135f3d1be8fd1f94c827ca3 /gcc/cppmacro.c
parentc009f01f06d52c7f4e44e666688e7e88409a501c (diff)
downloadgcc-bb74c963017da6f462498f75a5b09ff782e0137c.zip
gcc-bb74c963017da6f462498f75a5b09ff782e0137c.tar.gz
gcc-bb74c963017da6f462498f75a5b09ff782e0137c.tar.bz2
cpperror.c (print_location): Don't take a file name; use the line map instead.
* cpperror.c (print_location): Don't take a file name; use the line map instead. (_cpp_begin_message): Similarly. (cpp_ice, cpp_fatal, cpp_error, cpp_error_with_line, cpp_warning, cpp_warning_with_line, cpp_pedwarn, cpp_pedwarn_with_line): Update. (cpp_pedwarn_with_file_and_line): Remove. * cppfiles.c (stack_include_file): Update; set filename to stdin here when appropriate. * cpphash.h (struct cpp_buffer): Remove nominal_fname. (_cpp_begin_message): Don't take a file name. * cppinit.c: Add comment. * cpplex.c: Fix end-of-directive indicator. * cpplib.c: Don't include intl.h. (run_directive, do_diagnostic): Update. (do_line): Update to not use nominal_fname. (cpp_push_buffer): Don't take a filename. * cpplib.h (struct ht): Remove. (cpp_push_buffer): Don't take a filename. (cpp_pedwarn_with_file_and_line): Remove. * cppmacro.c (struct cpp_macro): Remove file. (builtin_macro): Update. (_cpp_create_definition): Update. * cppmain.c: Correct comment. * fix-header.c (read_scan_file): Update. From-SVN: r44986
Diffstat (limited to 'gcc/cppmacro.c')
-rw-r--r--gcc/cppmacro.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/gcc/cppmacro.c b/gcc/cppmacro.c
index 09cad20..bc12913 100644
--- a/gcc/cppmacro.c
+++ b/gcc/cppmacro.c
@@ -33,7 +33,6 @@ struct cpp_macro
{
cpp_hashnode **params; /* Parameters, if any. */
cpp_token *expansion; /* First token of replacement list. */
- const char *file; /* Defined in file name. */
unsigned int line; /* Starting line number. */
unsigned int count; /* Number of tokens in expansion. */
unsigned short paramc; /* Number of parameters. */
@@ -152,13 +151,13 @@ builtin_macro (pfile, token)
case BT_BASE_FILE:
{
const char *name;
- cpp_buffer *buffer = pfile->buffer;
+ const struct line_map *map = pfile->map;
if (node->value.builtin == BT_BASE_FILE)
- while (buffer->prev)
- buffer = buffer->prev;
+ while (! MAIN_FILE_P (map))
+ map = INCLUDED_FROM (&pfile->line_maps, map);
- name = buffer->nominal_fname;
+ name = map->to_file;
make_string_token (&pfile->ident_pool, token,
(const unsigned char *) name, strlen (name));
}
@@ -1372,7 +1371,6 @@ _cpp_create_definition (pfile, node)
macro = (cpp_macro *) _cpp_pool_alloc (&pfile->macro_pool,
sizeof (cpp_macro));
- macro->file = pfile->buffer->nominal_fname;
macro->line = pfile->directive_pos.line;
macro->params = 0;
macro->paramc = 0;
@@ -1476,9 +1474,7 @@ _cpp_create_definition (pfile, node)
"\"%s\" redefined", NODE_NAME (node));
if (node->type == NT_MACRO && !(node->flags & NODE_BUILTIN))
- cpp_pedwarn_with_file_and_line (pfile,
- node->value.macro->file,
- node->value.macro->line, 1,
+ cpp_pedwarn_with_line (pfile, node->value.macro->line, 1,
"this is the location of the previous definition");
}
_cpp_free_definition (node);