]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
lib: drop `UNUSED_PARAM` macro
authorViktor Szakats <commit@vsz.me>
Tue, 2 Sep 2025 13:40:12 +0000 (15:40 +0200)
committerViktor Szakats <commit@vsz.me>
Wed, 3 Sep 2025 14:33:05 +0000 (16:33 +0200)
Added in 2011, but has seen little use in the code. The necessary
compiler feature is missing in some compilers (e.g. MSVC), thus in most
places the portable `(void)` cast is used in addition.

Also:
- vtls/rustls: silence unused argument warning with `(void)`.
  Necessary for MSVC, for example.

Ref: ee4ed461288ec74641e3b96d5508628c07f689b0

Closes #18455

lib/curl_setup.h
lib/krb5.c
lib/vtls/gtls.c
lib/vtls/mbedtls.c
lib/vtls/rustls.c
lib/vtls/schannel.c

index bc3fbf28dd0cfe3b696fe492e61de04388375fd2..e0fbce92e4b76ccd765c3677449d8fb752e5d580 100644 (file)
  * Parameters should of course normally not be unused, but for example when
  * we have multiple implementations of the same interface it may happen.
  */
-
 #if defined(__GNUC__) && ((__GNUC__ >= 3) || \
   ((__GNUC__ == 2) && defined(__GNUC_MINOR__) && (__GNUC_MINOR__ >= 7)))
-#  define UNUSED_PARAM __attribute__((__unused__))
 #  define WARN_UNUSED_RESULT __attribute__((warn_unused_result))
-#elif defined(__IAR_SYSTEMS_ICC__)
-#  define UNUSED_PARAM __attribute__((__unused__))
-#  if (__VER__ >= 9040001)
-#    define WARN_UNUSED_RESULT __attribute__((warn_unused_result))
-#  else
-#    define WARN_UNUSED_RESULT
-#  endif
+#elif defined(__IAR_SYSTEMS_ICC__) && (__VER__ >= 9040001)
+#  define WARN_UNUSED_RESULT __attribute__((warn_unused_result))
 #else
-#  define UNUSED_PARAM /* NOTHING */
 #  define WARN_UNUSED_RESULT
 #endif
 
index 78c2a4ff5314f4568f0df94bb51f89fee241eac0..563d724bbbc8908248a602d03c428f748e1c2505 100644 (file)
@@ -138,8 +138,7 @@ krb5_check_prot(void *app_data, int level)
 
 static int
 krb5_decode(void *app_data, void *buf, int len,
-            int level UNUSED_PARAM,
-            struct connectdata *conn UNUSED_PARAM)
+            int level, struct connectdata *conn)
 {
   gss_ctx_id_t *context = app_data;
   OM_uint32 maj, min;
index 20eae443d86af2fdd78b33c1d91f14a0542a695a..f38c90e66c34b6d9e6245117b5593450cbb560b4 100644 (file)
@@ -2232,7 +2232,7 @@ static bool gtls_cert_status_request(void)
 }
 
 static void *gtls_get_internals(struct ssl_connect_data *connssl,
-                                CURLINFO info UNUSED_PARAM)
+                                CURLINFO info)
 {
   struct gtls_ssl_backend_data *backend =
     (struct gtls_ssl_backend_data *)connssl->backend;
index ebf734aef17f4b100d2b473cef336e837ff40522..7b1a31e42f5b3cf1bf921c2aaf6eab4adc1bfb00 100644 (file)
@@ -1458,7 +1458,7 @@ static bool mbedtls_data_pending(struct Curl_cfilter *cf,
 static CURLcode mbedtls_sha256sum(const unsigned char *input,
                                   size_t inputlen,
                                   unsigned char *sha256sum,
-                                  size_t sha256len UNUSED_PARAM)
+                                  size_t sha256len)
 {
   (void)sha256len;
   /* returns 0 on success, otherwise failure */
@@ -1468,7 +1468,7 @@ static CURLcode mbedtls_sha256sum(const unsigned char *input,
 }
 
 static void *mbedtls_get_internals(struct ssl_connect_data *connssl,
-                                   CURLINFO info UNUSED_PARAM)
+                                   CURLINFO info)
 {
   struct mbed_ssl_backend_data *backend =
     (struct mbed_ssl_backend_data *)connssl->backend;
index 7d0fddaa3085e910b92ecb1d2cacd9d5e11aa10a..221a7a6215ada069d3e423bfa43d32bb4a4b2066 100644 (file)
@@ -393,9 +393,11 @@ out:
 /* A server certificate verify callback for Rustls that always returns
    RUSTLS_RESULT_OK, or in other words disable certificate verification. */
 static uint32_t
-cr_verify_none(void *userdata UNUSED_PARAM,
-               const rustls_verify_server_cert_params *params UNUSED_PARAM)
+cr_verify_none(void *userdata,
+               const rustls_verify_server_cert_params *params)
 {
+  (void)userdata;
+  (void)params;
   return RUSTLS_RESULT_OK;
 }
 
@@ -1295,10 +1297,11 @@ cr_connect(struct Curl_cfilter *cf,
 
 static void *
 cr_get_internals(struct ssl_connect_data *connssl,
-                 CURLINFO info UNUSED_PARAM)
+                 CURLINFO info)
 {
   struct rustls_ssl_backend_data *backend =
     (struct rustls_ssl_backend_data *)connssl->backend;
+  (void)info;
   DEBUGASSERT(backend);
   return backend->conn;
 }
index 6bd4805cea1c56ed66464e3de669c329737965ab..1afc6790cc5196b7ab670daff7d09d3781c2337b 100644 (file)
@@ -2583,7 +2583,7 @@ static size_t schannel_version(char *buffer, size_t size)
   return msnprintf(buffer, size, "Schannel");
 }
 
-static CURLcode schannel_random(struct Curl_easy *data UNUSED_PARAM,
+static CURLcode schannel_random(struct Curl_easy *data,
                                 unsigned char *entropy, size_t length)
 {
   (void)data;
@@ -2725,7 +2725,7 @@ static CURLcode schannel_sha256sum(const unsigned char *input,
 }
 
 static void *schannel_get_internals(struct ssl_connect_data *connssl,
-                                    CURLINFO info UNUSED_PARAM)
+                                    CURLINFO info)
 {
   struct schannel_ssl_backend_data *backend =
     (struct schannel_ssl_backend_data *)connssl->backend;