[Pcre-svn] [1410] code/trunk/maint/ManyConfigTests: When run…

Top Page
Delete this message
Author: Subversion repository
Date:  
To: pcre-svn
Subject: [Pcre-svn] [1410] code/trunk/maint/ManyConfigTests: When running the tests for many different configurations, add compiler warning
Revision: 1410
          http://vcs.pcre.org/viewvc?view=rev&revision=1410
Author:   ph10
Date:     2013-12-06 16:21:06 +0000 (Fri, 06 Dec 2013)


Log Message:
-----------
When running the tests for many different configurations, add compiler warning
switches when gcc is being used, and fail if any warnings are generated.

Modified Paths:
--------------
    code/trunk/maint/ManyConfigTests


Modified: code/trunk/maint/ManyConfigTests
===================================================================
--- code/trunk/maint/ManyConfigTests    2013-12-06 12:07:47 UTC (rev 1409)
+++ code/trunk/maint/ManyConfigTests    2013-12-06 16:21:06 UTC (rev 1410)
@@ -24,11 +24,31 @@
 tmp=/tmp/pcretesting


# Don't bother with compiler optimization; it just slows down compilation a lot
-# (and these tests themselves are quick).
+# (and running the tests themselves is quick).

CFLAGS="-g -O0"
+CXXFLAGS="$CFLAGS"

+# If the compiler is gcc, add a lot of warning switches.

+cc --version >zzz 2>/dev/null
+if [ $? -eq 0 ] && grep GCC zzz >/dev/null; then
+  CFLAGS="$CFLAGS -Wall"
+  CFLAGS="$CFLAGS -Wno-overlength-strings"
+  CFLAGS="$CFLAGS -Wpointer-arith"         
+  CFLAGS="$CFLAGS -Wwrite-strings"
+  CFLAGS="$CFLAGS -Wundef -Wshadow"
+  CFLAGS="$CFLAGS -Wextra -Wformat"
+  CFLAGS="$CFLAGS -Wbad-function-cast"
+  CFLAGS="$CFLAGS -Wmissing-declarations"
+  CFLAGS="$CFLAGS -Wnested-externs"
+  CFLAGS="$CFLAGS -pedantic"
+  CFLAGS="$CFLAGS -Wuninitialized"
+  CFLAGS="$CFLAGS -Wmissing-prototypes"
+  CFLAGS="$CFLAGS -Wstrict-prototypes"
+fi 
+
+
 # This function runs a single test with the set of configuration options that
 # are in $opts. The source directory must be set in srcdir.


@@ -44,7 +64,7 @@
     echo "  $opts"
   fi


-  CFLAGS="$CFLAGS" CXXFLAGS="$CFLAGS" \
+  CFLAGS="$CFLAGS" CXXFLAGS="$CXXFLAGS" \
     $srcdir/configure $opts >/dev/null 2>teststderr


if [ $? -ne 0 ]; then
@@ -56,9 +76,10 @@

   echo "Making"
   make >/dev/null 2>teststderr
-  if [ $? -ne 0 ]; then
+  if [ $? -ne 0 -o -s teststderr ]; then
     echo " "
-    echo "**** Error while making ****"
+    echo "**** Errors or warnings while making ****"
+    echo " " 
     cat teststderr
     exit 1
   fi