OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libjava/] [classpath/] [scripts/] [check_jni_methods.sh.in] - Blame information for rev 777

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 777 jeremybenn
#!/bin/sh
2
 
3
# Fail if any command fails
4
set -e
5
 
6
TMPFILE=/tmp/check-jni-methods.$$.1
7
TMPFILE2=/tmp/check-jni-methods.$$.2
8
TMPFILE3=/tmp/check-jni-methods.$$.3
9
TMPFILE4=/tmp/check-jni-methods.$$.4
10
 
11
# Find all methods defined in the header files generated
12
# from the java source files.
13
grep -h '^JNIEXPORT .* Java_' @abs_top_srcdir@/include/*.h | \
14
        LC_ALL=C sed -e 's,.*JNICALL \(Java_[a-z_A-Z0-9]*\).*$,\1,' > $TMPFILE
15
grep -h '^JNIEXPORT .* Java_' @abs_top_builddir@/include/*.h | \
16
        LC_ALL=C sed -e 's,.*JNICALL \(Java_[a-z_A-Z0-9]*\).*$,\1,' >> $TMPFILE
17
sort -u $TMPFILE > $TMPFILE4
18
mv $TMPFILE4 $TMPFILE
19
 
20
# Find all methods in the JNI C source files.
21
find @abs_top_srcdir@/native/jni -name \*.c | \
22
        xargs grep -h '^Java_' | \
23
        LC_ALL=C sed -e 's,^\(Java_[a-z_A-Z0-9]*\).*$,\1,' > $TMPFILE2
24
# Or in the the C++ files. (Note that cpp doesn't follow gnu conventions atm)
25
# So we try to match both GNU style and some other style.
26
find @abs_top_srcdir@/native/jni -name \*.cpp | \
27
        xargs grep -h '^Java_' | \
28
        LC_ALL=C sed -e 's,^\(Java_[a-z_A-Z0-9]*\).*$,\1,' >> $TMPFILE2
29
find @abs_top_srcdir@/native/jni -name \*.cpp | \
30
        xargs egrep -h '^(JNIEXPORT .* JNICALL )?Java_' | \
31
        cut -f4 -d\  | \
32
        LC_ALL=C sed -e 's,^\JNIEXPORT .* JNICALL \(Java_[a-z_A-Z0-9]*\).*$,\1,' >> $TMPFILE2
33
mv $TMPFILE2 $TMPFILE3
34
sort $TMPFILE3 | uniq > $TMPFILE2
35
rm $TMPFILE3
36
 
37
# Write temporary ignore file.
38
cat > $TMPFILE3 << EOF
39
< Java_gnu_java_awt_peer_gtk_GtkMenuComponentPeer_dispose
40
< Java_java_lang_VMSystem_arraycopy
41
< Java_java_lang_VMSystem_identityHashCode
42
EOF
43
 
44
# Compare again silently.
45
# Use fgrep and direct the output to /dev/null for compatibility with older
46
# grep instead of using the non portable -q.
47
if diff $TMPFILE $TMPFILE2 | grep '^[<>] Java' | \
48
    fgrep -v -f $TMPFILE3 > /dev/null;
49
then
50
  PROBLEM=1
51
  echo "Found a problem with the JNI methods declared and implemented."
52
  echo "(<) missing in implementation, (>) missing in header files"
53
 
54
  # Compare the found method lists.
55
  diff $TMPFILE $TMPFILE2  | grep '^[<>] Java' | fgrep -v -f $TMPFILE3
56
fi
57
 
58
# Cleanup.
59
rm -f $TMPFILE $TMPFILE2 $TMPFILE3
60
 
61
if test "$PROBLEM" = "1" ; then
62
  exit 1
63
fi
64
 
65
exit 0

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.