diff options
author | Jay Satiro <raysatiro@yahoo.com> | 2019-11-30 03:29:36 -0500 |
---|---|---|
committer | Jay Satiro <raysatiro@yahoo.com> | 2019-12-01 19:01:02 -0500 |
commit | 9c1806ae4684ec5ef1aeb39bb9f15cece1c27256 (patch) | |
tree | 519c34c7411ae2afda27b38500f77d456bb8cad9 /lib/vtls | |
parent | 0436d4438a9dbfd5dc1364de31281505c7915b25 (diff) |
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
Diffstat (limited to 'lib/vtls')
-rw-r--r-- | lib/vtls/nss.c | 2 | ||||
-rw-r--r-- | lib/vtls/openssl.c | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/lib/vtls/nss.c b/lib/vtls/nss.c index a375f00da..ef51b0d91 100644 --- a/lib/vtls/nss.c +++ b/lib/vtls/nss.c @@ -113,7 +113,7 @@ typedef struct { ptr->type = (_type); \ ptr->pValue = (_val); \ ptr->ulValueLen = (_len); \ -} WHILE_FALSE +} while(0) #define CERT_NewTempCertificate __CERT_NewTempCertificate diff --git a/lib/vtls/openssl.c b/lib/vtls/openssl.c index 32d0e449e..7c6854d1f 100644 --- a/lib/vtls/openssl.c +++ b/lib/vtls/openssl.c @@ -3077,7 +3077,7 @@ do { \ Curl_ssl_push_certinfo_len(data, _num, _label, ptr, info_len); \ if(1 != BIO_reset(mem)) \ break; \ -} WHILE_FALSE +} while(0) static void pubkey_show(struct Curl_easy *data, BIO *mem, @@ -3109,7 +3109,7 @@ do { \ if(_type->_name) { \ pubkey_show(data, mem, _num, #_type, #_name, _type->_name); \ } \ -} WHILE_FALSE +} while(0) #endif static int X509V3_ext(struct Curl_easy *data, |