-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
cmake: enable -Wall
for MSVC when PICKY_COMPILER=ON
#17050
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
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
-Wall
-Wall
for MSVC when PICKY_COMPILER=ON
In my experience, keeping code
We can opt out our own CI, but we cannot do that for all our users. Might a CI job setting these flags manually be an alternative? |
It's a downside, I agree.
It is, or, it's also an option to limit it to the latest CI-tested MSVC version I'd prefer the latter, because this may rather help someone contributing Though the effect may be limited or perhaps overkill and nobody asked |
Limiting this to a certain MSVC version makes sense to me too! Only keep in mind that new warnings come in minor versions, so we would need to use e.g. Visual Studio 2022 update 14 instead of just Visual Studio 2022. |
Pushed a commit that draws the limit at What do you think? Footnotes |
They did not find any new issue. It might still be useful to enable it so that MSVC has a better change to find issue we normally see with clang/gcc first. Downside is that newer MSVC versions extend the `-Wall` warning list with new ones, which we may need to fix or opt-out from on upgrade. Also: - disable and document warnings that don't seem useful, unactionable, or unfixable. - disable and document warnings found in Windows SDK headers. - silence a nit found by clang-cl with `-Wall` in comments. ``` lib\dynhds.h(159,29): error : unknown command tag name [-Werror,-Wdocumentation-unknown-command] ``` (This patch did not end up enabling `-Wall` for clang-cl.) Closes curl#17050
@@ -156,14 +156,14 @@ CURLcode Curl_dynhds_cadd(struct dynhds *dynhds, | |||
|
|||
/** | |||
* Add a single header from an HTTP/1.1 formatted line at the end. Line | |||
* may contain a delimiting \r\n or just \n. Any characters after | |||
* may contain a delimiting CRLF or just LF. Any characters after |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would nominate this as one of the most stupid compiler warnings in recent days.
Does it perhaps also go away if the /**
comment start is converted into a plain /*
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This wasn't the only one, it was catching email addresses in the copyright
header too, but curiously only a couple. It's not an MSVC warning, but an
llvm/clang one: -Wdocumentation-unknown-command
.
The only reason I bothered fixing this one because other comments around
here prefer the CR/LF terminology. (Though the casing is still inconsistent.)
Yes, changing /**
to /*
also silences it. Weird.
lib/bufref.h:10:42: error: unknown command tag name [-Werror,-Wdocumentation-unknown-command]
* Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
^~~~~
In file included from lib/altsvc.c:32:
In file included from lib/vssh/../urldata.h:193:
lib/smb.h:10:36: error: unknown command tag name [-Werror,-Wdocumentation-unknown-command]
* Copyright (C) Bill Nagel <wnagel@tycoint.com>, Exacq Technologies
^~~~~~~~
lib/ftp.c:337:15: error: unknown command tag name [-Werror,-Wdocumentation-unknown-command]
* ending in '\r\n' and we prefer just '\n'.
^~
lib/ftp.c:337:17: error: unknown command tag name [-Werror,-Wdocumentation-unknown-command]
* ending in '\r\n' and we prefer just '\n'.
^~
4 errors generated.
edit: silenced the ftp.c
one too by dropping the ***
decoration used
in that particular comment.
warning C4061: enumerator 'CURLUE_BAD_SCHEME' in switch of enum 'CURLUcode' is not explicitly handled by a case label warning C4464: relative include path contains '..' warning C4820: 'ossl_ctx': '2' bytes padding added after data member 'reused_session'
warning C4191: 'type cast': unsafe conversion from 'FARPROC' to 'void (__cdecl *)(void)'
warning C4711: function 'curl_dbg_malloc' selected for automatic inline expansion
memdebug.c(472,1): warning C5045: Compiler will insert Spectre mitigation for memory load if /Qspectre switch specified
lib\mprintf.c(998,34): warning C4774: 'snprintf' : format string expected in argument 3 is not a string literal
warning C4710: 'snprintf': function not inlined
lib/cshutdn.c(518): warning C4548: expression before comma has no effect; expected expression with side-effect lib/cshutdn.c(520): warning C4548: expression before comma has no effect; expected expression with side-effect lib/multi.c(1037): warning C4548: expression before comma has no effect; expected expression with side-effect lib/multi.c(1039): warning C4548: expression before comma has no effect; expected expression with side-effect lib/select.c(347): warning C4548: expression before comma has no effect; expected expression with side-effect lib/select.c(349): warning C4548: expression before comma has no effect; expected expression with side-effect lib/select.c(351): warning C4548: expression before comma has no effect; expected expression with side-effect
C:\Program Files (x86)\Windows Kits\10\Include\10.0.14393.0\um\winuser.h(13979): warning C4255: 'GetThreadDpiAwarenessContext': no function prototype given: converting '()' to '(void)' C:\Program Files (x86)\Windows Kits\10\Include\10.0.14393.0\um\winuser.h(14015): warning C4255: 'GetDpiForSystem': no function prototype given: converting '()' to '(void)'
C:\Program Files (x86)\Windows Kits\8.1\Include\um\winbase.h(8618): warning C4668: 'NTDDI_WIN7SP1' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif' [C:\projects\curl\_bld\lib\libcurl_object.vcxproj] C:\Program Files (x86)\Windows Kits\8.1\Include\um\ws2tcpip.h(456): warning C4574: 'INCL_WINSOCK_API_TYPEDEFS' is defined to be '0': did you mean to use '#if INCL_WINSOCK_API_TYPEDEFS'? [C:\projects\curl\_bld\lib\libcurl_object.vcxproj]
cl : Command line warning D9014: invalid value '5045' for '/wd'; assuming '4999'
C:/projects/curl/lib/mprintf.c(995): warning C4619: #pragma warning : there is no warning number '4774' [C:\projects\curl\_bld\lib\libcurl_object.vcxproj]
seen with VS2022 ARM64: ``` lib\setopt.c(1582,1): warning C4746: volatile access of '<expression>' is subject to /volatile:<iso|ms> setting; consider using __iso_volatile_load/store intrinsic functions lib\setopt.c(1582,1): warning C4746: volatile access of '<expression>' is subject to /volatile:<iso|ms> setting; consider using __iso_volatile_load/store intrinsic functions lib\setopt.c(1595,1): warning C4746: volatile access of '<expression>' is subject to /volatile:<iso|ms> setting; consider using __iso_volatile_load/store intrinsic functions lib\setopt.c(1595,1): warning C4746: volatile access of '<expression>' is subject to /volatile:<iso|ms> setting; consider using __iso_volatile_load/store intrinsic functions lib\share.c(80,1): warning C4746: volatile access of '<expression>' is subject to /volatile:<iso|ms> setting; consider using __iso_volatile_load/store intrinsic functions lib\url.c(302,1): warning C4746: volatile access of '<expression>' is subject to /volatile:<iso|ms> setting; consider using __iso_volatile_load/store intrinsic functions lib\url.c(302,1): warning C4746: volatile access of '<expression>' is subject to /volatile:<iso|ms> setting; consider using __iso_volatile_load/store intrinsic functions lib\share.c(241,1): warning C4746: volatile access of '<expression>' is subject to /volatile:<iso|ms> setting; consider using __iso_volatile_load/store intrinsic functions ```
This reverts commit 0a870d1.
``` lib\dynhds.h(159,29): error : unknown command tag name [-Werror,-Wdocumentation-unknown-command] ```
Enable it for `_MSC_VER <= 1943`. Omit it for not yet CI-tested MSVC versions, to avoid hitting unfixed warnings emitted by future toolchain releases. It means we need to explicitly opt-in to newer MSVC versions while fixing any new issues. The newly enabled warnings did not reveal new issues. It hints that we catch those with clang/gcc. Yet, these warnings may be useful for local development done with MSVC. Also: - disable and document warnings that don't seem useful, unactionable, or unfixable. - disable and document warnings found in Windows SDK headers. - tidy up a few comments, also to avoid `-Wdocumentation-unknown-command`, part of llvm/clang `-Wall`. ``` lib\dynhds.h(159,29): error : unknown command tag name [-Werror,-Wdocumentation-unknown-command] lib\ftp.c(337,15): error : unknown command tag name [-Werror,-Wdocumentation-unknown-command] ``` (This patch did not end up enabling `-Wall` for clang-cl.) Closes curl#17050
Enable it for `_MSC_VER <= 1943`. Omit it for not yet CI-tested MSVC versions, to avoid hitting unfixed warnings emitted by future toolchain releases. It means we need to explicitly opt-in to newer MSVC versions while fixing any new issues. The newly enabled warnings did not reveal new issues. It hints that we catch those with clang/gcc. Yet, these warnings may be useful for local development done with MSVC. Also: - disable and document warnings that don't seem useful, unactionable, or unfixable. - disable and document warnings found in Windows SDK headers. - tidy up a few comments, also to avoid `-Wdocumentation-unknown-command`, part of llvm/clang `-Wall`. ``` lib\dynhds.h(159,29): error : unknown command tag name [-Werror,-Wdocumentation-unknown-command] lib\ftp.c(337,15): error : unknown command tag name [-Werror,-Wdocumentation-unknown-command] ``` (This patch did not end up enabling `-Wall` for clang-cl.) Closes curl#17050
Enable it for
_MSC_VER <= 1943
.Omit it for not yet CI-tested MSVC versions, to avoid hitting unfixed
warnings emitted by future toolchain releases. It means we need
to explicitly opt-in to newer MSVC versions while fixing any new issues.
The newly enabled warnings did not reveal new issues. It hints that we
catch those with clang/gcc. Yet, these warnings may be useful for local
development done with MSVC.
Also:
or unfixable.
-Wdocumentation-unknown-command
, part of llvm/clang-Wall
.-Wall
for clang-cl.)