aboutsummaryrefslogtreecommitdiff
path: root/gcc/cppmacro.c
diff options
context:
space:
mode:
authorNeil Booth <neilb@earthling.net>2000-12-11 07:45:16 +0000
committerNeil Booth <neil@gcc.gnu.org>2000-12-11 07:45:16 +0000
commit0bda476066124a32156a37252d1d0c127c5a15be (patch)
tree1cf059e8adaf7964d2336feb8095b222fd1c04cb /gcc/cppmacro.c
parentc5afc1922c0ac026bfd781289bfe5d067f19204a (diff)
downloadgcc-0bda476066124a32156a37252d1d0c127c5a15be.zip
gcc-0bda476066124a32156a37252d1d0c127c5a15be.tar.gz
gcc-0bda476066124a32156a37252d1d0c127c5a15be.tar.bz2
cpperror.c (print_location): New function.
* cpperror.c (print_location): New function. (print_containing_files): Simplify. (_cpp_begin_message): Simplify and use print_location. * cppfiles.c (stack_include_file): Update. (_cpp_pop_file_buffer): Update. * cpphash.h (struct cpp_buffer): New members include_stack_listed and type. * cpplib.c (_cpp_handle_directive): Buffer->inc is not null. (run_directive): Take buffer type. cpp_push_buffer cannot fail. (_cpp_do__Pragma, cpp_define, _cpp_define_builtin, cpp_undef, handle_assertion): Update. (cpp_push_buffer): Take a buffer type and file name. (cpp_pop_buffer): Update. Clear include_stack_listed. * cpplib.h (input_stack_listing_current): Remove. (enum cpp_buffer_type): New. (cpp_push_buffer): New prototype. * cppmacro.c (builtin_macro): Simplify; buffer cannot be null. * fix-header.c (read_scan_file): Update. From-SVN: r38186
Diffstat (limited to 'gcc/cppmacro.c')
-rw-r--r--gcc/cppmacro.c20
1 files changed, 7 insertions, 13 deletions
diff --git a/gcc/cppmacro.c b/gcc/cppmacro.c
index e312d7d..2290093 100644
--- a/gcc/cppmacro.c
+++ b/gcc/cppmacro.c
@@ -148,28 +148,22 @@ builtin_macro (pfile, token)
{
unsigned char flags = token->flags & PREV_WHITE;
cpp_hashnode *node = token->val.node;
- cpp_buffer *ip;
switch (node->value.builtin)
{
case BT_FILE:
case BT_BASE_FILE:
{
- const char *file;
+ const char *name;
+ cpp_buffer *buffer = pfile->buffer;
- ip = CPP_BUFFER (pfile);
- if (ip == 0)
- file = "";
- else
- {
- if (node->value.builtin == BT_BASE_FILE)
- while (CPP_PREV_BUFFER (ip) != NULL)
- ip = CPP_PREV_BUFFER (ip);
+ if (node->value.builtin == BT_BASE_FILE)
+ while (buffer->prev)
+ buffer = buffer->prev;
- file = ip->nominal_fname;
- }
+ name = buffer->nominal_fname;
make_string_token (pfile->string_pool, token,
- (const U_CHAR *) file, strlen (file));
+ (const unsigned char *) name, strlen (name));
}
break;