This is the mail archive of the java@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]
Other format: [Raw text]

Re: gcjh: Why is "__" appended to member names?


>>>>> "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


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