diff options
author | Matthias Klose <doko@gcc.gnu.org> | 2008-06-28 13:29:13 +0000 |
---|---|---|
committer | Matthias Klose <doko@gcc.gnu.org> | 2008-06-28 13:29:13 +0000 |
commit | e0441a5bfb29083a532307ba2b1fd6d6d13944ba (patch) | |
tree | 602cd7aa7c947386134690d8e0f6b53abcdeacb9 /libjava/classpath/scripts/check_jni_methods.sh.in | |
parent | 15c151967dd1cde61b79d26374f608f63a29d411 (diff) | |
download | gcc-e0441a5bfb29083a532307ba2b1fd6d6d13944ba.zip gcc-e0441a5bfb29083a532307ba2b1fd6d6d13944ba.tar.gz gcc-e0441a5bfb29083a532307ba2b1fd6d6d13944ba.tar.bz2 |
Import GNU Classpath (classpath-0_97_2-release).
libjava/
2008-06-28 Matthias Klose <doko@ubuntu.com>
Import GNU Classpath (classpath-0_97_2-release).
* Regenerate class and header files.
* Regenerate auto* files.
* gcj/javaprims.h: Define jobjectRefType.
* jni.cc (_Jv_JNI_GetObjectRefType): New (stub only).
(_Jv_JNIFunctions): Initialize GetObjectRefType.
* gnu/classpath/jdwp/VMVirtualMachine.java,
java/security/VMSecureRandom.java: Merge from classpath.
* HACKING: Fix typo.
* ChangeLog-2007: New file.
* configure.ac: Set JAVAC, pass --disable-regen-headers to classpath.
libjava/classpath/
2008-06-28 Matthias Klose <doko@ubuntu.com>
* m4/ac_prog_javac.m4: Disable check for JAVAC, when
not configured with --enable-java-maintainer-mode.
* aclocal.m4, configure: Regenerate.
* native/jni/gstreamer-peer/Makefile.am: Do not link with
libclasspathnative.
* native/jni/gstreamer-peer/Makefile.in: Regenerate.
* tools/Makefile.am, lib/Makefile.am: Use JAVAC for setting
JCOMPILER, drop flags not understood by gcj.
From-SVN: r137223
Diffstat (limited to 'libjava/classpath/scripts/check_jni_methods.sh.in')
-rw-r--r-- | libjava/classpath/scripts/check_jni_methods.sh.in | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/libjava/classpath/scripts/check_jni_methods.sh.in b/libjava/classpath/scripts/check_jni_methods.sh.in new file mode 100644 index 0000000..2a114d3 --- /dev/null +++ b/libjava/classpath/scripts/check_jni_methods.sh.in @@ -0,0 +1,61 @@ +#!/bin/sh + +# Fail if any command fails +set -e + +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_' @abs_top_builddir@/include/*.h @abs_top_srcdir@/include/*.h | \ + LC_ALL=C sed -e 's,.*JNICALL \(Java_[a-z_A-Z0-9]*\).*$,\1,' | \ + sort -u > $TMPFILE + +# Find all methods in the JNI C source files. +find @abs_top_srcdir@/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 @abs_top_srcdir@/native/jni -name \*.cpp | \ + xargs grep -h '^Java_' | \ + LC_ALL=C sed -e 's,^\(Java_[a-z_A-Z0-9]*\).*$,\1,' >> $TMPFILE2 +find @abs_top_srcdir@/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 | uniq > $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 -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 -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 |