This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[build, classpath] Avoid unportable diff -u/-U


I've recently tried to bootstrap various branches and mainline with only
the vendor tools and the minimal set of additions on Solaris 8 and 9.
While doing so, I ran into two uses of diff -u/-U, one of which broke
the build.  The -u/-U option is an unportable GNU extension and
unnecessary in the cases at hand, so I'm proposing the following patch
to fix this bootstrap problem.

There's a third instance of diff -u in contrib/compare-all-tests, but
I've never used that file, the output seems to be for human consumption
(where I prefer diff -u every day), and uses the even more unportable -L
option (I didn't even know about that one), so I'm leaving it alone.

Bootstrapped on i386-pc-solaris2.11 on mainline, 4.4 and 4.5 branches.

Ok for all three?

	Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University


2010-05-23  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	libjava/classpath:
	* scripts/check_jni_methods.sh.in: Don't use diff -U.
	Adapt grep regex, ignore file and problem message.

	contrib:
	* test_summary: Don't use diff -u.
	Adapt egrep regex.

diff -r 1a330deef563 contrib/test_summary
--- a/contrib/test_summary	Sun May 23 11:42:10 2010 +0200
+++ b/contrib/test_summary	Mon May 24 17:26:09 2010 +0200
@@ -1,6 +1,6 @@
 #! /bin/sh
 
-# (C) 1998, 1999, 2000, 2002, 2003, 2004, 2007, 2009
+# (C) 1998, 1999, 2000, 2002, 2003, 2004, 2007, 2009, 2010
 # Free Software Foundation
 # Originally by Alexandre Oliva <oliva@dcc.unicamp.br>
 
@@ -75,9 +75,9 @@
     [ -f $file ] &&
     anyfile=true &&
     { $anychange ||
-      anychange=`diff -u $file.sent $file 2>/dev/null |
+      anychange=`diff $file.sent $file 2>/dev/null |
 	if test ! -f $file.sent ||
-	   egrep '^[-+](XPASS|FAIL)' >/dev/null; then
+	   egrep '^[<>] (XPASS|FAIL)' >/dev/null; then
 	    echo true
 	else
 	    echo false
diff -r 1a330deef563 libjava/classpath/scripts/check_jni_methods.sh.in
--- a/libjava/classpath/scripts/check_jni_methods.sh.in	Sun May 23 11:42:10 2010 +0200
+++ b/libjava/classpath/scripts/check_jni_methods.sh.in	Mon May 24 17:26:09 2010 +0200
@@ -36,29 +36,29 @@
 
 # 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
+< 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' | \
+if diff $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"
+  echo "(<) missing in implementation, (>) missing in header files"
 
   # Compare the found method lists.
-  diff -U 0 $TMPFILE $TMPFILE2  | grep '^[+-]Java' | fgrep -v -f $TMPFILE3
+  diff $TMPFILE $TMPFILE2  | grep '^[<>] Java' | fgrep -v -f $TMPFILE3
 fi
 
 # Cleanup.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]