mangle_name.c (append_unicode_mangled_name): Emit `_' or `U' outside of the `__U...
authorAlexandre Petit-Bianco <apbianco@redhat.com>
Fri, 9 Feb 2001 20:29:08 +0000 (12:29 -0800)
committerAlexandre Petit-Bianco <apbianco@gcc.gnu.org>
Fri, 9 Feb 2001 20:29:08 +0000 (12:29 -0800)
2001-02-09  Alexandre Petit-Bianco  <apbianco@redhat.com>

* mangle_name.c (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.

(http://gcc.gnu.org/ml/gcc-patches/2001-02/msg00532.html)

From-SVN: r39570

gcc/java/ChangeLog
gcc/java/mangle_name.c

index 955cc5b0c021f0fc07ebfb3fd002f95bdba527fe..8070ba7153c632aa3a41e736d7c1df5fd683297e 100644 (file)
@@ -1,3 +1,10 @@
+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.
+
 2001-02-09  Alexandre Petit-Bianco  <apbianco@redhat.com>
 
        * jvgenmain.c (error): Reversed 2001-02-01 deletion.
index b074f1ed212c0a4d36f62cdd182ef068f8323051..101dee7c7c2b67dc332132d48f21950c760eaddf 100644 (file)
@@ -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;
            }