]> git.ipfire.org Git - thirdparty/curl.git/commit
build: Disable Visual Studio warning "conditional expression is constant"
authorJay Satiro <raysatiro@yahoo.com>
Sat, 30 Nov 2019 08:29:36 +0000 (03:29 -0500)
committerJay Satiro <raysatiro@yahoo.com>
Mon, 2 Dec 2019 00:01:02 +0000 (19:01 -0500)
commit9c1806ae4684ec5ef1aeb39bb9f15cece1c27256
tree519c34c7411ae2afda27b38500f77d456bb8cad9
parent0436d4438a9dbfd5dc1364de31281505c7915b25
build: Disable Visual Studio warning "conditional expression is constant"

- Disable warning C4127 "conditional expression is constant" globally
  in curl_setup.h for when building with Microsoft's compiler.

This mainly affects building with the Visual Studio project files found
in the projects dir.

Prior to this change the cmake and winbuild build systems already
disabled 4127 globally for when building with Microsoft's compiler.
Also, 4127 was already disabled for all build systems in the limited
circumstance of the WHILE_FALSE macro which disabled the warning
specifically for while(0). This commit removes the WHILE_FALSE macro and
all other cruft in favor of disabling globally in curl_setup.

Background:

We have various macros that cause 0 or 1 to be evaluated, which would
cause warning C4127 in Visual Studio. For example this causes it:

    #define Curl_resolver_asynch() 1

Full behavior is not clearly defined and inconsistent across versions.
However it is documented that since VS 2015 Update 3 Microsoft has
addressed this somewhat but not entirely, not warning on while(true) for
example.

Prior to this change some C4127 warnings occurred when I built with
Visual Studio using the generated projects in the projects dir.

Closes https://github.com/curl/curl/pull/4658
32 files changed:
lib/CMakeLists.txt
lib/cookie.c
lib/curl_multibyte.h
lib/curl_setup.h
lib/curl_setup_once.h
lib/doh.c
lib/http2.c
lib/ldap.c
lib/memdebug.h
lib/mprintf.c
lib/select.h
lib/sendf.c
lib/sha256.c
lib/telnet.c
lib/transfer.c
lib/url.c
lib/vquic/ngtcp2.c
lib/vquic/quiche.c
lib/vssh/libssh.c
lib/vtls/nss.c
lib/vtls/openssl.c
src/tool_doswin.c
src/tool_easysrc.c
src/tool_getparam.c
src/tool_metalink.c
src/tool_setopt.c
src/tool_setopt.h
tests/libtest/CMakeLists.txt
tests/libtest/test.h
tests/server/CMakeLists.txt
tests/unit/curlcheck.h
winbuild/MakefileBuild.vc