c-lex.c: Replace %H by an explicit location.

2009-07-07  Manuel López-Ibáñez  <manu@gcc.gnu.org>

	* c-lex.c: Replace %H by an explicit location. Update all calls.
	* c-common.c: Likewise.
	* c-decl.c: Likewise.
	* c-typeck.c: Likewise.
	* fold-const.c: Likewise.
	* gimplify.c: Likewise.
	* stmt.c: Likewise.
	* tree-cfg.c: Likewise.
	* tree-ssa-loop-niter.c: Likewise.
	* tree-vrp.c: Likewise.
	* value-prof.c: Likewise.
java/
	* jcf-parse.c: Replace %H by an explicit location. Update all calls.
objc/
	* objc-act.c: Replace %H by an explicit location. Update all calls.
testsuite/
	* gcc.dg/plugin/selfassign.c: Replace %H by an explicit
	location. Update all calls.
	* g++.dg/plugin/selfassign.c: Likewise.

From-SVN: r149310
This commit is contained in:
Manuel López-Ibáñez 2009-07-07 02:10:19 +00:00
parent 56131eb5a0
commit fab922b1f5
19 changed files with 81 additions and 66 deletions

View File

@ -1,3 +1,17 @@
2009-07-07 Manuel López-Ibáñez <manu@gcc.gnu.org>
* c-lex.c: Replace %H by an explicit location. Update all calls.
* c-common.c: Likewise.
* c-decl.c: Likewise.
* c-typeck.c: Likewise.
* fold-const.c: Likewise.
* gimplify.c: Likewise.
* stmt.c: Likewise.
* tree-cfg.c: Likewise.
* tree-ssa-loop-niter.c: Likewise.
* tree-vrp.c: Likewise.
* value-prof.c: Likewise.
2009-07-06 Diego Novillo <dnovillo@google.com> 2009-07-06 Diego Novillo <dnovillo@google.com>
* tree-dfa.c (dump_variable): Write DECL_INITIAL for VAR * tree-dfa.c (dump_variable): Write DECL_INITIAL for VAR

View File

@ -5480,8 +5480,8 @@ c_do_switch_warnings (splay_tree cases, location_t switch_location,
default_node = splay_tree_lookup (cases, (splay_tree_key) NULL); default_node = splay_tree_lookup (cases, (splay_tree_key) NULL);
if (!default_node) if (!default_node)
warning (OPT_Wswitch_default, "%Hswitch missing default case", warning_at (switch_location, OPT_Wswitch_default,
&switch_location); "switch missing default case");
/* From here on, we only care about about enumerated types. */ /* From here on, we only care about about enumerated types. */
if (!type || TREE_CODE (type) != ENUMERAL_TYPE) if (!type || TREE_CODE (type) != ENUMERAL_TYPE)
@ -8258,13 +8258,12 @@ c_warn_unused_result (gimple_seq seq)
location_t loc = gimple_location (g); location_t loc = gimple_location (g);
if (fdecl) if (fdecl)
warning (0, "%Hignoring return value of %qD, " warning_at (loc, 0, "ignoring return value of %qD, "
"declared with attribute warn_unused_result", "declared with attribute warn_unused_result",
&loc, fdecl); fdecl);
else else
warning (0, "%Hignoring return value of function " warning_at (loc, 0, "ignoring return value of function "
"declared with attribute warn_unused_result", "declared with attribute warn_unused_result");
&loc);
} }
break; break;

View File

@ -2912,17 +2912,17 @@ undeclared_variable (location_t loc, tree id)
if (current_function_decl == 0) if (current_function_decl == 0)
{ {
error ("%H%qE undeclared here (not in a function)", &loc, id); error_at (loc, "%qE undeclared here (not in a function)", id);
scope = current_scope; scope = current_scope;
} }
else else
{ {
error ("%H%qE undeclared (first use in this function)", &loc, id); error_at (loc, "%qE undeclared (first use in this function)", id);
if (!already) if (!already)
{ {
error ("%H(Each undeclared identifier is reported only once", &loc); error_at (loc, "(Each undeclared identifier is reported only once");
error ("%Hfor each function it appears in.)", &loc); error_at (loc, "for each function it appears in.)");
already = true; already = true;
} }
@ -3356,8 +3356,8 @@ void
pending_xref_error (void) pending_xref_error (void)
{ {
if (pending_invalid_xref != 0) if (pending_invalid_xref != 0)
error ("%H%qE defined as wrong kind of tag", error_at (pending_invalid_xref_location, "%qE defined as wrong kind of tag",
&pending_invalid_xref_location, pending_invalid_xref); pending_invalid_xref);
pending_invalid_xref = 0; pending_invalid_xref = 0;
} }

View File

@ -264,8 +264,8 @@ cb_def_pragma (cpp_reader *pfile, source_location loc)
name = cpp_token_as_text (pfile, s); name = cpp_token_as_text (pfile, s);
} }
warning (OPT_Wunknown_pragmas, "%Hignoring #pragma %s %s", warning_at (fe_loc, OPT_Wunknown_pragmas, "ignoring #pragma %s %s",
&fe_loc, space, name); space, name);
} }
} }
@ -379,7 +379,7 @@ c_lex_with_flags (tree *value, location_t *loc, unsigned char *cpp_flags,
default: default:
/* ... or not. */ /* ... or not. */
error ("%Hstray %<@%> in program", &atloc); error_at (atloc, "stray %<@%> in program");
*loc = newloc; *loc = newloc;
goto retry_after_at; goto retry_after_at;
} }

