]> granicus.if.org Git - php/commitdiff
Enable -Werror in CI
authorNikita Popov <nikita.ppv@gmail.com>
Tue, 23 Apr 2019 11:24:29 +0000 (13:24 +0200)
committerNikita Popov <nikita.ppv@gmail.com>
Fri, 26 Apr 2019 07:56:16 +0000 (09:56 +0200)
Add --enable-werror configure option and use it on Travis. It's not
possible to directly use CFLAGS, because it also affects configure
checks which often throw warnings.

We can't enable something similar for Windows builds at this time,
because they throw a lot more warnings.

configure.ac
travis/compile.sh

index b1e9becfd9a81c5d1febc6472ea1d47e814c15ea..8f15c1a446f6c6e45ff3d138bdfd02ee0c684e45 100644 (file)
@@ -1089,6 +1089,12 @@ else
   AC_MSG_RESULT([using system default])
 fi
 
+PHP_ARG_ENABLE([werror],,
+  [AS_HELP_STRING([--enable-werror],
+    [Enable -Werror])],
+  [no],
+  [no])
+
 dnl Extension configuration.
 dnl -------------------------------------------------------------------------
 
@@ -1461,6 +1467,11 @@ if test "$PHP_THREAD_SAFETY" = "yes" && test "$PHP_MYSQL" = "yes"; then
   CPPFLAGS="$CPPFLAGS -DTHREAD=1"
 fi
 
+if test "$PHP_WERROR" = "yes"; then
+  CFLAGS="$CFLAGS -Werror"
+  CPPFLAGS="$CPPFLAGS -Werror"
+fi
+
 ZEND_EXT_TYPE="zend_extension"
 PHP_SUBST(ZEND_EXT_TYPE)
 
index 65c11ff3788a8699b8a6df6eaafc029c71b769b8..0884eb36cf54e6ce987337d8cd8965af1f62fab4 100755 (executable)
@@ -74,6 +74,7 @@ $TS \
 --with-kerberos \
 --enable-sysvmsg \
 --enable-zend-test=shared \
+--enable-werror \
 > "$CONFIG_LOG_FILE"
 
 make "-j${MAKE_JOBS}" $MAKE_QUIET > "$MAKE_LOG_FILE"