This is the mail archive of the java-patches@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]

Java: Don't mangle "$" characters in identifier names


The Java compiler currently mangles "$" characters, which occur in
inner class names, to "__U24_" if NO_DOLLAR_IN_LABEL is defined. The
C++ compiler does not do this, resulting in ABI incompatibilities
between GCJ and C++ compiled code.

This patch changes GCJ to not do this mangling, matching the behaviour
of C++. If the C++ compiler is correct here, and "$" should never be
mangled, then the $ code should be removed entirely from GCJ. Can
anyone comment on this?

OK to commit?

regards

  [ bryce ]

2001-03-12  Bryce McKinlay  <bryce@albatross.co.nz>

	Don't mangle "$" characters in identifiers, for compatibility with C++.
	* mangle_name.c (NO_DOLLAR_IN_LABEL): #undef it.

Index: mangle_name.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/mangle_name.c,v
retrieving revision 1.2
diff -u -r1.2 mangle_name.c
--- mangle_name.c	2001/02/09 20:29:08	1.2
+++ mangle_name.c	2001/03/12 03:46:34
@@ -69,6 +69,10 @@
     obstack_grow (mangle_obstack, name, len);
 }
 
+/* C++ does not mangle "$" characters in identifier names, even if 
+   NO_DOLLAR_IN_LABEL is set. So we won't either. */
+#undef NO_DOLLAR_IN_LABEL
+
 /* Assuming (NAME, LEN) is a Utf8-encoded string, emit the string
    appropriately mangled (with Unicode escapes) to MANGLE_OBSTACK.
    Characters needing an escape are encoded `__UNN_' to `__UNNNN_', in

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