View File

@ -8357,9 +8357,8 @@ c_finish_if_stmt (location_t if_locus, tree cond, tree then_block,
found: found:
if (COND_EXPR_ELSE (inner_if)) if (COND_EXPR_ELSE (inner_if))
warning (OPT_Wparentheses, warning_at (if_locus, OPT_Wparentheses,
"%Hsuggest explicit braces to avoid ambiguous %<else%>", "suggest explicit braces to avoid ambiguous %<else%>");
&if_locus);
} }
stmt = build3 (COND_EXPR, void_type_node, cond, then_block, else_block); stmt = build3 (COND_EXPR, void_type_node, cond, then_block, else_block);

View File

@ -988,7 +988,7 @@ fold_undefer_overflow_warnings (bool issue, const_gimple stmt, int code)
locus = input_location; locus = input_location;
else else
locus = gimple_location (stmt); locus = gimple_location (stmt);
warning (OPT_Wstrict_overflow, "%H%s", &locus, warnmsg); warning_at (locus, OPT_Wstrict_overflow, "%s", warnmsg);
} }
/* Stop deferring overflow warnings, ignoring any deferred /* Stop deferring overflow warnings, ignoring any deferred

View File

@ -5377,7 +5377,7 @@ omp_notice_variable (struct gimplify_omp_ctx *ctx, tree decl, bool in_code)
case OMP_CLAUSE_DEFAULT_NONE: case OMP_CLAUSE_DEFAULT_NONE:
error ("%qE not specified in enclosing parallel", error ("%qE not specified in enclosing parallel",
DECL_NAME (decl)); DECL_NAME (decl));
error ("%Henclosing parallel", &ctx->location); error_at (ctx->location, "enclosing parallel");
/* FALLTHRU */ /* FALLTHRU */
case OMP_CLAUSE_DEFAULT_SHARED: case OMP_CLAUSE_DEFAULT_SHARED:
flags |= GOVD_SHARED; flags |= GOVD_SHARED;

View File

@ -1,3 +1,7 @@
2009-07-07 Manuel López-Ibáñez <manu@gcc.gnu.org>
* jcf-parse.c: Replace %H by an explicit location. Update all calls.
2009-06-29 Andrew Haley <aph@redhat.com> 2009-06-29 Andrew Haley <aph@redhat.com>
PR java/40590 PR java/40590

View File

@ -1509,7 +1509,7 @@ duplicate_class_warning (const char *filename)
location_t warn_loc; location_t warn_loc;
linemap_add (line_table, LC_RENAME, 0, filename, 0); linemap_add (line_table, LC_RENAME, 0, filename, 0);
warn_loc = linemap_line_start (line_table, 0, 1); warn_loc = linemap_line_start (line_table, 0, 1);
warning (0, "%Hduplicate class will only be compiled once", &warn_loc); warning_at (warn_loc, 0, "duplicate class will only be compiled once");
} }
static void static void

View File

@ -1,3 +1,8 @@
2009-07-07 Manuel López-Ibáñez <manu@gcc.gnu.org>
* objc-act.c: Replace %H by an explicit location. Update all
calls.
2009-06-22 Steven Bosscher <steven@gcc.gnu.org> 2009-06-22 Steven Bosscher <steven@gcc.gnu.org>
PR objc/28050 PR objc/28050

View File

