diff mbox

Fix caret locations in format_type_warning (PR c/72857)

Message ID 1471441868.3619.7.camel@redhat.com
State New
Headers show

Commit Message

David Malcolm Aug. 17, 2016, 1:51 p.m. UTC
On Wed, 2016-08-17 at 10:12 +0200, Andreas Schwab wrote:
> ../../gcc/input.c:1470:1: error: 'const char*
> get_source_range_for_char(cpp_reader*, string_concat_db*, location_t,
> cpp_ttype, int, source_range*)' defined but not used [-Werror=unused
> -function]
>  get_source_range_for_char (cpp_reader *pfile,
>  ^~~~~~~~~~~~~~~~~~~~~~~~~

I'm guessing you have a --enable-checking=release build, and that this
is happening in stage2.  My testing was with a debug build.

Sorry about this.

Does the attached patch fix it for you?  (I verified that it builds
without warnings with both plain and --enable-checking=release
configurations; bootstrapping it now)

Dave
diff mbox

Patch

From 397d1bed2f014416f0c287b7872d025fb8003705 Mon Sep 17 00:00:00 2001
From: David Malcolm <dmalcolm@redhat.com>
Date: Wed, 17 Aug 2016 10:13:20 -0400
Subject: [PATCH] input.c: move test functions within #CHECKING_P and into
 selftest::

gcc/ChangeLog:
	* input.c (get_source_range_for_char): Rename to...
	(selftest::get_source_range_for_char): ...this, and move within
	the #if CHECKING_P guard.
	(get_num_source_ranges_for_substring): Rename to...
	(selftest::get_num_source_ranges_for_substring): ...this, move within
	the #if CHECKING_P guard, and make static.
---
 gcc/input.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/gcc/input.c b/gcc/input.c
index 653e54d..bd0d214 100644
--- a/gcc/input.c
+++ b/gcc/input.c
@@ -1454,6 +1454,12 @@  get_source_location_for_substring (cpp_reader *pfile,
   return NULL;
 }
 
+#if CHECKING_P
+
+namespace selftest {
+
+/* Selftests of location handling.  */
+
 /* Attempt to populate *OUT_RANGE with source location information on the
    given character within the string literal found at STRLOC.
    CHAR_IDX refers to an offset within the execution character set.
@@ -1493,7 +1499,7 @@  get_source_range_for_char (cpp_reader *pfile,
 /* As get_source_range_for_char, but write to *OUT the number
    of ranges that are available.  */
 
-const char *
+static const char *
 get_num_source_ranges_for_substring (cpp_reader *pfile,
 				     string_concat_db *concats,
 				     location_t strloc,
@@ -1513,12 +1519,6 @@  get_num_source_ranges_for_substring (cpp_reader *pfile,
   return NULL;
 }
 
-#if CHECKING_P
-
-namespace selftest {
-
-/* Selftests of location handling.  */
-
 /* A class for writing out a temporary sourcefile for use in selftests
    of input handling.  */
 
-- 
1.8.5.3