]> granicus.if.org Git - php/commitdiff
Drop hard-coded /W3 default in favor of custom CFLAGS
authorChristoph M. Becker <cmbecker69@gmx.de>
Wed, 27 May 2020 10:01:16 +0000 (12:01 +0200)
committerChristoph M. Becker <cmbecker69@gmx.de>
Fri, 5 Jun 2020 09:17:06 +0000 (11:17 +0200)
Building with `/W3` shows an awful lot of warnings on Windows, so it's
really hard to spot the more important ones.  Since it is not possible
to override the hard-coded `/W3`, we drop it altogether, so MSVC uses
the default `/W1`.  Users are encouraged to increase the warning level
via the environment variable `CFLAGS` before doing configure.

We also enable `/WX` (treat warnings as errors) for AppVeyor CI, using
`/W1` for now, since otherwise the build would fail.

appveyor/build_task.bat
win32/build/confutils.js

index 124968fe14ac17ad55bedb8f0dd3349e74ec490e..91fedae8553742052407eaa85b22119ead27bef4 100644 (file)
@@ -54,6 +54,8 @@ if "%INTRINSICS%" neq "" set ADD_CONF=%ADD_CONF% --enable-native-intrinsics=%INT
 set EXT_EXCLUDE_FROM_TEST=snmp,oci8_12c,pdo_oci,pdo_firebird,ldap,imap,ftp
 if "%OPCACHE%" equ "0" set EXT_EXCLUDE_FROM_TEST=%EXT_EXCLUDE_FROM_TEST%,opcache
 
+set CFLAGS=/W1 /WX
+
 cmd /c configure.bat ^
        --enable-snapshot-build ^
        --disable-debug-pack ^
index 9166cdeab6ec0bf0033add81c7102742c59833c6..9d2d578516ac9b24601b1df4bfeb0221121ebace 100644 (file)
@@ -3207,7 +3207,7 @@ function toolset_setup_common_cflags()
 
        // General CFLAGS for building objects
        DEFINE("CFLAGS", "/nologo $(BASE_INCLUDES) /D _WINDOWS /D WINDOWS=1 \
-               /D ZEND_WIN32=1 /D PHP_WIN32=1 /D WIN32 /D _MBCS /W3 \
+               /D ZEND_WIN32=1 /D PHP_WIN32=1 /D WIN32 /D _MBCS \
                /D _USE_MATH_DEFINES");
 
        if (envCFLAGS) {
@@ -3399,7 +3399,7 @@ function toolset_setup_common_libs()
 function toolset_setup_build_mode()
 {
        if (PHP_DEBUG == "yes") {
-               ADD_FLAG("CFLAGS", "/LDd /MDd /W3 /Od /D _DEBUG /D ZEND_DEBUG=1 " +
+               ADD_FLAG("CFLAGS", "/LDd /MDd /Od /D _DEBUG /D ZEND_DEBUG=1 " +
                        (X64?"/Zi":"/ZI"));
                ADD_FLAG("LDFLAGS", "/debug");
                // Avoid problems when linking to release libraries that use the release
@@ -3411,7 +3411,7 @@ function toolset_setup_build_mode()
                        ADD_FLAG("CFLAGS", "/Zi");
                        ADD_FLAG("LDFLAGS", "/incremental:no /debug /opt:ref,icf");
                }
-               ADD_FLAG("CFLAGS", "/LD /MD /W3");
+               ADD_FLAG("CFLAGS", "/LD /MD");
                if (PHP_SANITIZER == "yes" && CLANG_TOOLSET) {
                        ADD_FLAG("CFLAGS", "/Od /D NDebug /D NDEBUG /D ZEND_WIN32_NEVER_INLINE /D ZEND_DEBUG=0");
                } else {