@ -2582,13 +2582,13 @@ build_selector_translation_table (void)
} }
if (!found) if (!found)
{ {
location_t *loc; location_t loc;
if (flag_next_runtime && TREE_PURPOSE (chain)) if (flag_next_runtime && TREE_PURPOSE (chain))
loc = &DECL_SOURCE_LOCATION (TREE_PURPOSE (chain)); loc = DECL_SOURCE_LOCATION (TREE_PURPOSE (chain));
else else
loc = &input_location; loc = input_location;
warning (0, "%Hcreating selector for nonexistent method %qE", warning_at (loc, 0, "creating selector for nonexistent method %qE",
loc, TREE_VALUE (chain)); TREE_VALUE (chain));
} }
} }
@ -3877,8 +3877,8 @@ objc_begin_catch_clause (tree decl)
{ {
warning (0, "exception of type %<%T%> will be caught", warning (0, "exception of type %<%T%> will be caught",
TREE_TYPE (type)); TREE_TYPE (type));
warning (0, "%H by earlier handler for %<%T%>", warning_at (EXPR_LOCATION (stmt), 0, " by earlier handler for %<%T%>",
EXPR_LOCUS (stmt), TREE_TYPE (t ? t : objc_object_type)); TREE_TYPE (t ? t : objc_object_type));
break; break;
} }
} }

View File

@ -1468,7 +1468,7 @@ warn_if_unused_value (const_tree exp, location_t locus)
return 0; return 0;
warn: warn:
warning (OPT_Wunused_value, "%Hvalue computed is not used", &locus); warning_at (locus, OPT_Wunused_value, "value computed is not used");
return 1; return 1;
} }
} }

View File

@ -1,3 +1,9 @@
2009-07-07 Manuel López-Ibáñez <manu@gcc.gnu.org>
* gcc.dg/plugin/selfassign.c: Replace %H by an explicit
location. Update all calls.
* g++.dg/plugin/selfassign.c: Likewise.
2009-07-06 Jason Merrill <jason@redhat.com> 2009-07-06 Jason Merrill <jason@redhat.com>
* g++.dg/rtti/dyncast[34].C: New. * g++.dg/rtti/dyncast[34].C: New.

View File

@ -186,9 +186,9 @@ compare_and_warn (gimple stmt, tree lhs, tree rhs)
specifying LHS in the message. */ specifying LHS in the message. */
lhs = get_non_ssa_expr (lhs); lhs = get_non_ssa_expr (lhs);
if (lhs) if (lhs)
warning (0, G_("%H%qE is assigned to itself"), &location, lhs); warning_at (location, 0, G_("%qE is assigned to itself"), lhs);
else else
warning (0, G_("%Hself-assignment detected"), &location); warning_at (location, 0, G_("self-assignment detected"));
} }
} }

View File

@ -187,9 +187,9 @@ compare_and_warn (gimple stmt, tree lhs, tree rhs)
specifying LHS in the message. */ specifying LHS in the message. */
lhs = get_non_ssa_expr (lhs); lhs = get_non_ssa_expr (lhs);
if (lhs) if (lhs)
warning (0, G_("%H%qE is assigned to itself"), &location, lhs); warning_at (location, 0, G_("%qE is assigned to itself"), lhs);
else else
warning (0, G_("%Hself-assignment detected"), &location); warning_at (location, 0, G_("self-assignment detected"));
} }
} }

View File

