From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16273 invoked by alias); 23 Jun 2009 10:45:42 -0000 Received: (qmail 16263 invoked by uid 22791); 23 Jun 2009 10:45:42 -0000 X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL,BAYES_00,J_CHICKENPOX_63,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mx2.redhat.com (HELO mx2.redhat.com) (66.187.237.31) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 23 Jun 2009 10:45:34 +0000 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n5NAjTvu003226; Tue, 23 Jun 2009 06:45:29 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n5NAjSC8022779; Tue, 23 Jun 2009 06:45:28 -0400 Received: from zebedee.pink (vpn-12-128.rdu.redhat.com [10.11.12.128]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n5NAjQrU019391; Tue, 23 Jun 2009 06:45:27 -0400 Message-ID: <4A40B246.5020302@redhat.com> Date: Tue, 23 Jun 2009 10:45:00 -0000 From: Andrew Haley User-Agent: Thunderbird 2.0.0.17 (X11/20081009) MIME-Version: 1.0 To: Chris Burdess CC: Sam Ruby , java@gcc.gnu.org Subject: Re: NPE in parser->getDOMImplementation() with CNI References: <4A3D95F1.6040803@intertwingly.net> <4A3E55E1.6010705@redhat.com> <4A403949.4090401@intertwingly.net> <4A40A09E.5040502@redhat.com> <9DAA724F-CC05-4A04-8B4D-386238D1D223@bluezoo.org> In-Reply-To: <9DAA724F-CC05-4A04-8B4D-386238D1D223@bluezoo.org> Content-Type: text/plain; charset=WINDOWS-1252 Content-Transfer-Encoding: 8bit X-IsSubscribed: yes Mailing-List: contact java-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: java-owner@gcc.gnu.org X-SW-Source: 2009-06/txt/msg00065.txt.bz2 Chris Burdess wrote: > Andrew Haley wrote: >> Sam Ruby wrote: >>> Generating a header file for javax::xml::xpath::XPathExpression produces >>> a file that looks like the following: >>> >>> http://git.etherboot.org/scm/people/mcb30/gcc/libjava/javax/xml/xpath/XPathExpression.h >>> >>> >>> >>> Attempting to include this file produces: >>> >>> headers/javax/xml/xpath/XPathExpression.h:16: error: expected identifier >>> before ‘namespace’ >>> headers/javax/xml/xpath/XPathExpression.h:42: error: expected identifier >>> before ‘namespace’ >>> headers/javax/xml/xpath/XPathExpression.h:42: error: expected ‘,’ or >>> ‘...’ before ‘namespace’ >>> >>> Presumably somebody has encountered this before, and there is an obvious >>> solution... >> >> Some genius (?) has a namespace called "namespace" :-) > > That would be Sun. And in Java "namespace" is not a keyword so it's a > perfectly legal package name. > >> I think you'll have to edit the header file by hand. > > Should this not be handled by some automatic munging/unmunging in > gcjh/gcj? It may prove to be a problem in other places where names are > not keywords in Java but might be in C/C++/whatever. Yes, that's right. gjavah does have code to handle this, but it isn't being called. Here, in CniPrintStream.java is where the package names are emitted: // Open new parts. for (int j = commonIndex; j < pkgParts.length; ++j) { indent(out, j + 1); out.print("namespace "); out.println(pkgParts[j]); This line should be out.println(Keywords.getCxxName(pkgParts[j])); but there are many places where identifiers are emitted but getCxxName is not called. This is very odd: for correctness, getCxxName must be called whenever an identifier is emitted. Andrew.