summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMAntoniak <47522782+MAntoniak@users.noreply.github.com>2021-07-17 22:43:52 +0200
committerDaniel Stenberg <daniel@haxx.se>2021-08-14 23:19:24 +0200
commitfd84db600d2ace530ad17616cb21d8b78b02840d (patch)
tree8b5b5293b03a5777922d612ae8b77b653679db6b
parent7698a365aed564d8c17d83ca02ddbefde0c2adc8 (diff)
downloadcurl-fd84db600d2ace530ad17616cb21d8b78b02840d.tar.gz
build: fix compiler warnings
For when CURL_DISABLE_VERBOSE_STRINGS and DEBUGBUILD flags are both active. - socks.c : warning C4100: 'lineno': unreferenced formal parameter (co-authored by Daniel Stenberg) - mbedtls.c: warning C4189: 'port': local variable is initialized but not referenced - schannel.c: warning C4189: 'hostname': local variable is initialized but not referenced Cloes #7528
-rw-r--r--lib/socks.c14
-rw-r--r--lib/vtls/mbedtls.c2
-rw-r--r--lib/vtls/schannel.c2
3 files changed, 10 insertions, 8 deletions
diff --git a/lib/socks.c b/lib/socks.c
index 91c4223a5..db4c80834 100644
--- a/lib/socks.c
+++ b/lib/socks.c
@@ -99,24 +99,24 @@ int Curl_blockread_all(struct Curl_easy *data, /* transfer */
}
#endif
-#ifndef DEBUGBUILD
-#define sxstate(x,y) socksstate(x,y)
-#else
+#if defined(DEBUGBUILD) && !defined(CURL_DISABLE_VERBOSE_STRINGS)
+#define DEBUG_AND_VERBOSE
#define sxstate(x,y) socksstate(x,y, __LINE__)
+#else
+#define sxstate(x,y) socksstate(x,y)
#endif
-
/* always use this function to change state, to make debugging easier */
static void socksstate(struct Curl_easy *data,
enum connect_t state
-#ifdef DEBUGBUILD
+#ifdef DEBUG_AND_VERBOSE
, int lineno
#endif
)
{
struct connectdata *conn = data->conn;
enum connect_t oldstate = conn->cnnct.state;
-#if defined(DEBUGBUILD) && !defined(CURL_DISABLE_VERBOSE_STRINGS)
+#ifdef DEBUG_AND_VERBOSE
/* synced with the state list in urldata.h */
static const char * const statename[] = {
"INIT",
@@ -146,7 +146,7 @@ static void socksstate(struct Curl_easy *data,
conn->cnnct.state = state;
-#if defined(DEBUGBUILD) && !defined(CURL_DISABLE_VERBOSE_STRINGS)
+#ifdef DEBUG_AND_VERBOSE
infof(data,
"SXSTATE: %s => %s conn %p; line %d",
statename[oldstate], statename[conn->cnnct.state], conn,
diff --git a/lib/vtls/mbedtls.c b/lib/vtls/mbedtls.c
index a61ff061c..30ef67f6d 100644
--- a/lib/vtls/mbedtls.c
+++ b/lib/vtls/mbedtls.c
@@ -277,7 +277,9 @@ mbed_connect_step1(struct Curl_easy *data, struct connectdata *conn,
const struct curl_blob *ssl_cert_blob = SSL_SET_OPTION(primary.cert_blob);
const char * const ssl_crlfile = SSL_SET_OPTION(CRLfile);
const char * const hostname = SSL_HOST_NAME();
+#ifndef CURL_DISABLE_VERBOSE_STRINGS
const long int port = SSL_HOST_PORT();
+#endif
int ret = -1;
char errorbuf[128];
diff --git a/lib/vtls/schannel.c b/lib/vtls/schannel.c
index 7ffba6cc1..1bdec7644 100644
--- a/lib/vtls/schannel.c
+++ b/lib/vtls/schannel.c
@@ -1364,7 +1364,7 @@ schannel_connect_step3(struct Curl_easy *data, struct connectdata *conn,
SECURITY_STATUS sspi_status = SEC_E_OK;
CERT_CONTEXT *ccert_context = NULL;
bool isproxy = SSL_IS_PROXY();
-#ifdef DEBUGBUILD
+#if defined(DEBUGBUILD) && !defined(CURL_DISABLE_VERBOSE_STRINGS)
const char * const hostname = SSL_HOST_NAME();
#endif
#ifdef HAS_ALPN