From: Manuel López-Ibáñez Date: Tue, 7 Jul 2009 02:10:19 +0000 (+0000) Subject: c-lex.c: Replace %H by an explicit location. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=fab922b1f55fe7766a375d0ee28a1c48f3185250;p=gcc.git c-lex.c: Replace %H by an explicit location. 2009-07-07 Manuel López-Ibáñez * 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a2f30063c2c..9acef1e1c1b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,17 @@ +2009-07-07 Manuel López-Ibáñez + + * 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 * tree-dfa.c (dump_variable): Write DECL_INITIAL for VAR diff --git a/gcc/c-common.c b/gcc/c-common.c index 1ff92920b65..772d9687bf8 100644 --- a/gcc/c-common.c +++ b/gcc/c-common.c @@ -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); if (!default_node) - warning (OPT_Wswitch_default, "%Hswitch missing default case", - &switch_location); + warning_at (switch_location, OPT_Wswitch_default, + "switch missing default case"); /* From here on, we only care about about enumerated types. */ if (!type || TREE_CODE (type) != ENUMERAL_TYPE) @@ -8258,13 +8258,12 @@ c_warn_unused_result (gimple_seq seq) location_t loc = gimple_location (g); if (fdecl) - warning (0, "%Hignoring return value of %qD, " - "declared with attribute warn_unused_result", - &loc, fdecl); + warning_at (loc, 0, "ignoring return value of %qD, " + "declared with attribute warn_unused_result", + fdecl); else - warning (0, "%Hignoring return value of function " - "declared with attribute warn_unused_result", - &loc); + warning_at (loc, 0, "ignoring return value of function " + "declared with attribute warn_unused_result"); } break; diff --git a/gcc/c-decl.c b/gcc/c-decl.c index 9f852fff77a..fdceb20a831 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -2912,17 +2912,17 @@ undeclared_variable (location_t loc, tree id) 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; } 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) { - error ("%H(Each undeclared identifier is reported only once", &loc); - error ("%Hfor each function it appears in.)", &loc); + error_at (loc, "(Each undeclared identifier is reported only once"); + error_at (loc, "for each function it appears in.)"); already = true; } @@ -3356,8 +3356,8 @@ void pending_xref_error (void) { if (pending_invalid_xref != 0) - error ("%H%qE defined as wrong kind of tag", - &pending_invalid_xref_location, pending_invalid_xref); + error_at (pending_invalid_xref_location, "%qE defined as wrong kind of tag", + pending_invalid_xref); pending_invalid_xref = 0; } diff --git a/gcc/c-lex.c b/gcc/c-lex.c index 66df4c40f7b..0b6fcc00b31 100644 --- a/gcc/c-lex.c +++ b/gcc/c-lex.c @@ -264,8 +264,8 @@ cb_def_pragma (cpp_reader *pfile, source_location loc) name = cpp_token_as_text (pfile, s); } - warning (OPT_Wunknown_pragmas, "%Hignoring #pragma %s %s", - &fe_loc, space, name); + warning_at (fe_loc, OPT_Wunknown_pragmas, "ignoring #pragma %s %s", + space, name); } } @@ -379,7 +379,7 @@ c_lex_with_flags (tree *value, location_t *loc, unsigned char *cpp_flags, default: /* ... or not. */ - error ("%Hstray %<@%> in program", &atloc); + error_at (atloc, "stray %<@%> in program"); *loc = newloc; goto retry_after_at; } diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c index df1e1718405..e86e0951a5d 100644 --- a/gcc/c-typeck.c +++ b/gcc/c-typeck.c @@ -8357,9 +8357,8 @@ c_finish_if_stmt (location_t if_locus, tree cond, tree then_block, found: if (COND_EXPR_ELSE (inner_if)) - warning (OPT_Wparentheses, - "%Hsuggest explicit braces to avoid ambiguous %", - &if_locus); + warning_at (if_locus, OPT_Wparentheses, + "suggest explicit braces to avoid ambiguous %"); } stmt = build3 (COND_EXPR, void_type_node, cond, then_block, else_block); diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 39548e2792e..670fa45e497 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -988,7 +988,7 @@ fold_undefer_overflow_warnings (bool issue, const_gimple stmt, int code) locus = input_location; else 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 diff --git a/gcc/gimplify.c b/gcc/gimplify.c index 33e5a2e8669..c5fb18569ba 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -5377,7 +5377,7 @@ omp_notice_variable (struct gimplify_omp_ctx *ctx, tree decl, bool in_code) case OMP_CLAUSE_DEFAULT_NONE: error ("%qE not specified in enclosing parallel", DECL_NAME (decl)); - error ("%Henclosing parallel", &ctx->location); + error_at (ctx->location, "enclosing parallel"); /* FALLTHRU */ case OMP_CLAUSE_DEFAULT_SHARED: flags |= GOVD_SHARED; diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index 5e41e13b180..17c6ebf8d6d 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -1,3 +1,7 @@ +2009-07-07 Manuel López-Ibáñez + + * jcf-parse.c: Replace %H by an explicit location. Update all calls. + 2009-06-29 Andrew Haley PR java/40590 diff --git a/gcc/java/jcf-parse.c b/gcc/java/jcf-parse.c index 98c98c8bd90..f7b2cb20896 100644 --- a/gcc/java/jcf-parse.c +++ b/gcc/java/jcf-parse.c @@ -1509,7 +1509,7 @@ duplicate_class_warning (const char *filename) location_t warn_loc; linemap_add (line_table, LC_RENAME, 0, filename, 0); 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 diff --git a/gcc/objc/ChangeLog b/gcc/objc/ChangeLog index 656a5f6766c..605715c157c 100644 --- a/gcc/objc/ChangeLog +++ b/gcc/objc/ChangeLog @@ -1,3 +1,8 @@ +2009-07-07 Manuel López-Ibáñez + + * objc-act.c: Replace %H by an explicit location. Update all + calls. + 2009-06-22 Steven Bosscher PR objc/28050 diff --git a/gcc/objc/objc-act.c b/gcc/objc/objc-act.c index 733818f41bb..e951b2a9ca3 100644 --- a/gcc/objc/objc-act.c +++ b/gcc/objc/objc-act.c @@ -2582,13 +2582,13 @@ build_selector_translation_table (void) } if (!found) { - location_t *loc; + location_t loc; if (flag_next_runtime && TREE_PURPOSE (chain)) - loc = &DECL_SOURCE_LOCATION (TREE_PURPOSE (chain)); + loc = DECL_SOURCE_LOCATION (TREE_PURPOSE (chain)); else - loc = &input_location; - warning (0, "%Hcreating selector for nonexistent method %qE", - loc, TREE_VALUE (chain)); + loc = input_location; + warning_at (loc, 0, "creating selector for nonexistent method %qE", + TREE_VALUE (chain)); } } @@ -3877,8 +3877,8 @@ objc_begin_catch_clause (tree decl) { warning (0, "exception of type %<%T%> will be caught", TREE_TYPE (type)); - warning (0, "%H by earlier handler for %<%T%>", - EXPR_LOCUS (stmt), TREE_TYPE (t ? t : objc_object_type)); + warning_at (EXPR_LOCATION (stmt), 0, " by earlier handler for %<%T%>", + TREE_TYPE (t ? t : objc_object_type)); break; } } diff --git a/gcc/stmt.c b/gcc/stmt.c index 31b0b7d8365..d544080a3c1 100644 --- a/gcc/stmt.c +++ b/gcc/stmt.c @@ -1468,7 +1468,7 @@ warn_if_unused_value (const_tree exp, location_t locus) return 0; warn: - warning (OPT_Wunused_value, "%Hvalue computed is not used", &locus); + warning_at (locus, OPT_Wunused_value, "value computed is not used"); return 1; } } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 3a975039a47..0b889ae3e11 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2009-07-07 Manuel López-Ibáñez + + * 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 * g++.dg/rtti/dyncast[34].C: New. diff --git a/gcc/testsuite/g++.dg/plugin/selfassign.c b/gcc/testsuite/g++.dg/plugin/selfassign.c index 75b6161b31d..2be48156d6d 100644 --- a/gcc/testsuite/g++.dg/plugin/selfassign.c +++ b/gcc/testsuite/g++.dg/plugin/selfassign.c @@ -186,9 +186,9 @@ compare_and_warn (gimple stmt, tree lhs, tree rhs) specifying LHS in the message. */ lhs = get_non_ssa_expr (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 - warning (0, G_("%Hself-assignment detected"), &location); + warning_at (location, 0, G_("self-assignment detected")); } } diff --git a/gcc/testsuite/gcc.dg/plugin/selfassign.c b/gcc/testsuite/gcc.dg/plugin/selfassign.c index 52a03bfef3c..13f6be9c2c1 100644 --- a/gcc/testsuite/gcc.dg/plugin/selfassign.c +++ b/gcc/testsuite/gcc.dg/plugin/selfassign.c @@ -187,9 +187,9 @@ compare_and_warn (gimple stmt, tree lhs, tree rhs) specifying LHS in the message. */ lhs = get_non_ssa_expr (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 - warning (0, G_("%Hself-assignment detected"), &location); + warning_at (location, 0, G_("self-assignment detected")); } } diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c index 4c7c0db12b6..34c646191dd 100644 --- a/gcc/tree-cfg.c +++ b/gcc/tree-cfg.c @@ -1643,7 +1643,7 @@ remove_useless_stmts_warn_notreached (gimple_seq stmts) location_t loc = gimple_location (stmt); 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; } } @@ -2310,7 +2310,7 @@ remove_bb (basic_block bb) loop above, so the last statement we process is the first statement in the block. */ 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); bb->il.gimple = NULL; @@ -7260,7 +7260,7 @@ execute_warn_function_return (void) } if (location == UNKNOWN_LOCATION) location = cfun->function_end_locus; - warning (0, "%H% function does return", &location); + warning_at (location, 0, "% function does return"); } /* If we see "return;" in some basic block, then we do reach the end diff --git a/gcc/tree-ssa-loop-niter.c b/gcc/tree-ssa-loop-niter.c index 48016c0b7f5..14b44aa7ecb 100644 --- a/gcc/tree-ssa-loop-niter.c +++ b/gcc/tree-ssa-loop-niter.c @@ -1879,10 +1879,8 @@ number_of_iterations_exit (struct loop *loop, edge exit, ? N_("assuming that the loop counter does not overflow") : N_("cannot optimize loop, the loop counter may overflow"); - if (LOCATION_LINE (loc) > 0) - warning (OPT_Wunsafe_loop_optimizations, "%H%s", &loc, gettext (wording)); - else - warning (OPT_Wunsafe_loop_optimizations, "%s", gettext (wording)); + warning_at ((LOCATION_LINE (loc) > 0) ? loc : input_location, + OPT_Wunsafe_loop_optimizations, "%s", gettext (wording)); } return flag_unsafe_loop_optimizations; diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c index 13ed4c005b5..117b1992816 100644 --- a/gcc/tree-vrp.c +++ b/gcc/tree-vrp.c @@ -5717,7 +5717,7 @@ vrp_evaluate_conditional (enum tree_code code, tree op0, tree op1, gimple stmt) location = input_location; else 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 always fold regardless of the value of OP0. If -Wtype-limits was specified, emit a warning. */ - const char *warnmsg = NULL; tree type = TREE_TYPE (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_max (vr0->max) && 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; @@ -5758,7 +5747,10 @@ vrp_evaluate_conditional (enum tree_code code, tree op0, tree op1, gimple stmt) else 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; else location = gimple_location (stmt); - warning (OPT_Wstrict_overflow, - ("%Hassuming signed overflow does not occur when " - "simplifying / or %% to >> or &"), - &location); + warning_at (location, OPT_Wstrict_overflow, + "assuming signed overflow does not occur when " + "simplifying % or %<%%%> to %<>>%> or %<&%>"); } } @@ -6679,10 +6670,9 @@ simplify_abs_using_ranges (gimple stmt) location = input_location; else location = gimple_location (stmt); - warning (OPT_Wstrict_overflow, - ("%Hassuming signed overflow does not occur when " - "simplifying abs (X) to X or -X"), - &location); + warning_at (location, OPT_Wstrict_overflow, + "assuming signed overflow does not occur when " + "simplifying % to % or %<-X%>"); } gimple_assign_set_rhs1 (stmt, op); diff --git a/gcc/value-prof.c b/gcc/value-prof.c index 120a68d61e8..e7a8e0f0747 100644 --- a/gcc/value-prof.c +++ b/gcc/value-prof.c @@ -474,9 +474,9 @@ check_counter (gimple stmt, const char * name, } else { - error ("%HCorrupted value profile: %s profiler overall count (%d) " - "does not match BB count (%d)", &locus, name, (int)*all, - (int)bb_count); + error_at (locus, "Corrupted value profile: %s " + "profiler overall count (%d) does not match BB count (%d)", + name, (int)*all, (int)bb_count); return true; } }