gcc/libjava/classpath/scripts/check_jni_methods.sh
Tom Tromey 1ea63ef8be Imported Classpath 0.18.
* sources.am, Makefile.in: Updated.
	* Makefile.am (nat_source_files): Removed natProxy.cc.
	* java/lang/reflect/natProxy.cc: Removed.
	* gnu/classpath/jdwp/VMFrame.java,
	gnu/classpath/jdwp/VMIdManager.java,
	gnu/classpath/jdwp/VMVirtualMachine.java,
	java/lang/reflect/VMProxy.java: New files.

2005-09-23  Thomas Fitzsimmons  <fitzsim@redhat.com>

	* scripts/makemake.tcl (verbose): Add gnu/java/awt/peer/qt to BC
	list.

2005-09-23  Thomas Fitzsimmons  <fitzsim@redhat.com>

	* gnu/java/net/DefaultContentHandlerFactory.java (getContent):
	Remove ClasspathToolkit references.

2005-09-23  Thomas Fitzsimmons  <fitzsim@redhat.com>

	* gnu/awt/xlib/XCanvasPeer.java: Add new peer methods.
	* gnu/awt/xlib/XFramePeer.java: Likewise.
	* gnu/awt/xlib/XGraphicsConfiguration.java: Likewise.

2005-09-23  Thomas Fitzsimmons  <fitzsim@redhat.com>

	* Makefile.am (libgcjawt_la_SOURCES): Remove jawt.c.  Add
	classpath/native/jawt/jawt.c.
	* Makefile.in: Regenerate.
	* jawt.c: Remove file.
	* include/Makefile.am (tool_include__HEADERS): Remove jawt.h and
	jawt_md.h.  Add ../classpath/include/jawt.h and
	../classpath/include/jawt_md.h.
	* include/Makefile.in: Regenerate.
	* include/jawt.h: Regenerate.
	* include/jawt_md.h: Regenerate.

From-SVN: r104586
2005-09-23 21:31:04 +00:00

63 lines
1.9 KiB
Bash
Executable file

#!/bin/sh
# Fail if any command fails
set -e
# Don't override existing files
set -C
TMPFILE=/tmp/check-jni-methods.$$.1
TMPFILE2=/tmp/check-jni-methods.$$.2
TMPFILE3=/tmp/check-jni-methods.$$.3
# Find all methods defined in the header files generated
# from the java source files.
grep -h '^JNIEXPORT .* Java_' include/*.h | \
LC_ALL=C sed -e 's,.*JNICALL \(Java_[a-z_A-Z0-9]*\).*$,\1,' | \
sort > $TMPFILE
# Find all methods in the JNI C source files.
find native/jni -name \*.c | \
xargs grep -h '^Java_' | \
LC_ALL=C sed -e 's,^\(Java_[a-z_A-Z0-9]*\) *(.*$,\1,' > $TMPFILE2
# Or in the the C++ files. (Note that cpp doesn't follow gnu conventions atm)
# So we try to match both GNU style and some other style.
find native/jni -name \*.cpp | \
xargs grep -h '^Java_' | \
LC_ALL=C sed -e 's,^\(Java_[a-z_A-Z0-9]*\) *(.*$,\1,' >> $TMPFILE2
find native/jni -name \*.cpp | \
xargs egrep -h '^(JNIEXPORT .* JNICALL )?Java_' | \
cut -f4 -d\ | \
LC_ALL=C sed -e 's,^\JNIEXPORT .* JNICALL \(Java_[a-z_A-Z0-9]*\) *(.*$,\1,' >> $TMPFILE2
mv $TMPFILE2 $TMPFILE3
sort $TMPFILE3 > $TMPFILE2
rm $TMPFILE3
# Write temporary ignore file.
cat > $TMPFILE3 << EOF
-Java_gnu_java_awt_peer_gtk_GtkMenuComponentPeer_dispose
-Java_java_lang_VMSystem_arraycopy
-Java_java_lang_VMSystem_identityHashCode
EOF
# Compare again silently.
# Use fgrep and direct the output to /dev/null for compatibility with older
# grep instead of using the non portable -q.
if diff -b -U 0 $TMPFILE $TMPFILE2 | grep '^[+-]Java' | \
fgrep -v -f $TMPFILE3 > /dev/null;
then
PROBLEM=1
echo "Found a problem with the JNI methods declared and implemented."
echo "(-) missing in implementation, (+) missing in header files"
# Compare the found method lists.
diff -b -U 0 $TMPFILE $TMPFILE2 | grep '^[+-]Java' | fgrep -v -f $TMPFILE3
fi
# Cleanup.
rm -f $TMPFILE $TMPFILE2 $TMPFILE3
if test "$PROBLEM" = "1" ; then
exit 1
fi
exit 0