Bug 40590 - namespace namespace broken in CNI
Summary: namespace namespace broken in CNI
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: java (show other bugs)
Version: 4.4.0
: P3 normal
Target Milestone: ---
Assignee: Andrew Haley
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-06-29 16:11 UTC by Andrew Haley
Modified: 2009-06-30 09:59 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments
Test case (727 bytes, application/octet-stream)
2009-06-29 16:26 UTC, Andrew Haley
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Haley 2009-06-29 16:11:04 UTC
gcj does not mangle names correctly.

In particular, when a member name is a C++ keyword, "$" is appended to the name.  However, this is results in an illegal mangled name so it is not possible to refer to the member from CNI code.

Also, the set of C++ keywords in gjavah is different from the set in gcj.

Also, types are not checked for C++ keywords, so javax.xml.namespace.* cannot be referenced from CNI code.
Comment 1 Andrew Haley 2009-06-29 16:12:04 UTC
See the thread at http://gcc.gnu.org/ml/java/2009-06/msg00066.html
Comment 2 Andrew Haley 2009-06-29 16:26:31 UTC
Created attachment 18093 [details]
Test case
Comment 3 Andrew Haley 2009-06-29 17:51:16 UTC
Subject: Bug 40590

Author: aph
Date: Mon Jun 29 17:50:59 2009
New Revision: 149059

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=149059
Log:
2009-06-29  Andrew Haley  <aph@redhat.com>

	PR java/40590	
	* tools/gnu/classpath/tools/javah/FieldHelper.java (print):
	Use printName().
	* tools/gnu/classpath/tools/javah/MethodHelper.java (print):
	Use printName().
	* tools/gnu/classpath/tools/javah/CniStubPrinter.java (printDecl):
	Use printName().
	* tools/gnu/classpath/tools/javah/Keywords.java (words): Replace
	with keywords list from  gcc/java/mangle.c.
	* tools/gnu/classpath/tools/javah/ClassWrapper.java (printMethods):
	Don't pre-convert a C++ keyword.
	(print(CniPrintStream)): Call CniPrintStream.printName().
	(printContents): Likewise.
	* tools/gnu/classpath/tools/javah/CniPrintStream.java
	(getClassName): Don't call replaceAll("/", "::").
	(print(Type)): Add ""::" befor name, " *" after.  Use printName(), not
	print.
	(printName(PrintStream, String), printName(String), printlnName):
	New methods.
	(moveToPackage): Use printName().

2009-06-29  Andrew Haley  <aph@redhat.com>

	PR java/40590
	* java-tree.h (cxx_keyword_p): New declaration.
	* mangle_name.c (utf8_cmp): Move here from mangle.c.
	(cxx_keywords): Likewise.
	(cxx_keyword_p): Likewise.
	(MANGLE_CXX_KEYWORDS): New macro.
	(append_gpp_mangled_name): Use MANGLE_CXX_KEYWORDS.
	(append_gpp_mangled_name): Likewise.
	* mangle.c: Move code to mangle_name.c.
	(mangle_member_name): Don't call cxx_keyword_p.


