This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: [PATCH] Java: mangling of unicode characters.



Jason Merrill writes:

> It seems that append_unicode_mangled_name in this patch will discard
> _'s and U's other than as part of __U.

Indeed, good catch. I'm going to check this fix in.

./A

2001-02-09  Alexandre Petit-Bianco  <apbianco@redhat.com>

	* mangle_name (append_unicode_mangled_name): Emit `_' or `U'
	outside of the `__U' sequence too.
	(unicode_mangling_length): Count `_' or `U' outside of the `__U'
	sequence too.

Index: mangle_name.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/java/mangle_name.c,v
retrieving revision 1.1
diff -u -p -r1.1 mangle_name.c
--- mangle_name.c	2001/02/09 00:32:11	1.1
+++ mangle_name.c	2001/02/09 20:22:15
@@ -113,6 +113,13 @@ append_unicode_mangled_name (name, len)
 		  uuU = 0;
 		  obstack_grow (mangle_obstack, "U_", 2);
 		}
+	      /* Otherwise, just reset uuU and emit the character we
+                 have. */
+	      else
+		{
+		  uuU = 0;
+		  obstack_1grow (mangle_obstack, ch);
+		}
 	      continue;
 	    }
 	  sprintf (buf, "__U%x_", ch);
@@ -156,19 +163,25 @@ unicode_mangling_length (name, len)
 
 	  if (ch == '_' || ch == 'U')
 	    {
+	      /* It's always at least one character. */
+	      num_chars++;
+
 	      /* Prepare to recognize __U */
 	      if (ch == '_' && (uuU < 3))
-		{
-		  num_chars++;
-		  uuU++;
-		}
-	      /* We recognize __U that we wish to encode __U_ */
+		uuU++;
+
+	      /* We recognize __U that we wish to encode __U_, we
+	         count one more character. */
 	      else if (ch == 'U' && (uuU == 2))
 		{
-		  num_chars += 2;
+		  num_chars++;
 		  need_escapes = 1;
 		  uuU = 0;
 		}
+	      /* Otherwise, just reset uuU */
+	      else
+		uuU = 0;
+
 	      continue;
 	    }
 	  


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]