This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: gcjh: Why is "__" appended to member names?
- From: Tom Tromey <tromey at redhat dot com>
- To: "Craig A. Vanderborgh" <craigv at voxware dot com>
- Cc: java at gcc dot gnu dot org
- Date: Thu, 26 Jun 2003 13:52:24 -0600
- Subject: Re: gcjh: Why is "__" appended to member names?
- References: <1056654703.27326.321.camel@zetar>
- Reply-to: tromey at redhat dot com
>>>>> "Craig" == Craig A Vanderborgh <craigv@voxware.com> writes:
Craig> ::java::lang::String *hostTrans__;
Craig> My question is this: Why is "hostTrans" postfixed with "__"?
Craig> Is this the correct output, and if so under what conditions can
Craig> I expect to see members declared "foo__"??
The intent is that we only add this when a field name and a method
name conflict. Here's the code from gcc/java/gjavah.c:
if (name_is_method_p (name, length))
{
/* This field name matches a method. So override the name with
a dummy name. This is yucky, but it isn't clear what else to
do. FIXME: if the field is static, then we'll be in real
trouble. */
if ((flags & ACC_STATIC))
{
fprintf (stderr, "static field has same name as method\n");
found_error = 1;
return NULL;
}
override = xmalloc (length + 3);
memcpy (override, name, length);
strcpy (override + length, "__");
}
Could you figure out why this isn't working?
One theory would be that it fails if you pass multiple files to gcjh
at once -- I don't see us clearing method_name_list. Oops :-(
Could you try running gcjh on just that one class to see if it happens
that way too?
Please dump this in bugzilla if you don't want to do any debugging.
Otherwise we'll forget about it.
This particular convention is pretty ugly. It's one of those warts
that stays around forever since it isn't critical and nobody is
especially motivated to fix it. We should add this to the list for
the "new ABI" work, whenever that happens.
Tom