From f85fcf2bb8dc7f1d1535a653d1e484e6fb06e2da Mon Sep 17 00:00:00 2001 From: neil Date: Sat, 11 Aug 2001 07:33:39 +0000 Subject: * c-lex.c (map): Make const. (cb_file_change): Update for callback passing a line map. Don't assume we have a previous map. Remove sanity check about popping too many files. * cpperror.c (print_location): Make map const. * cppfiles.c (stack_include_file): Update; line maps now hold sysp. (cpp_make_system_header): Similarly. (search_from): Similarly. (_cpp_execute_include): Don't remember where we came from. * cpphash.h (struct cpp_buffer): Remove return_to_line, sysp. (struct cpp_reader): Make map const. (CPP_IN_SYSTEM_HEADER, _cpp_do_file_change): Update. * cpplib.c (do_line): Update; line maps now hold sysp. (cpp_push_buffer): Similarly. (_cpp_do_file_change): Similarly; callback with map instead. (cpp_get_line_maps): Constify return value. (_cpp_pop_buffer): Update. * cpplib.h (struct cpp_file_change): Remove. (struct cpp_callbacks): Update. (cpp_get_line_maps): Constify return value. * cppmacro.c (_cpp_create_definition): Update. * cppmain.c (struct printer): Constify map. (maybe_print_line): Similarly. (print_line): Similarly. Deduce flags 1 and 2 here. (cb_file_change): Update. * line-map.c (free_line_maps): Warn regardless. (add_line_map): Return pointer to const. When passed NULL to_file with LC_LEAVE, use the obvious values for the return point so the caller doesn't have to figure them out. (lookup_line): Return pointer to const. (print_containing_files): Take pointer to const. * line-map.h (struct line_map): New members reason, sysp. (add_line_map): Return pointer to const. (lookup_line): Similarly. (print_containing_files): Take pointer to const. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@44789 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cppfiles.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'gcc/cppfiles.c') diff --git a/gcc/cppfiles.c b/gcc/cppfiles.c index 8af65c8925f..657130400f1 100644 --- a/gcc/cppfiles.c +++ b/gcc/cppfiles.c @@ -290,7 +290,7 @@ stack_include_file (pfile, inc) /* We'll try removing deps_sysp after the release of 3.0. */ deps_sysp = pfile->system_include_depth != 0; - sysp = MAX ((pfile->buffer ? pfile->buffer->sysp : 0), + sysp = MAX ((pfile->map ? pfile->map->sysp : 0), (inc->foundhere ? inc->foundhere->sysp : 0)); /* For -M, add the file to the dependencies on its first inclusion. */ @@ -329,7 +329,6 @@ stack_include_file (pfile, inc) fp = cpp_push_buffer (pfile, inc->buffer, len, BUF_FILE, inc->name, 0); fp->inc = inc; fp->inc->refcnt++; - fp->sysp = sysp; /* Initialise controlling macro state. */ pfile->mi_valid = true; @@ -337,7 +336,7 @@ stack_include_file (pfile, inc) pfile->include_depth++; /* Generate the call back. */ - _cpp_do_file_change (pfile, LC_ENTER, 1); + _cpp_do_file_change (pfile, LC_ENTER, fp->nominal_fname, 1, sysp); } /* Read the file referenced by INC into the file cache. @@ -576,9 +575,8 @@ cpp_make_system_header (pfile, syshdr, externc) /* 1 = system header, 2 = system header to be treated as C. */ if (syshdr) flags = 1 + (externc != 0); - pfile->buffer->sysp = flags; - _cpp_do_file_change (pfile, LC_RENAME, - SOURCE_LINE (pfile->map, pfile->line)); + _cpp_do_file_change (pfile, LC_RENAME, pfile->map->to_file, + SOURCE_LINE (pfile->map, pfile->line), flags); } /* Report on all files that might benefit from a multiple include guard. @@ -678,7 +676,6 @@ _cpp_execute_include (pfile, header, type) if (header->type == CPP_HEADER_NAME) pfile->system_include_depth++; - pfile->buffer->return_to_line = SOURCE_LINE (pfile->map, pfile->line); stack_include_file (pfile, inc); if (type == IT_IMPORT) @@ -808,7 +805,7 @@ search_from (pfile, type) buffer->dir.len = dlen; buffer->dir.next = CPP_OPTION (pfile, quote_include); - buffer->dir.sysp = buffer->sysp; + buffer->dir.sysp = pfile->map->sysp; } return &buffer->dir; -- cgit v1.2.3