GCC's classpath/scripts/check_jni_methods.sh vs diff -b

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



diff -b doesn't completely ignore all whitespace, but rather only
differences as to the amount of whitespace; so whether whitespace is
present or not is regarded as a difference.

However, check_jni_methods.sh expects it to ignore a single trailing
blank vs no trailing whitespace whatsoever.  diff -B does, but I don't
think that's portable enough for us to use it.

So I've changed the regular expressions such that they'd be more
inclusive, instead of demanding and discarding whitespace before open
parentheses, and removed the -b then rendered unnecessary.

Without this patch, I couldn't build libjava on the development tree
that will eventually turn into Fedora 8, but it built on Fedora 7 just
fine.

Unless someone tells me not to, I'm going to check this into GCC trunk
tomorrow or so.  Bootstrapped on x86_64-linux-gnu.

Index: libjava/classpath/ChangeLog
from  Alexandre Oliva  <aoliva@xxxxxxxxxx>

	* scripts/check_jni_methods.sh: Don't depend on diff -b ignoring
	a single trailing whitespace.

Index: libjava/classpath/scripts/check_jni_methods.sh
===================================================================
--- libjava/classpath/scripts/check_jni_methods.sh.orig	2007-10-01 15:24:36.000000000 -0300
+++ libjava/classpath/scripts/check_jni_methods.sh	2007-10-01 15:28:27.000000000 -0300
@@ -16,16 +16,16 @@ grep -h '^JNIEXPORT .* Java_' include/*.
 # 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
+        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
+        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
+        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
@@ -40,7 +40,7 @@ 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' | \
+if diff -U 0 $TMPFILE $TMPFILE2 | grep '^[+-]Java' | \
     fgrep -v -f $TMPFILE3 > /dev/null;
 then
   PROBLEM=1
@@ -48,7 +48,7 @@ then
   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
+  diff -U 0 $TMPFILE $TMPFILE2  | grep '^[+-]Java' | fgrep -v -f $TMPFILE3
 fi
 
 # Cleanup.
-- 
Alexandre Oliva         http://www.lsd.ic.unicamp.br/~oliva/
FSF Latin America Board Member         http://www.fsfla.org/
Red Hat Compiler Engineer   aoliva@{redhat.com, gcc.gnu.org}
Free Software Evangelist  oliva@{lsd.ic.unicamp.br, gnu.org}

[Index of Archives]     [Linux Kernel]     [Linux Cryptography]     [Fedora]     [Fedora Directory]     [Red Hat Development]

  Powered by Linux