From 6ea2c7a39e48b9b78626cec92b83a0a6e9b05f9f Mon Sep 17 00:00:00 2001 From: gchare Date: Mon, 22 Aug 2011 20:41:07 +0000 Subject: Add ability to force lexed tokens' source_locations. Use it to force BUILTINS_LOCATION when declaring builtins instead of creating a entry in the line_table which is wrong. * c-opts.c (c_finish_options): Force BUILTINS_LOCATION for tokens defined in cpp_init_builtins and c_cpp_builtins. gcc/fortran/ChangeLog * cpp.c (gfc_cpp_init): Force BUILTINS_LOCATION for tokens defined in cpp_define_builtins. libcpp/ChangeLog * init.c (cpp_create_reader): Inititalize forced_token_location_p. * internal.h (struct cpp_reader): Add field forced_token_location_p. * lex.c (_cpp_lex_direct): Use forced_token_location_p. (cpp_force_token_locations): New. (cpp_stop_forcing_token_locations): New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@177973 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/c-family/ChangeLog | 5 +++++ gcc/c-family/c-opts.c | 15 ++++++++++----- 2 files changed, 15 insertions(+), 5 deletions(-) (limited to 'gcc/c-family') diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index df9cdff40f4..fb00ca98958 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,8 @@ +011-08-22 Gabriel Charette + + * c-opts.c (c_finish_options): Force BUILTINS_LOCATION for tokens + defined in cpp_init_builtins and c_cpp_builtins. + 2011-08-19 Joseph Myers * c-common.c (c_common_reswords): Add __builtin_complex. diff --git a/gcc/c-family/c-opts.c b/gcc/c-family/c-opts.c index 3227f7b9860..49ff80dda7e 100644 --- a/gcc/c-family/c-opts.c +++ b/gcc/c-family/c-opts.c @@ -1306,12 +1306,17 @@ c_finish_options (void) { size_t i; - cb_file_change (parse_in, - linemap_add (line_table, LC_RENAME, 0, - _(""), 0)); + { + /* Make sure all of the builtins about to be declared have + BUILTINS_LOCATION has their source_location. */ + source_location builtins_loc = BUILTINS_LOCATION; + cpp_force_token_locations (parse_in, &builtins_loc); - cpp_init_builtins (parse_in, flag_hosted); - c_cpp_builtins (parse_in); + cpp_init_builtins (parse_in, flag_hosted); + c_cpp_builtins (parse_in); + + cpp_stop_forcing_token_locations (parse_in); + } /* We're about to send user input to cpplib, so make it warn for things that we previously (when we sent it internal definitions) -- cgit v1.2.1