diff options
author | Mark Wielaard <mark@klomp.org> | 2005-08-17 10:15:51 +0000 |
---|---|---|
committer | Mark Wielaard <mark@klomp.org> | 2005-08-17 10:15:51 +0000 |
commit | dcfd3c4c923e6cdb8f9e5a857a6fa4b99eb9abc8 (patch) | |
tree | 47ba10f77525969037a6a1c47367f1d9ec3005af /scripts | |
parent | a0e17f1a086fcabd000a84dbaaa0b221aa281680 (diff) | |
download | classpath-dcfd3c4c923e6cdb8f9e5a857a6fa4b99eb9abc8.tar.gz |
* scripts/check_jni_methods.sh: Find JNI method declarations in
.cpp files. Check both GNU style functions (start of line) and
one-line like declarations. Use diff -U 0, not -0.
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/check_jni_methods.sh | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/scripts/check_jni_methods.sh b/scripts/check_jni_methods.sh index ff7754bb7..78f29adf2 100755 --- a/scripts/check_jni_methods.sh +++ b/scripts/check_jni_methods.sh @@ -18,8 +18,19 @@ grep -h '^JNIEXPORT .* Java_' include/*.h | \ # 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,' | \ - sort > $TMPFILE2 + 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 @@ -29,14 +40,14 @@ cat > $TMPFILE3 << EOF EOF # Compare again silently. -if diff -ub -0 $TMPFILE $TMPFILE2 | grep '^[+-]Java' | grep -q -v -f $TMPFILE3; +if diff -b -U 0 $TMPFILE $TMPFILE2 | grep '^[+-]Java' | grep -q -v -f $TMPFILE3; 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 -ub -0 $TMPFILE $TMPFILE2 | grep '^[+-]Java' | grep -v -f $TMPFILE3 + diff -b -U 0 $TMPFILE $TMPFILE2 | grep '^[+-]Java' | grep -v -f $TMPFILE3 fi # Cleanup. |