]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
openssl: silence compiler warning when not using IPv6
authorDaniel Gustafsson <daniel@yesql.se>
Wed, 23 Nov 2022 11:10:30 +0000 (12:10 +0100)
committerDaniel Gustafsson <daniel@yesql.se>
Wed, 23 Nov 2022 11:10:30 +0000 (12:10 +0100)
In non-IPv6 builds the conn parameter is unused, and compilers which
run with "-Werror=unused-parameter" (or similar) warnings turned on
fails to build. Below is an excerpt from a CI job:

  vtls/openssl.c: In function ‘Curl_ossl_verifyhost’:
  vtls/openssl.c:2016:75: error: unused parameter ‘conn’ [-Werror=unused-parameter]
   2016 | CURLcode Curl_ossl_verifyhost(struct Curl_easy *data, struct connectdata *conn,
        |                                                       ~~~~~~~~~~~~~~~~~~~~^~~~

Closes: #9970
Reviewed-by: Daniel Stenberg <daniel@haxx.se>
lib/vtls/openssl.c

index 2c4f3dff198dd1d3c31b91727b8ea434537a7e88..57d8054ccbf11f35aaedb0175a2338ba8b39b9ab 100644 (file)
@@ -2035,6 +2035,11 @@ CURLcode Curl_ossl_verifyhost(struct Curl_easy *data, struct connectdata *conn,
   Curl_conn_get_host(data, FIRSTSOCKET, &hostname, &dispname, &port);
   hostlen = strlen(hostname);
 
+#ifndef ENABLE_IPV6
+  /* Silence compiler warnings for unused params */
+  (void) conn;
+#endif
+
 #ifdef ENABLE_IPV6
   if(conn->bits.ipv6_ip &&
      Curl_inet_pton(AF_INET6, hostname, &addr)) {