Skip to content

Commit d5c4522

Browse files
committed
Use new MSVC preprocessor for VS 17 builds
From the documentation[1]: | We're updating the Microsoft C++ preprocessor to improve standards | conformance, fix longstanding bugs, and change some behaviors that | are officially undefined. We've also added new diagnostics to warn | on errors in macro definitions. Thus it appears to be sensible to switch to the new preprocessor for all VS17 builds. Note that although the new preprocessor is available as of VS16.5 (i.e. `version >= 1925`), we don't want to potentially break older builds, and as such use the new preprocessor only for VS17 builds. Users who wish to use the new preprocessor with VS16, can still `set CFLAGS=/Zc:preprocessor` before running `buildconf`/`phpize`. [1] <https://learn.microsoft.com/en-us/cpp/preprocessor/preprocessor-experimental-overview?view=msvc-170> Closes GH-15201.
1 parent 9c4aa2b commit d5c4522

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

UPGRADING.INTERNALS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ PHP 8.4 INTERNALS UPGRADE NOTES
224224
the openssl extension is available either as shared or built statically.
225225
- Added configure option --enable-phpdbg-debug to build phpdbg in debug mode.
226226
- The win32/build/libs_version.txt file has been removed.
227+
- MSVC builds now use the new preprocessor (/Zc:preprocessor).
227228

228229
========================
229230
3. Module changes

win32/build/confutils.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3313,6 +3313,10 @@ function toolset_setup_common_cflags()
33133313
ADD_FLAG("CFLAGS", "/d2FuncCache1");
33143314
}
33153315

3316+
if (VCVERS >= 1930) {
3317+
ADD_FLAG("CFLAGS", "/Zc:preprocessor");
3318+
}
3319+
33163320
ADD_FLAG("CFLAGS", "/Zc:wchar_t");
33173321
} else if (CLANG_TOOLSET) {
33183322
if (TARGET_ARCH == 'x86') {

0 commit comments

Comments
 (0)