Skip to content

Commit 3a031e0

Browse files
committed
Drop hard-coded /W3 default in favor of custom CFLAGS
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.
1 parent 5a04796 commit 3a031e0

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

appveyor/build_task.bat

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ if "%INTRINSICS%" neq "" set ADD_CONF=%ADD_CONF% --enable-native-intrinsics=%INT
5454
set EXT_EXCLUDE_FROM_TEST=snmp,oci8_12c,pdo_oci,pdo_firebird,ldap,imap,ftp
5555
if "%OPCACHE%" equ "0" set EXT_EXCLUDE_FROM_TEST=%EXT_EXCLUDE_FROM_TEST%,opcache
5656

57+
set CFLAGS=/W1 /WX
58+
5759
cmd /c configure.bat ^
5860
--enable-snapshot-build ^
5961
--disable-debug-pack ^

win32/build/confutils.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3207,7 +3207,7 @@ function toolset_setup_common_cflags()
32073207

32083208
// General CFLAGS for building objects
32093209
DEFINE("CFLAGS", "/nologo $(BASE_INCLUDES) /D _WINDOWS /D WINDOWS=1 \
3210-
/D ZEND_WIN32=1 /D PHP_WIN32=1 /D WIN32 /D _MBCS /W3 \
3210+
/D ZEND_WIN32=1 /D PHP_WIN32=1 /D WIN32 /D _MBCS \
32113211
/D _USE_MATH_DEFINES");
32123212

32133213
if (envCFLAGS) {
@@ -3399,7 +3399,7 @@ function toolset_setup_common_libs()
33993399
function toolset_setup_build_mode()
34003400
{
34013401
if (PHP_DEBUG == "yes") {
3402-
ADD_FLAG("CFLAGS", "/LDd /MDd /W3 /Od /D _DEBUG /D ZEND_DEBUG=1 " +
3402+
ADD_FLAG("CFLAGS", "/LDd /MDd /Od /D _DEBUG /D ZEND_DEBUG=1 " +
34033403
(X64?"/Zi":"/ZI"));
34043404
ADD_FLAG("LDFLAGS", "/debug");
34053405
// Avoid problems when linking to release libraries that use the release
@@ -3411,7 +3411,7 @@ function toolset_setup_build_mode()
34113411
ADD_FLAG("CFLAGS", "/Zi");
34123412
ADD_FLAG("LDFLAGS", "/incremental:no /debug /opt:ref,icf");
34133413
}
3414-
ADD_FLAG("CFLAGS", "/LD /MD /W3");
3414+
ADD_FLAG("CFLAGS", "/LD /MD");
34153415
if (PHP_SANITIZER == "yes" && CLANG_TOOLSET) {
34163416
ADD_FLAG("CFLAGS", "/Od /D NDebug /D NDEBUG /D ZEND_WIN32_NEVER_INLINE /D ZEND_DEBUG=0");
34173417
} else {

0 commit comments

Comments
 (0)