c-lex.c: Replace %H by an explicit location.
authorManuel López-Ibáñez <manu@gcc.gnu.org>
Tue, 7 Jul 2009 02:10:19 +0000 (02:10 +0000)
committerManuel López-Ibáñez <manu@gcc.gnu.org>
Tue, 7 Jul 2009 02:10:19 +0000 (02:10 +0000)
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

19 files changed:
gcc/ChangeLog
gcc/c-common.c
gcc/c-decl.c
gcc/c-lex.c
gcc/c-typeck.c
gcc/fold-const.c
gcc/gimplify.c
gcc/java/ChangeLog
gcc/java/jcf-parse.c
gcc/objc/ChangeLog
gcc/objc/objc-act.c
gcc/stmt.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/plugin/selfassign.c
gcc/testsuite/gcc.dg/plugin/selfassign.c
gcc/tree-cfg.c
gcc/tree-ssa-loop-niter.c
gcc/tree-vrp.c
gcc/value-prof.c

index a2f3006..9acef1e 100644 (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>
 
        * tree-dfa.c (dump_variable): Write DECL_INITIAL for VAR
index 1ff9292..772d968 100644 (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);
   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;
 
index 9f852ff..fdceb20 100644 (file)
@@ -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;
 }
 
index 66df4c4..0b6fcc0 100644 (file)
@@ -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;
            }
index df1e171..e86e095 100644 (file)
@@ -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 %<else%>",
-                 &if_locus);
+        warning_at (if_locus, OPT_Wparentheses,
+                    "suggest explicit braces to avoid ambiguous %<else%>");
     }
 
   stmt = build3 (COND_EXPR, void_type_node, cond, then_block, else_block);
index 39548e2..670fa45 100644 (file)
@@ -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
index 33e5a2e..c5fb185 100644 (file)
@@ -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;
index 5e41e13..17c6ebf 100644 (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>
 
        PR java/40590
index 98c98c8..f7b2cb2 100644 (file)
@@ -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
index 656a5f6..605715c 100644 (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>
 
        PR objc/28050
index 733818f..e951b2a 100644 (file)
@@ -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;
            }
        }
index 31b0b7d..d544080 100644 (file)
@@ -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;
     }
 }
index 3a97503..0b889ae 100644 (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>
 
        * g++.dg/rtti/dyncast[34].C: New.
index 75b6161..2be4815 100644 (file)
@@ -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"));
     }
 }
 
index 52a03bf..13f6be9 100644 (file)
@@ -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"));
     }
 }
 
index 4c7c0db..34c6461 100644 (file)
@@ -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%<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
index 48016c0..14b44aa 100644 (file)
@@ -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;
index 13ed4c0..117b199 100644 (file)
@@ -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);
 
@@ -5741,16 +5740,6 @@ vrp_evaluate_conditional (enum tree_code code, tree op0, tree op1, gimple stmt)
          && 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;
 
          if (!gimple_has_location (stmt))
@@ -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 %<abs (X)%> to %<X%> or %<-X%>");
            }
 
          gimple_assign_set_rhs1 (stmt, op);
index 120a68d..e7a8e0f 100644 (file)
@@ -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;
        }
     }