Elevate Windows CI to /W3 (sans C4018/C4267)#17665
Conversation
C4018[1] is about unsigned/signed comparisons; C4267[2] is about conversion from `size_t` to a "smaller" type. We likely should resolve these warnings in the long run, but for now, it seems like a no brainer to elevate to `/W3` even if we have to exempt two additional categories of warnings, since we can catch some others. And we no longer need to elevate C4010[3] to a higher level to catch it. [1] <https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-3-c4018> [2] <https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-3-c4267> [3] <https://learn.microsoft.com/de-de/cpp/error-messages/compiler-warnings/compiler-warning-level-3-c4013>
| if "%ASAN%" equ "1" set ADD_CONF=%ADD_CONF% --enable-sanitizer --enable-debug-pack | ||
|
|
||
| set CFLAGS=/W2 /WX /w14013 /wd4146 /wd4244 | ||
| set CFLAGS=/W3 /WX /wd4018 /wd4146 /wd4244 /wd4267 |
There was a problem hiding this comment.
short comments above what these "numbers" are would greatly improve the readability
There was a problem hiding this comment.
Done. But I'm not 100% sure that makes much sense. One still needs to know what /W3 implies, and as such might need to look up the warnings "all the time". In my opinion, gcc and clang handle this much better.
|
Do you have a list for the cases that trigger |
After applying win32/ioutil.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/win32/ioutil.h b/win32/ioutil.h
index 8b9ed491ff..83c9b397f9 100644
--- a/win32/ioutil.h
+++ b/win32/ioutil.h
@@ -227,7 +227,7 @@ zend_always_inline static wchar_t *php_win32_ioutil_conv_any_to_w(const char* in
memcpy(ret, PHP_WIN32_IOUTIL_LONG_PATH_PREFIXW, PHP_WIN32_IOUTIL_LONG_PATH_PREFIX_LENW * sizeof(wchar_t));
#ifndef ZTS
if (dir_len > 0) {
- size_t len = GetCurrentDirectoryW(dir_len, dst);
+ size_t len = GetCurrentDirectoryW((DWORD) dir_len, dst);
if (len == 0 || len + 1 != dir_len) {
free(ret);
free(mb);the list is "managable": C4267 warnings (x64)
Understandable. There are sooo many issues. |
C4018[1] is about unsigned/signed comparisons; C4267[2] is about conversion from
size_tto a "smaller" type. We likely should resolve these warnings in the long run, but for now, it seems like a no brainer to elevate to/W3even if we have to exempt two additional categories of warnings, since we can catch some others. And we no longer need to elevate C4010[3] to a higher level to catch it.[1] https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-3-c4018
[2] https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-3-c4267
[3] https://learn.microsoft.com/de-de/cpp/error-messages/compiler-warnings/compiler-warning-level-3-c4013