This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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]

{Patch] Re: Conflicting JNI function decls


Moving discussion from java@

From: "Tom Tromey" | >>>>> "Danny" == Danny Smith
<dannysmith@clear.net.nz> writes:
|
| Danny> While testing a patch to fix PR c ++/15774 (Conflicting
| Danny> function decls not diagnosed) I get this in libjava build.
| Danny> ../../../gcc/libjava/jni.cc:
| Danny> In function `java::lang::Object*
_Jv_JNI_ToReflectedField(JNIEnv*,
| Danny> java::lang::Class*, _Jv_Field*, jboolean)'
| Danny> : ../../../gcc/libjava/jni.cc:1612: error: new declaration
| Danny> `java::lang::Object* _Jv_JNI_ToReflectedField(JNIEnv*,
| Danny> java::lang::Class*, _Jv_Field*, jboolean)'
|
| This is just an oversight on our part.  These friend declarations are
| added by some code in Makefile.am -- care to take a stab at fixing
| them?  It might involve a little rearrangement since now Field.h will
| probably need to refer to jni.h.
|
Hi
Bryce suggested that the friend declarations were the real problem, but
I don't have enough famliarity with Java to even try to remove the
friendship relationship between the _Jv_JNI_ToReflected* functions and
the four classes that currently declare them.

This moves definition of JNICALL to gcj/javaprims.h. Pedantically, it
may not
belong here, but if Java classes have JNI friends, the interface does
need
to be honest about how those friends pop the stack. Putting it here
avoids
include jni.h "all over the place".

Should the define of JNICALL instead be autoconfiscated into
libgcj-config,h?

Patch attached.

Danny


ChangeLog

2004-08-03  Danny Smith  <dannysmith@users.sourceforge.net>

        * Makefile.am (java/lang/reflect/Constructor.h):  Add JNICALL
        attribute to _Jv_JNI_ToRefected* friend declaration.
        (java/lang/reflect/Field.h) Likewise.
        (java/lang/reflect/Method.h): Likewise.
        * Makefile.in: Regenerate.
        * gcj/javaprims.h: Define JNICALL.
        * jni.h: Define JNICALL only if !__GCJ_JNI_IMPL__.
        * java/lang/Class.h (_Jv_JNI_ToReflectedField): Add JNICALL
        attribute.
        (_Jv_JNI_ToReflectedMethod): Add JNICALL attribute.


Attachment: jnicall-2.diff
Description: Text document


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