aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-common.c
diff options
context:
space:
mode:
authorPer Bothner <per@bothner.com>2004-06-30 11:05:07 -0700
committerPer Bothner <bothner@gcc.gnu.org>2004-06-30 11:05:07 -0700
commit3c20847b8301eb9aa407ee8273b6e738e7067ee0 (patch)
tree3a5eb1a7eff65640bfe8d3933a6c06578d9f38ce /gcc/c-common.c
parentc166747038bc41ee6702618828e5c915cc4e47ea (diff)
downloadgcc-3c20847b8301eb9aa407ee8273b6e738e7067ee0.zip
gcc-3c20847b8301eb9aa407ee8273b6e738e7067ee0.tar.gz
gcc-3c20847b8301eb9aa407ee8273b6e738e7067ee0.tar.bz2
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. From-SVN: r83919
Diffstat (limited to 'gcc/c-common.c')
-rw-r--r--gcc/c-common.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/gcc/c-common.c b/gcc/c-common.c
index 349df5b..9d07efb 100644
--- a/gcc/c-common.c
+++ b/gcc/c-common.c
@@ -801,8 +801,12 @@ fname_decl (unsigned int rid, tree id)
To avoid this problem set the lineno to 0 here; that prevents
it from appearing in the RTL. */
tree stmts;
- location_t saved_locus = input_location;
+ location_t saved_location = input_location;
+#ifdef USE_MAPPED_LOCATION
+ input_location = UNKNOWN_LOCATION;
+#else
input_line = 0;
+#endif
stmts = push_stmt_list ();
decl = (*make_fname_decl) (id, fname_vars[ix].pretty);
@@ -811,7 +815,7 @@ fname_decl (unsigned int rid, tree id)
saved_function_name_decls
= tree_cons (decl, stmts, saved_function_name_decls);
*fname_vars[ix].decl = decl;
- input_location = saved_locus;
+ input_location = saved_location;
}
if (!ix && !current_function_decl)
pedwarn ("%J'%D' is not defined outside of function scope", decl, decl);
@@ -3599,20 +3603,22 @@ void
c_do_switch_warnings (splay_tree cases, tree switch_stmt)
{
splay_tree_node default_node;
- location_t *switch_locus;
+ location_t switch_location;
tree type;
if (!warn_switch && !warn_switch_enum && !warn_switch_default)
return;
- switch_locus = EXPR_LOCUS (switch_stmt);
- if (!switch_locus)
- switch_locus = &input_location;
+ if (EXPR_HAS_LOCATION (switch_stmt))
+ switch_location = EXPR_LOCATION (switch_stmt);
+ else
+ switch_location = input_location;
+
type = SWITCH_TYPE (switch_stmt);
default_node = splay_tree_lookup (cases, (splay_tree_key) NULL);
if (warn_switch_default && !default_node)
- warning ("%Hswitch missing default case", switch_locus);
+ warning ("%Hswitch missing default case", &switch_location);
/* If the switch expression was an enumerated type, check that
exactly all enumeration literals are covered by the cases.
@@ -3647,7 +3653,7 @@ c_do_switch_warnings (splay_tree cases, tree switch_stmt)
/* Warn if there are enumerators that don't correspond to
case expressions. */
warning ("%Henumeration value `%E' not handled in switch",
- switch_locus, TREE_PURPOSE (chain));
+ &switch_location, TREE_PURPOSE (chain));
}
}