From 124b13d738914b7bd7096dd46e89a0bccdb51360 Mon Sep 17 00:00:00 2001
From: David Malcolm <dmalcolm@redhat.com>
Date: Thu, 7 Jul 2016 11:06:52 -0400
Subject: [PATCH 22/25] FIXME: rename *_unified back to *; delete unused
 callers

---
 libcpp/charset.c | 172 ++++++++++++++-----------------------------------------
 1 file changed, 43 insertions(+), 129 deletions(-)

diff --git a/libcpp/charset.c b/libcpp/charset.c
index b135c58..d7b9624 100644
--- a/libcpp/charset.c
+++ b/libcpp/charset.c
@@ -1133,12 +1133,15 @@ _cpp_valid_ucn (cpp_reader *pfile, const uchar **pstr,
   return true;
 }
 
+/* Convert an UCN, pointed to by FROM, to UTF-8 encoding, then translate
+   it to the execution character set and write the result into TBUF.
+   An advanced pointer is returned.  Issues all relevant diagnostics.  */
 static const uchar *
-convert_ucn_unified (cpp_reader *pfile, const uchar *from, const uchar *limit,
-		     struct _cpp_strbuf *tbuf, struct cset_converter cvt,
-		     source_range char_range,
-		     cpp_string_location_reader *loc_reader,
-		     cpp_substring_ranges *ranges)
+convert_ucn (cpp_reader *pfile, const uchar *from, const uchar *limit,
+	     struct _cpp_strbuf *tbuf, struct cset_converter cvt,
+	     source_range char_range,
+	     cpp_string_location_reader *loc_reader,
+	     cpp_substring_ranges *ranges)
 {
   cppchar_t ucn;
   uchar buf[6];
@@ -1182,31 +1185,6 @@ convert_ucn_unified (cpp_reader *pfile, const uchar *from, const uchar *limit,
   return from;
 }
 
-/* Convert an UCN, pointed to by FROM, to UTF-8 encoding, then translate
-   it to the execution character set and write the result into TBUF.
-   An advanced pointer is returned.  Issues all relevant diagnostics.  */
-#if 0
-static const uchar *
-convert_ucn (cpp_reader *pfile, const uchar *from, const uchar *limit,
-	     struct _cpp_strbuf *tbuf, struct cset_converter cvt)
-{
-  source_range dummy;
-  return convert_ucn_unified (pfile, from, limit, tbuf, cvt,
-			      dummy, NULL, NULL);
-}
-
-static const uchar *
-convert_ucn_ranges (cpp_reader *pfile, const uchar *from, const uchar *limit,
-		    source_range char_range,
-		    cpp_string_location_reader *loc_reader,
-		    cpp_substring_ranges &ranges)
-{
-  struct cset_converter dummy;
-  return convert_ucn_unified (pfile, from, limit, NULL, dummy,
-			      char_range, loc_reader, &ranges);
-}
-#endif
-
 /* Subroutine of convert_hex and convert_oct.  N is the representation
    in the execution character set of a numeric escape; write it into the
    string buffer TBUF and update the end-of-string pointer therein.  WIDE
@@ -1257,12 +1235,18 @@ emit_numeric_escape (cpp_reader *pfile, cppchar_t n,
     }
 }
 
+/* Convert a hexadecimal escape, pointed to by FROM, to the execution
+   character set and write it into the string buffer TBUF.  Returns an
+   advanced pointer, and issues diagnostics as necessary.
+   No character set translation occurs; this routine always produces the
+   execution-set character with numeric value equal to the given hex
+   number.  You can, e.g. generate surrogate pairs this way.  */
 static const uchar *
-convert_hex_unified (cpp_reader *pfile, const uchar *from, const uchar *limit,
-		     struct _cpp_strbuf *tbuf, struct cset_converter cvt,
-		     source_range char_range,
-		     cpp_string_location_reader *loc_reader,
-		     cpp_substring_ranges *ranges)
+convert_hex (cpp_reader *pfile, const uchar *from, const uchar *limit,
+	     struct _cpp_strbuf *tbuf, struct cset_converter cvt,
+	     source_range char_range,
+	     cpp_string_location_reader *loc_reader,
+	     cpp_substring_ranges *ranges)
 {
   cppchar_t c, n = 0, overflow = 0;
   int digits_found = 0;
@@ -1315,40 +1299,18 @@ convert_hex_unified (cpp_reader *pfile, const uchar *from, const uchar *limit,
   return from;
 }
 
-/* Convert a hexadecimal escape, pointed to by FROM, to the execution
+/* Convert an octal escape, pointed to by FROM, to the execution
    character set and write it into the string buffer TBUF.  Returns an
    advanced pointer, and issues diagnostics as necessary.
    No character set translation occurs; this routine always produces the
-   execution-set character with numeric value equal to the given hex
-   number.  You can, e.g. generate surrogate pairs this way.  */
-#if 0
-static const uchar *
-convert_hex (cpp_reader *pfile, const uchar *from, const uchar *limit,
-	     struct _cpp_strbuf *tbuf, struct cset_converter cvt)
-{
-  source_range dummy;
-  return convert_hex_unified (pfile, from, limit, tbuf, cvt,
-			      dummy, NULL, NULL);
-}
-
-static const uchar *
-convert_hex_ranges (cpp_reader *pfile, const uchar *from, const uchar *limit,
-		    source_range char_range,
-		    cpp_string_location_reader *loc_reader,
-		    cpp_substring_ranges &ranges)
-{
-  struct cset_converter dummy;
-  return convert_hex_unified (pfile, from, limit, NULL, dummy,
-			      char_range, loc_reader, &ranges);
-}
-#endif
-
+   execution-set character with numeric value equal to the given octal
+   number.  */
 static const uchar *
-convert_oct_unified (cpp_reader *pfile, const uchar *from, const uchar *limit,
-		     struct _cpp_strbuf *tbuf, struct cset_converter cvt,
-		     source_range char_range,
-		     cpp_string_location_reader *loc_reader,
-		     cpp_substring_ranges *ranges)
+convert_oct (cpp_reader *pfile, const uchar *from, const uchar *limit,
+	     struct _cpp_strbuf *tbuf, struct cset_converter cvt,
+	     source_range char_range,
+	     cpp_string_location_reader *loc_reader,
+	     cpp_substring_ranges *ranges)
 {
   size_t count = 0;
   cppchar_t c, n = 0;
@@ -1383,40 +1345,15 @@ convert_oct_unified (cpp_reader *pfile, const uchar *from, const uchar *limit,
   return from;
 }
 
-/* Convert an octal escape, pointed to by FROM, to the execution
-   character set and write it into the string buffer TBUF.  Returns an
-   advanced pointer, and issues diagnostics as necessary.
-   No character set translation occurs; this routine always produces the
-   execution-set character with numeric value equal to the given octal
-   number.  */
-#if 0
-static const uchar *
-convert_oct (cpp_reader *pfile, const uchar *from, const uchar *limit,
-	     struct _cpp_strbuf *tbuf, struct cset_converter cvt)
-{
-  source_range dummy;
-  return convert_oct_unified (pfile, from, limit, tbuf, cvt,
-			      dummy, NULL, NULL);
-}
-
-static const uchar *
-convert_oct_ranges (cpp_reader *pfile, const uchar *from, const uchar *limit,
-		    source_range char_range,
-		    cpp_string_location_reader *loc_reader,
-		    cpp_substring_ranges &ranges)
-{
-  struct cset_converter dummy;
-  return convert_oct_unified (pfile, from, limit, NULL, dummy,
-			      char_range, loc_reader, &ranges);
-}
-#endif
-
+/* Convert an escape sequence (pointed to by FROM) to its value on
+   the target, and to the execution character set.  Do not scan past
+   LIMIT.  Write the converted value into TBUF.  Returns an advanced
+   pointer.  Handles all relevant diagnostics.  */
 static const uchar *
-convert_escape_unified (cpp_reader *pfile, const uchar *from,
-			const uchar *limit,
-			struct _cpp_strbuf *tbuf, struct cset_converter cvt,
-			cpp_string_location_reader *loc_reader,
-			cpp_substring_ranges *ranges)
+convert_escape (cpp_reader *pfile, const uchar *from, const uchar *limit,
+		struct _cpp_strbuf *tbuf, struct cset_converter cvt,
+		cpp_string_location_reader *loc_reader,
+		cpp_substring_ranges *ranges)
 {
   /* Values of \a \b \e \f \n \r \t \v respectively.  */
 #if HOST_CHARSET == HOST_CHARSET_ASCII
@@ -1439,18 +1376,18 @@ convert_escape_unified (cpp_reader *pfile, const uchar *from,
     {
       /* UCNs, hex escapes, and octal escapes are processed separately.  */
     case 'u': case 'U':
-      return convert_ucn_unified (pfile, from, limit, tbuf, cvt,
-				  char_range, loc_reader, ranges);
+      return convert_ucn (pfile, from, limit, tbuf, cvt,
+			  char_range, loc_reader, ranges);
 
     case 'x':
-      return convert_hex_unified (pfile, from, limit, tbuf, cvt,
-				  char_range, loc_reader, ranges);
+      return convert_hex (pfile, from, limit, tbuf, cvt,
+			  char_range, loc_reader, ranges);
       break;
 
     case '0':  case '1':  case '2':  case '3':
     case '4':  case '5':  case '6':  case '7':
-      return convert_oct_unified (pfile, from, limit, tbuf, cvt,
-				  char_range, loc_reader, ranges);
+      return convert_oct (pfile, from, limit, tbuf, cvt,
+			  char_range, loc_reader, ranges);
 
       /* Various letter escapes.  Get the appropriate host-charset
 	 value into C.  */
@@ -1511,29 +1448,6 @@ convert_escape_unified (cpp_reader *pfile, const uchar *from,
   return from + 1;
 }
 
-/* Convert an escape sequence (pointed to by FROM) to its value on
-   the target, and to the execution character set.  Do not scan past
-   LIMIT.  Write the converted value into TBUF.  Returns an advanced
-   pointer.  Handles all relevant diagnostics.  */
-#if 0
-static const uchar *
-convert_escape (cpp_reader *pfile, const uchar *from, const uchar *limit,
-		struct _cpp_strbuf *tbuf, struct cset_converter cvt)
-{
-  return convert_escape_unified (pfile, from, limit, tbuf, cvt, NULL, NULL);
-}
-
-static const uchar *
-convert_escape_ranges (cpp_reader *pfile, const uchar *from, const uchar *limit,
-		       cpp_string_location_reader *loc_reader,
-		       cpp_substring_ranges &ranges)
-{
-  struct cset_converter dummy;
-  return convert_escape_unified (pfile, from, limit, NULL, dummy,
-				 loc_reader, &ranges);
-}
-#endif
-
 
 /* TYPE is a token type.  The return value is the conversion needed to
    convert from source to execution character set for the given type. */
@@ -1659,8 +1573,8 @@ cpp_interpret_string_unified (cpp_reader *pfile, const cpp_string *from, size_t
 	    break;
 
 	  // FIXME: do we need to conditionalize the &tbuf on "to"?
-	  p = convert_escape_unified (pfile, p + 1, limit, &tbuf, cvt,
-				      loc_reader, out);
+	  p = convert_escape (pfile, p + 1, limit, &tbuf, cvt,
+			      loc_reader, out);
 	}
     }
 
-- 
1.8.5.3

