aboutsummaryrefslogtreecommitdiff
path: root/gcc/cppinit.c
diff options
context:
space:
mode:
authorPer Bothner <per@bothner.com>2004-01-19 21:30:18 -0800
committerPer Bothner <bothner@gcc.gnu.org>2004-01-19 21:30:18 -0800
commit50f59cd71061055cc039bbe44b5c955747719ebb (patch)
tree15fcd6b635123af68ed69ca87bf633fa01f46d8e /gcc/cppinit.c
parent9132fbb788b24bc4b03be723a42b16dd9f65e03f (diff)
downloadgcc-50f59cd71061055cc039bbe44b5c955747719ebb.zip
gcc-50f59cd71061055cc039bbe44b5c955747719ebb.tar.gz
gcc-50f59cd71061055cc039bbe44b5c955747719ebb.tar.bz2
Move cpp_reader's line_maps field to a shared global.
* cpphash.h (cpp_reader): Rename line_maps field to line_table and change the type to a pointer rather than a struct. * cppinit.c (cpp_push_main_field): Adjust accordingly. * cpplib.c (do_include_common, _cpp_do_file_change, cpp_get_callbacks): Likewise. * cppfiles.c (validate_pch): Likewise. * cppmacro.c (_cpp_warn_if_unused_macro, _cpp_builtin_macro_text): Likewise. * cpperror.c (print_location): Likewise. * cpplib.h (cpp_create_reader): New line_maps pointer parameter. * cppinit.c (cpp_create_reader): Handle new parameter. (cpp_destroy): Don't free line_maps - that's no longer our job. * input.h (line_table): New variable. * toplev.c (line_table): Declare variable. (general_init): Initialize line_table. * c-opts.c (c_common_init_options): Pass line_table to cpp_create_reader. * fix-header.c (read_scan_file): New local variable line_table. Initialize, and pass it to cpp_create_reader. * Makefile.in (LIBS, LIBDEPS): Add libcpp.a. (C_AND_OBJC_OBJS, fix-header): Remove redundant libcpp.a. From-SVN: r76198
Diffstat (limited to 'gcc/cppinit.c')
-rw-r--r--gcc/cppinit.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/gcc/cppinit.c b/gcc/cppinit.c
index 629da27..b001c71 100644
--- a/gcc/cppinit.c
+++ b/gcc/cppinit.c
@@ -124,7 +124,8 @@ init_library (void)
/* Initialize a cpp_reader structure. */
cpp_reader *
-cpp_create_reader (enum c_lang lang, hash_table *table)
+cpp_create_reader (enum c_lang lang, hash_table *table,
+ struct line_maps *line_table)
{
cpp_reader *pfile;
@@ -172,7 +173,7 @@ cpp_create_reader (enum c_lang lang, hash_table *table)
/* Initialize the line map. Start at logical line 1, so we can use
a line number of zero for special states. */
- linemap_init (&pfile->line_maps);
+ pfile->line_table = line_table;
pfile->line = 1;
/* Initialize lexer state. */
@@ -262,7 +263,6 @@ cpp_destroy (cpp_reader *pfile)
free (context);
}
- linemap_free (&pfile->line_maps);
free (pfile);
}
@@ -501,7 +501,7 @@ cpp_push_main_file (cpp_reader *pfile)
/* Set this here so the client can change the option if it wishes,
and after stacking the main file so we don't trace the main
file. */
- pfile->line_maps.trace_includes = CPP_OPTION (pfile, print_include_names);
+ pfile->line_table->trace_includes = CPP_OPTION (pfile, print_include_names);
}
/* For preprocessed files, if the first tokens are of the form # NUM.