input.c: move test functions within #CHECKING_P and into selftest::
authorDavid Malcolm <dmalcolm@redhat.com>
Thu, 18 Aug 2016 00:13:26 +0000 (00:13 +0000)
committerDavid Malcolm <dmalcolm@gcc.gnu.org>
Thu, 18 Aug 2016 00:13:26 +0000 (00:13 +0000)
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.
(selftest::assert_num_substring_ranges): Initialize
actual_num_ranges.

From-SVN: r239550

gcc/ChangeLog
gcc/input.c

index e09cdeafe6b3290445017ce81e43a3b6cdc2a72b..42d404baab8b365e080dc4ecd3e2f280c651087c 100644 (file)
@@ -1,3 +1,14 @@
+2016-08-17  David Malcolm  <dmalcolm@redhat.com>
+
+       * 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.
+       (selftest::assert_num_substring_ranges): Initialize
+       actual_num_ranges.
+
 2016-08-18  Alan Modra  <amodra@gmail.com>
 
        PR rtl-optimization/72771
index 10cab77359d369a2d51feacbc063efeb192d45b5..172d13a8ad7dd7c449c96727dc3cdd0c77af2687 100644 (file)
@@ -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,10 +1519,6 @@ get_num_source_ranges_for_substring (cpp_reader *pfile,
   return NULL;
 }
 
-#if CHECKING_P
-
-namespace selftest {
-
 /* Selftests of location handling.  */
 
 /* Helper function for verifying location data: when location_t
@@ -2039,7 +2041,7 @@ assert_num_substring_ranges (const location &loc,
   cpp_reader *pfile = test.m_parser;
   string_concat_db *concats = &test.m_concats;
 
-  int actual_num_ranges;
+  int actual_num_ranges = -1;
   const char *err
     = get_num_source_ranges_for_substring (pfile, concats, strloc, type,
                                           &actual_num_ranges);