Modified:
    trunk/gcc/java/ChangeLog
    trunk/gcc/java/java-tree.h
    trunk/gcc/java/mangle.c
    trunk/gcc/java/mangle_name.c
    trunk/libjava/classpath/ChangeLog
    trunk/libjava/classpath/tools/classes/gnu/classpath/tools/javah/ClassWrapper.class
    trunk/libjava/classpath/tools/classes/gnu/classpath/tools/javah/CniPrintStream.class
    trunk/libjava/classpath/tools/classes/gnu/classpath/tools/javah/CniStubPrinter.class
    trunk/libjava/classpath/tools/classes/gnu/classpath/tools/javah/FieldHelper.class
    trunk/libjava/classpath/tools/classes/gnu/classpath/tools/javah/Keywords.class
    trunk/libjava/classpath/tools/classes/gnu/classpath/tools/javah/MethodHelper.class
    trunk/libjava/classpath/tools/gnu/classpath/tools/javah/ClassWrapper.java
    trunk/libjava/classpath/tools/gnu/classpath/tools/javah/CniPrintStream.java
    trunk/libjava/classpath/tools/gnu/classpath/tools/javah/CniStubPrinter.java
    trunk/libjava/classpath/tools/gnu/classpath/tools/javah/FieldHelper.java
    trunk/libjava/classpath/tools/gnu/classpath/tools/javah/Keywords.java
    trunk/libjava/classpath/tools/gnu/classpath/tools/javah/MethodHelper.java
    trunk/libjava/gnu/xml/stream/AttributeImpl.h
    trunk/libjava/gnu/xml/stream/EndElementImpl.h
    trunk/libjava/gnu/xml/stream/StartElementImpl.h
    trunk/libjava/gnu/xml/stream/XIncludeFilter.h
    trunk/libjava/gnu/xml/stream/XMLEventFactoryImpl.h
    trunk/libjava/gnu/xml/stream/XMLEventImpl.h
    trunk/libjava/gnu/xml/stream/XMLEventWriterImpl.h
    trunk/libjava/gnu/xml/stream/XMLParser.h
    trunk/libjava/gnu/xml/stream/XMLStreamWriterImpl.h
    trunk/libjava/gnu/xml/transform/AbstractNumberNode.h
    trunk/libjava/gnu/xml/transform/ApplyImportsNode.h
    trunk/libjava/gnu/xml/transform/ApplyTemplatesNode.h
    trunk/libjava/gnu/xml/transform/AttributeNode.h
    trunk/libjava/gnu/xml/transform/Bindings.h
    trunk/libjava/gnu/xml/transform/CallTemplateNode.h
    trunk/libjava/gnu/xml/transform/ChooseNode.h
    trunk/libjava/gnu/xml/transform/CommentNode.h
    trunk/libjava/gnu/xml/transform/CopyNode.h
    trunk/libjava/gnu/xml/transform/CopyOfNode.h
    trunk/libjava/gnu/xml/transform/CurrentFunction.h
    trunk/libjava/gnu/xml/transform/DocumentFunction.h
    trunk/libjava/gnu/xml/transform/ElementAvailableFunction.h
    trunk/libjava/gnu/xml/transform/ElementNode.h
    trunk/libjava/gnu/xml/transform/ForEachNode.h
    trunk/libjava/gnu/xml/transform/FormatNumberFunction.h
    trunk/libjava/gnu/xml/transform/FunctionAvailableFunction.h
    trunk/libjava/gnu/xml/transform/GenerateIdFunction.h
    trunk/libjava/gnu/xml/transform/IfNode.h
    trunk/libjava/gnu/xml/transform/Key.h
    trunk/libjava/gnu/xml/transform/KeyFunction.h
    trunk/libjava/gnu/xml/transform/LiteralNode.h
    trunk/libjava/gnu/xml/transform/MessageNode.h
    trunk/libjava/gnu/xml/transform/OtherwiseNode.h
    trunk/libjava/gnu/xml/transform/ParameterNode.h
    trunk/libjava/gnu/xml/transform/ProcessingInstructionNode.h
    trunk/libjava/gnu/xml/transform/SortKey.h
    trunk/libjava/gnu/xml/transform/Stylesheet.h
    trunk/libjava/gnu/xml/transform/SystemPropertyFunction.h
    trunk/libjava/gnu/xml/transform/Template.h
    trunk/libjava/gnu/xml/transform/TemplateNode.h
    trunk/libjava/gnu/xml/transform/TextNode.h
    trunk/libjava/gnu/xml/transform/TransformerImpl.h
    trunk/libjava/gnu/xml/transform/UnparsedEntityUriFunction.h
    trunk/libjava/gnu/xml/transform/ValueOfNode.h
    trunk/libjava/gnu/xml/transform/WhenNode.h
    trunk/libjava/gnu/xml/transform/WithParam.h
    trunk/libjava/gnu/xml/validation/datatype/AtomicSimpleType.h
    trunk/libjava/gnu/xml/validation/datatype/ListSimpleType.h
    trunk/libjava/gnu/xml/validation/datatype/SimpleType.h
    trunk/libjava/gnu/xml/validation/datatype/Type.h
    trunk/libjava/gnu/xml/validation/datatype/UnionSimpleType.h
    trunk/libjava/gnu/xml/validation/xmlschema/AttributeDeclaration.h
    trunk/libjava/gnu/xml/validation/xmlschema/ComplexType.h
    trunk/libjava/gnu/xml/validation/xmlschema/ElementDeclaration.h
    trunk/libjava/gnu/xml/validation/xmlschema/XMLSchemaBuilder.h
    trunk/libjava/gnu/xml/xpath/AndExpr.h
    trunk/libjava/gnu/xml/xpath/ArithmeticExpr.h
    trunk/libjava/gnu/xml/xpath/BooleanFunction.h
    trunk/libjava/gnu/xml/xpath/CeilingFunction.h
    trunk/libjava/gnu/xml/xpath/ConcatFunction.h
    trunk/libjava/gnu/xml/xpath/Constant.h
    trunk/libjava/gnu/xml/xpath/ContainsFunction.h
    trunk/libjava/gnu/xml/xpath/CountFunction.h
    trunk/libjava/gnu/xml/xpath/EqualityExpr.h
    trunk/libjava/gnu/xml/xpath/Expr.h
    trunk/libjava/gnu/xml/xpath/FalseFunction.h
    trunk/libjava/gnu/xml/xpath/FloorFunction.h
    trunk/libjava/gnu/xml/xpath/FunctionCall.h
    trunk/libjava/gnu/xml/xpath/IdFunction.h
    trunk/libjava/gnu/xml/xpath/LangFunction.h
    trunk/libjava/gnu/xml/xpath/LastFunction.h
    trunk/libjava/gnu/xml/xpath/LocalNameFunction.h
    trunk/libjava/gnu/xml/xpath/NameFunction.h
    trunk/libjava/gnu/xml/xpath/NameTest.h
    trunk/libjava/gnu/xml/xpath/NamespaceTest.h
    trunk/libjava/gnu/xml/xpath/NamespaceUriFunction.h
    trunk/libjava/gnu/xml/xpath/NegativeExpr.h
    trunk/libjava/gnu/xml/xpath/NodeTypeTest.h
    trunk/libjava/gnu/xml/xpath/NormalizeSpaceFunction.h
    trunk/libjava/gnu/xml/xpath/NotFunction.h
    trunk/libjava/gnu/xml/xpath/NumberFunction.h
    trunk/libjava/gnu/xml/xpath/OrExpr.h
    trunk/libjava/gnu/xml/xpath/ParenthesizedExpr.h
    trunk/libjava/gnu/xml/xpath/PositionFunction.h
    trunk/libjava/gnu/xml/xpath/Predicate.h
    trunk/libjava/gnu/xml/xpath/RelationalExpr.h
    trunk/libjava/gnu/xml/xpath/Root.h
    trunk/libjava/gnu/xml/xpath/RoundFunction.h
    trunk/libjava/gnu/xml/xpath/Selector.h
    trunk/libjava/gnu/xml/xpath/StartsWithFunction.h
    trunk/libjava/gnu/xml/xpath/Steps.h
    trunk/libjava/gnu/xml/xpath/StringFunction.h
    trunk/libjava/gnu/xml/xpath/StringLengthFunction.h
    trunk/libjava/gnu/xml/xpath/SubstringAfterFunction.h
    trunk/libjava/gnu/xml/xpath/SubstringBeforeFunction.h
    trunk/libjava/gnu/xml/xpath/SubstringFunction.h
    trunk/libjava/gnu/xml/xpath/SumFunction.h
    trunk/libjava/gnu/xml/xpath/Test.h
    trunk/libjava/gnu/xml/xpath/TranslateFunction.h
    trunk/libjava/gnu/xml/xpath/TrueFunction.h
    trunk/libjava/gnu/xml/xpath/UnionExpr.h
    trunk/libjava/gnu/xml/xpath/VariableReference.h
    trunk/libjava/gnu/xml/xpath/XPathImpl.h
    trunk/libjava/gnu/xml/xpath/XPathParser.h
    trunk/libjava/javax/xml/datatype/DatatypeConstants.h
    trunk/libjava/javax/xml/datatype/Duration.h
    trunk/libjava/javax/xml/datatype/XMLGregorianCalendar.h
    trunk/libjava/javax/xml/namespace/NamespaceContext.h
    trunk/libjava/javax/xml/namespace/QName.h
    trunk/libjava/javax/xml/stream/XMLEventFactory.h
    trunk/libjava/javax/xml/stream/XMLEventWriter.h
    trunk/libjava/javax/xml/stream/XMLStreamReader.h
    trunk/libjava/javax/xml/stream/XMLStreamWriter.h
    trunk/libjava/javax/xml/stream/events/Attribute.h
    trunk/libjava/javax/xml/stream/events/Characters.h
    trunk/libjava/javax/xml/stream/events/Comment.h
    trunk/libjava/javax/xml/stream/events/DTD.h
    trunk/libjava/javax/xml/stream/events/EndDocument.h
    trunk/libjava/javax/xml/stream/events/EndElement.h
    trunk/libjava/javax/xml/stream/events/EntityDeclaration.h
    trunk/libjava/javax/xml/stream/events/EntityReference.h
    trunk/libjava/javax/xml/stream/events/Namespace.h
    trunk/libjava/javax/xml/stream/events/NotationDeclaration.h
    trunk/libjava/javax/xml/stream/events/ProcessingInstruction.h
    trunk/libjava/javax/xml/stream/events/StartDocument.h
    trunk/libjava/javax/xml/stream/events/StartElement.h
    trunk/libjava/javax/xml/stream/events/XMLEvent.h
    trunk/libjava/javax/xml/stream/util/ReaderDelegate.h
    trunk/libjava/javax/xml/xpath/XPath.h
    trunk/libjava/javax/xml/xpath/XPathConstants.h
    trunk/libjava/javax/xml/xpath/XPathExpression.h
    trunk/libjava/javax/xml/xpath/XPathFunctionResolver.h
    trunk/libjava/javax/xml/xpath/XPathVariableResolver.h

Comment 4 Andrew Haley 2009-06-30 09:59:22 UTC
Fixed by commit.