@ -1643,7 +1643,7 @@ remove_useless_stmts_warn_notreached (gimple_seq stmts)
location_t loc = gimple_location (stmt); location_t loc = gimple_location (stmt);
if (LOCATION_LINE (loc) > 0) if (LOCATION_LINE (loc) > 0)
{ {
warning (OPT_Wunreachable_code, "%Hwill never be executed", &loc); warning_at (loc, OPT_Wunreachable_code, "will never be executed");
return true; return true;
} }
} }
@ -2310,7 +2310,7 @@ remove_bb (basic_block bb)
loop above, so the last statement we process is the first statement loop above, so the last statement we process is the first statement
in the block. */ in the block. */
if (loc > BUILTINS_LOCATION && LOCATION_LINE (loc) > 0) if (loc > BUILTINS_LOCATION && LOCATION_LINE (loc) > 0)
warning (OPT_Wunreachable_code, "%Hwill never be executed", &loc); warning_at (loc, OPT_Wunreachable_code, "will never be executed");
remove_phi_nodes_and_edges_for_unreachable_block (bb); remove_phi_nodes_and_edges_for_unreachable_block (bb);
bb->il.gimple = NULL; bb->il.gimple = NULL;
@ -7260,7 +7260,7 @@ execute_warn_function_return (void)
} }
if (location == UNKNOWN_LOCATION) if (location == UNKNOWN_LOCATION)
location = cfun->function_end_locus; location = cfun->function_end_locus;
warning (0, "%H%<noreturn%> function does return", &location); warning_at (location, 0, "%<noreturn%> function does return");
} }
/* If we see "return;" in some basic block, then we do reach the end /* If we see "return;" in some basic block, then we do reach the end

View File

@ -1879,10 +1879,8 @@ number_of_iterations_exit (struct loop *loop, edge exit,
? N_("assuming that the loop counter does not overflow") ? N_("assuming that the loop counter does not overflow")
: N_("cannot optimize loop, the loop counter may overflow"); : N_("cannot optimize loop, the loop counter may overflow");
if (LOCATION_LINE (loc) > 0) warning_at ((LOCATION_LINE (loc) > 0) ? loc : input_location,
warning (OPT_Wunsafe_loop_optimizations, "%H%s", &loc, gettext (wording)); OPT_Wunsafe_loop_optimizations, "%s", gettext (wording));
else
warning (OPT_Wunsafe_loop_optimizations, "%s", gettext (wording));
} }
return flag_unsafe_loop_optimizations; return flag_unsafe_loop_optimizations;

View File

@ -5717,7 +5717,7 @@ vrp_evaluate_conditional (enum tree_code code, tree op0, tree op1, gimple stmt)
location = input_location; location = input_location;
else else
location = gimple_location (stmt); location = gimple_location (stmt);
warning (OPT_Wstrict_overflow, "%H%s", &location, warnmsg); warning_at (location, OPT_Wstrict_overflow, "%s", warnmsg);
} }
} }
@ -5731,7 +5731,6 @@ vrp_evaluate_conditional (enum tree_code code, tree op0, tree op1, gimple stmt)
the natural range of OP0's type, then the predicate will the natural range of OP0's type, then the predicate will
always fold regardless of the value of OP0. If -Wtype-limits always fold regardless of the value of OP0. If -Wtype-limits
was specified, emit a warning. */ was specified, emit a warning. */
const char *warnmsg = NULL;
tree type = TREE_TYPE (op0); tree type = TREE_TYPE (op0);
value_range_t *vr0 = get_value_range (op0); value_range_t *vr0 = get_value_range (op0);
@ -5740,16 +5739,6 @@ vrp_evaluate_conditional (enum tree_code code, tree op0, tree op1, gimple stmt)
&& vrp_val_is_min (vr0->min) && vrp_val_is_min (vr0->min)
&& vrp_val_is_max (vr0->max) && vrp_val_is_max (vr0->max)
&& is_gimple_min_invariant (op1)) && is_gimple_min_invariant (op1))
{
if (integer_zerop (ret))
warnmsg = G_("comparison always false due to limited range of "
"data type");
else
warnmsg = G_("comparison always true due to limited range of "
"data type");
}
if (warnmsg)
{ {
location_t location; location_t location;
@ -5758,7 +5747,10 @@ vrp_evaluate_conditional (enum tree_code code, tree op0, tree op1, gimple stmt)
else else
location = gimple_location (stmt); location = gimple_location (stmt);
warning (OPT_Wtype_limits, "%H%s", &location, warnmsg); warning_at (location, OPT_Wtype_limits,
integer_zerop (ret)
? "comparison always false due to limited range of data type"
: "comparison always true due to limited range of data type");
} }
} }
@ -6596,10 +6588,9 @@ simplify_div_or_mod_using_ranges (gimple stmt)
location = input_location; location = input_location;
else else
location = gimple_location (stmt); location = gimple_location (stmt);
warning (OPT_Wstrict_overflow, warning_at (location, OPT_Wstrict_overflow,
("%Hassuming signed overflow does not occur when " "assuming signed overflow does not occur when "
"simplifying / or %% to >> or &"), "simplifying %</%> or %<%%%> to %<>>%> or %<&%>");
&location);
} }
} }
@ -6679,10 +6670,9 @@ simplify_abs_using_ranges (gimple stmt)
location = input_location; location = input_location;
else else
location = gimple_location (stmt); location = gimple_location (stmt);
warning (OPT_Wstrict_overflow, warning_at (location, OPT_Wstrict_overflow,
("%Hassuming signed overflow does not occur when " "assuming signed overflow does not occur when "
"simplifying abs (X) to X or -X"), "simplifying %<abs (X)%> to %<X%> or %<-X%>");
&location);
} }
gimple_assign_set_rhs1 (stmt, op); gimple_assign_set_rhs1 (stmt, op);

View File

@ -474,9 +474,9 @@ check_counter (gimple stmt, const char * name,
} }
else else
{ {
error ("%HCorrupted value profile: %s profiler overall count (%d) " error_at (locus, "Corrupted value profile: %s "
"does not match BB count (%d)", &locus, name, (int)*all, "profiler overall count (%d) does not match BB count (%d)",
(int)bb_count); name, (int)*all, (int)bb_count);
return true; return true;
} }
} }