diff options
author | Per Bothner <per@bothner.com> | 2005-04-05 11:24:32 -0700 |
---|---|---|
committer | Per Bothner <bothner@gcc.gnu.org> | 2005-04-05 11:24:32 -0700 |
commit | bb0a4525ce132373fce79d306d2754be2fa50892 (patch) | |
tree | b460bf328e8c879dc48f2b59ddc97103ceb3e8c3 /gcc | |
parent | 3d3c0aeaf2c0512bc7d1d2ddc36821b03996a6bb (diff) | |
download | gcc-bb0a4525ce132373fce79d306d2754be2fa50892.zip gcc-bb0a4525ce132373fce79d306d2754be2fa50892.tar.gz gcc-bb0a4525ce132373fce79d306d2754be2fa50892.tar.bz2 |
tree-ssa.c (execute_early_warn_uninitialized): Pass context node to talk_tree as 'data' parameter, rather than EXPR_LOCUS.
* tree-ssa.c (execute_early_warn_uninitialized): Pass context node
to talk_tree as 'data' parameter, rather than EXPR_LOCUS.
(warn_uninit): Get EXPR_LOCUS from context now instead.
This fixes a USE_MAPPED_LOCATION testsuite failure.
* tree-ssa.c (warn_uninitialized_var): Remove useless local.
From-SVN: r97644
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 9 | ||||
-rw-r--r-- | gcc/tree-ssa.c | 19 |
2 files changed, 21 insertions, 7 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 47ff292..79ae89c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,14 @@ 2005-04-05 Per Bothner <per@bothner.com> + * tree-ssa.c (execute_early_warn_uninitialized): Pass context node + to talk_tree as 'data' parameter, rather than EXPR_LOCUS. + (warn_uninit): Get EXPR_LOCUS from context now instead. + This fixes a USE_MAPPED_LOCATION testsuite failure. + + * tree-ssa.c (warn_uninitialized_var): Remove useless local. + +2005-04-05 Per Bothner <per@bothner.com> + * c-decl.c (finish_function): If USE_MAPPED_LOCATION set the location of the artification 'return 0' in main() to BUILTINS_LOCATION. * tree-cfg.c (remove_bb): Check that location isn't BUILTINS_LOCATION diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c index 899594d..a9564b8 100644 --- a/gcc/tree-ssa.c +++ b/gcc/tree-ssa.c @@ -1337,10 +1337,12 @@ struct tree_opt_pass pass_redundant_phi = warning text is in MSGID and LOCUS may contain a location or be null. */ static void -warn_uninit (tree t, const char *msgid, location_t *locus) +warn_uninit (tree t, const char *msgid, void *data) { tree var = SSA_NAME_VAR (t); tree def = SSA_NAME_DEF_STMT (t); + tree context = (tree) data; + location_t * locus; /* Default uses (indicated by an empty definition statement), are uninitialized. */ @@ -1360,8 +1362,9 @@ warn_uninit (tree t, const char *msgid, location_t *locus) if (TREE_NO_WARNING (var)) return; - if (!locus) - locus = &DECL_SOURCE_LOCATION (var); + locus = (context != NULL && EXPR_HAS_LOCATION (context) + ? EXPR_LOCUS (context) + : &DECL_SOURCE_LOCATION (var)); warning (msgid, locus, var); TREE_NO_WARNING (var) = 1; } @@ -1372,13 +1375,12 @@ warn_uninit (tree t, const char *msgid, location_t *locus) static tree warn_uninitialized_var (tree *tp, int *walk_subtrees, void *data) { - location_t *locus = data; tree t = *tp; /* We only do data flow with SSA_NAMEs, so that's all we can warn about. */ if (TREE_CODE (t) == SSA_NAME) { - warn_uninit (t, "%H%qD is used uninitialized in this function", locus); + warn_uninit (t, "%H%qD is used uninitialized in this function", data); *walk_subtrees = 0; } else if (IS_TYPE_OR_DECL_P (t)) @@ -1416,8 +1418,11 @@ execute_early_warn_uninitialized (void) FOR_EACH_BB (bb) for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi)) - walk_tree (bsi_stmt_ptr (bsi), warn_uninitialized_var, - EXPR_LOCUS (bsi_stmt (bsi)), NULL); + { + tree context = bsi_stmt (bsi); + walk_tree (bsi_stmt_ptr (bsi), warn_uninitialized_var, + context, NULL); + } } static void |