Fix compiler warnings with CURL_DISABLE_VERBOSE_STRINGS and DEBUGBUILD#7528
Closed
MAntoniak wants to merge 1 commit into
Closed
Fix compiler warnings with CURL_DISABLE_VERBOSE_STRINGS and DEBUGBUILD#7528MAntoniak wants to merge 1 commit into
MAntoniak wants to merge 1 commit into
Conversation
Contributor
MAntoniak
commented
Aug 2, 2021
- socks.c : warning C4100: 'lineno': unreferenced formal parameter
- mbedtls.c: warning C4189: 'port': local variable is initialized but not referenced
- schannel.c: warning C4189: 'hostname': local variable is initialized but not referenced
bagder
reviewed
Aug 4, 2021
Member
There was a problem hiding this comment.
Why do you think passing on the line number unconditionally is a good idea? Why is that needed to silence warnings?
Contributor
Author
There was a problem hiding this comment.
I do not consider it necessary to remove the alert. I think this is the easier way to get rid of this warning. Of course, you can also add an appropriate condition for the presence of an additional argument to the function. Which version will be better?
Member
There was a problem hiding this comment.
I imagined something like this for the socks.c fix:
diff --git a/lib/socks.c b/lib/socks.c
index 91c4223a5..0bc0cfb76 100644
--- a/lib/socks.c
+++ b/lib/socks.c
@@ -97,28 +97,29 @@ int Curl_blockread_all(struct Curl_easy *data, /* transfer */
}
return result;
}
#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",
"SOCKS_INIT",
"SOCKS_SEND",
@@ -144,11 +145,11 @@ static void socksstate(struct Curl_easy *data,
/* don't bother when the new state is the same as the old state */
return;
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,
lineno);
#endif…BUGBUILD flags are 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
bagder
pushed a commit
that referenced
this pull request
Aug 14, 2021
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
Member
|
Thanks! |
Member
|
Closed by fd84db6 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.