diff options
author | gchare <gchare@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-08-22 20:41:07 +0000 |
---|---|---|
committer | gchare <gchare@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-08-22 20:41:07 +0000 |
commit | 6ea2c7a39e48b9b78626cec92b83a0a6e9b05f9f (patch) | |
tree | edc710dc37d6c755bf80f2e8489e337aeb7186da /gcc/c-family | |
parent | c3271fdb04f8f85e05e726ce72dc99c5dd82094c (diff) | |
download | gcc-6ea2c7a39e48b9b78626cec92b83a0a6e9b05f9f.tar.gz |
Add ability to force lexed tokens' source_locations.
Use it to force BUILTINS_LOCATION when declaring builtins instead of creating a <built-in> 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
Diffstat (limited to 'gcc/c-family')
-rw-r--r-- | gcc/c-family/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/c-family/c-opts.c | 15 |
2 files changed, 15 insertions, 5 deletions
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 <gchare@google.com> + + * 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 <joseph@codesourcery.com> * 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, - _("<built-in>"), 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) |