Skip to content

Fix compile for Windows x86 with /W1 /WX options (warnings are fatal) #8479

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions .github/scripts/windows/build_task.bat
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,10 @@ if %errorlevel% neq 0 exit /b 3
if "%THREAD_SAFE%" equ "0" set ADD_CONF=%ADD_CONF% --disable-zts
if "%INTRINSICS%" neq "" set ADD_CONF=%ADD_CONF% --enable-native-intrinsics=%INTRINSICS%

rem Some undefined behavior is reported on 32-bit, this should be fixed
if "%PLATFORM%" == "x86" (
set CFLAGS=/W1
) else (
set CFLAGS=/W1 /WX
)
set CFLAGS=/W1 /WX

patch --binary %DEPS_DIR%\include\net-snmp\net-snmp-config.h -i %~dp0net-snmp-config.h.patch.bin
if %errorlevel% neq 0 exit /b 3

cmd /c configure.bat ^
--enable-snapshot-build ^
Expand Down
14 changes: 14 additions & 0 deletions .github/scripts/windows/net-snmp-config.h.patch.bin
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
--- net-snmp-config.h 2019-07-01 13:04:57.401354900 +0200
+++ net-snmp-config.h 2022-05-04 11:52:42.229867900 +0200
@@ -1365,9 +1365,9 @@
# define HAVE_SSIZE_T
#elif defined(_MSC_VER)
# ifdef _M_X64
-typedef __int64 ssize_t;
+// prevent redefine warning typedef __int64 ssize_t;
# else
-typedef __int32 ssize_t;
+// prevent redefine warning typedef __int32 ssize_t;
# endif
#endif

20 changes: 15 additions & 5 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -239,19 +239,29 @@ jobs:
uses: ./.github/actions/verify-generated-files
WINDOWS:
if: github.repository == 'php/php-src' || github.event_name == 'pull_request'
name: WINDOWS_X64_ZTS
strategy:
fail-fast: false
matrix:
include:
- x64: true
zts: false
opcache: true
- x64: false
zts: true
opcache: false
name: "WINDOWS_${{ matrix.x64 && 'X64' || 'X86' }}_${{ matrix.zts && 'ZTS' || 'NTS' }}"
runs-on: windows-2019
env:
PHP_BUILD_CACHE_BASE_DIR: C:\build-cache
PHP_BUILD_OBJ_DIR: C:\obj
PHP_BUILD_CACHE_SDK_DIR: C:\build-cache\sdk
PHP_BUILD_SDK_BRANCH: php_downloads_server_migration_v1
PHP_BUILD_CRT: vs16
PLATFORM: x64
THREAD_SAFE: "1"
INTRINSICS: AVX2
PLATFORM: ${{ matrix.x64 && 'x64' || 'x86' }}
THREAD_SAFE: "${{ matrix.zts && '1' || '0' }}"
INTRINSICS: "${{ matrix.zts && 'AVX2' || '' }}"
PARALLEL: -j2
OPCACHE: "1"
OPCACHE: "${{ matrix.opcache && '1' || '0' }}"
steps:
- name: git config
run: git config --global core.autocrlf false && git config --global core.eol lf
Expand Down
Loading