Improve location information of -Wcoverage-mismatch.
authorMartin Liska <mliska@suse.cz>
Mon, 24 Sep 2018 11:28:23 +0000 (13:28 +0200)
committerMartin Liska <marxin@gcc.gnu.org>
Mon, 24 Sep 2018 11:28:23 +0000 (11:28 +0000)
2018-09-24  Martin Liska  <mliska@suse.cz>

* coverage.c (get_coverage_counts): Use warning_at
with current_function_decl location. Use %qD in warning
message.

From-SVN: r264530

gcc/ChangeLog
gcc/coverage.c

index de6973aa3384ff84e01c97ebb6f5ebe404d3343f..eb23c85358675c5c78f1bafb7f71de8b51dab72d 100644 (file)
@@ -1,3 +1,9 @@
+2018-09-24  Martin Liska  <mliska@suse.cz>
+
+       * coverage.c (get_coverage_counts): Use warning_at
+       with current_function_decl location. Use %qD in warning
+       message.
+
 2018-09-24  Martin Liska  <mliska@suse.cz>
 
        * memory-block.h (memory_block_pool::release): Annotate with
index 26cce2bc63ac4ea50e3848184d11a1f20fdd235a..8f12778656a4a614d3f44c2981588c841c43baa8 100644 (file)
@@ -336,12 +336,13 @@ get_coverage_counts (unsigned counter, unsigned cfg_checksum,
     {
       static int warned = 0;
       bool warning_printed = false;
-      tree id = DECL_ASSEMBLER_NAME (current_function_decl);
 
       warning_printed =
-       warning_at (input_location, OPT_Wcoverage_mismatch,
-                   "the control flow of function %qE does not match "
-                   "its profile data (counter %qs)", id, ctr_names[counter]);
+       warning_at (DECL_SOURCE_LOCATION (current_function_decl),
+                   OPT_Wcoverage_mismatch,
+                   "the control flow of function %qD does not match "
+                   "its profile data (counter %qs)", current_function_decl,
+                   ctr_names[counter]);
       if (warning_printed && dump_enabled_p ())
        {
          dump_user_location_t loc
@@ -370,10 +371,11 @@ get_coverage_counts (unsigned counter, unsigned cfg_checksum,
     }
   else if (entry->lineno_checksum != lineno_checksum)
     {
-      warning (OPT_Wcoverage_mismatch,
-               "source locations for function %qE have changed,"
-              " the profile data may be out of date",
-              DECL_ASSEMBLER_NAME (current_function_decl));
+      warning_at (DECL_SOURCE_LOCATION (current_function_decl),
+                 OPT_Wcoverage_mismatch,
+                 "source locations for function %qD have changed,"
+                 " the profile data may be out of date",
+                 current_function_decl);
     }
 
   return entry->counts;