diff options
author | bothner <bothner@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-06-30 18:05:07 +0000 |
---|---|---|
committer | bothner <bothner@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-06-30 18:05:07 +0000 |
commit | 9a6486a6df3ead668aa9b95d72491fba067e7c03 (patch) | |
tree | 3a5eb1a7eff65640bfe8d3933a6c06578d9f38ce /gcc/c-lex.c | |
parent | fdfe4b3faa360051a0d3ee834c141c8ee5f64e06 (diff) | |
download | gcc-9a6486a6df3ead668aa9b95d72491fba067e7c03.tar.gz |
Conditionally compile support for --enable-mapped_location.
* basic-block.h (struct edge_def): Use new source_locus typedef.
* c-common.c (fname_decl): Update save/clear/store of input_location.
(c_do_switch_warnings): Update for USE_MAPPED_LOCATION case.
* c-decl.c: Likewise.
* c-dump.c (dump_stmt): Likewise.
* c-gimplify.c (c-gimplify.c): Generalize using SET_EXPR_LOCATION.
* c-lex.c (cb_line_change): If USE_MAPPED_LOCATION use token's src_loc
to set input_location direction, rather than using linemap_lookup.
(fe_file_change, cb_def_pragma): Again use source_location directly.
* c-opts.c (saved_lineno): Remove static variable.
(c_common_post_options, c_common_init): Don't bothner to save,
clear and restore input_Location - now handled by lang_dependent_init.
* function.c (init_function_start): Use new DECL_IS_BUILTIN macro.
* xcoffout.c (xcoff_assign_fundamental_type_number): Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@83919 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-lex.c')
-rw-r--r-- | gcc/c-lex.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/gcc/c-lex.c b/gcc/c-lex.c index 81723550b13..79081232eb5 100644 --- a/gcc/c-lex.c +++ b/gcc/c-lex.c @@ -197,11 +197,15 @@ cb_line_change (cpp_reader *pfile ATTRIBUTE_UNUSED, const cpp_token *token, int parsing_args) { if (token->type != CPP_EOF && !parsing_args) +#ifdef USE_MAPPED_LOCATION + input_location = token->src_loc; +#else { source_location loc = token->src_loc; const struct line_map *map = linemap_lookup (&line_table, loc); input_line = SOURCE_LINE (map, loc); } +#endif } void @@ -216,10 +220,17 @@ fe_file_change (const struct line_map *new_map) we already did in compile_file. */ if (! MAIN_FILE_P (new_map)) { +#ifdef USE_MAPPED_LOCATION + int included_at = LAST_SOURCE_LINE_LOCATION (new_map - 1); + + input_location = included_at; + push_srcloc (new_map->start_location); +#else int included_at = LAST_SOURCE_LINE (new_map - 1); input_line = included_at; push_srcloc (new_map->to_file, 1); +#endif (*debug_hooks->start_source_file) (included_at, new_map->to_file); #ifndef NO_IMPLICIT_EXTERN_C if (c_header_level) @@ -249,8 +260,12 @@ fe_file_change (const struct line_map *new_map) update_header_times (new_map->to_file); in_system_header = new_map->sysp != 0; +#ifdef USE_MAPPED_LOCATION + input_location = new_map->start_location; +#else input_filename = new_map->to_file; input_line = new_map->to_line; +#endif /* Hook for C++. */ extract_interface_info (); @@ -264,7 +279,9 @@ cb_def_pragma (cpp_reader *pfile, source_location loc) -Wunknown-pragmas has been given. */ if (warn_unknown_pragmas > in_system_header) { +#ifndef USE_MAPPED_LOCATION const struct line_map *map = linemap_lookup (&line_table, loc); +#endif const unsigned char *space, *name; const cpp_token *s; @@ -278,7 +295,11 @@ cb_def_pragma (cpp_reader *pfile, source_location loc) name = cpp_token_as_text (pfile, s); } +#ifdef USE_MAPPED_LOCATION + input_location = loc; +#else input_line = SOURCE_LINE (map, loc); +#endif warning ("ignoring #pragma %s %s", space, name); } } |