]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
build: enable `-Wimplicit-int-enum-cast` compiler warning, fix issues
authorViktor Szakats <commit@vsz.me>
Wed, 18 Mar 2026 23:02:02 +0000 (00:02 +0100)
committerViktor Szakats <commit@vsz.me>
Thu, 19 Mar 2026 10:17:17 +0000 (11:17 +0100)
Offered by clang 21+.

Closes #20990

CMake/PickyWarnings.cmake
lib/vssh/libssh2.c
m4/curl-compilers.m4
tests/libtest/cli_hx_download.c

index 4e22d8b45ca44632e6656b6bd30e10c67bab41c4..31929bd3b31cb9f965c3ee485cd560fbeba30b6d 100644 (file)
@@ -258,6 +258,7 @@ if(PICKY_COMPILER)
         list(APPEND _picky_enable
           -Warray-compare                  # clang 20.1  gcc 12.0  appleclang 26.4
           -Wc++-hidden-decl                # clang 21.1            appleclang 26.4
+          -Wimplicit-int-enum-cast         # clang 21.1
           -Wjump-misses-init               # clang 21.1  gcc  4.5  appleclang 26.4
           -Wno-implicit-void-ptr-cast      # clang 21.1            appleclang 26.4
           -Wtentative-definition-compat    # clang 21.1            appleclang 26.4
index c2dd0e009dccb9fa0649c163fe7074b5320645cc..e8723f75478b026ad4b53403f06203a888e24af8 100644 (file)
@@ -1157,7 +1157,7 @@ static CURLcode ssh_state_pkey_init(struct Curl_easy *data,
   else {
     myssh_to(data, sshc, SSH_AUTH_PASS_INIT);
   }
-  return 0;
+  return CURLE_OK;
 }
 
 static CURLcode sftp_quote_stat(struct Curl_easy *data,
index ef1ad80d90349050e2ab090d28df7224b9aa181a..4c2a0befa11d3accb58b488ace9bdf7a4c8202fe 100644 (file)
@@ -952,6 +952,7 @@ AC_DEFUN([CURL_SET_COMPILER_WARNING_OPTS], [
           dnl clang 21 or later
           if test "$compiler_num" -ge "2101"; then
             CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [c++-hidden-decl])
+            CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [implicit-int-enum-cast])
             CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [jump-misses-init])
             tmp_CFLAGS="$tmp_CFLAGS -Wno-implicit-void-ptr-cast"
             CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [tentative-definition-compat])
index 5817e067561c24ffaf5ece027c2970e90a64c903..139be2bd1619d0cf4847c36f149c0f258a55a239 100644 (file)
@@ -175,7 +175,8 @@ static int my_progress_d_cb(void *userdata,
 #endif
 #ifdef USE_GNUTLS
       case CURLSSLBACKEND_GNUTLS: {
-        int v = gnutls_protocol_get_version((gnutls_session_t)tls->internals);
+        gnutls_protocol_t v = gnutls_protocol_get_version(
+          (gnutls_session_t)tls->internals);
         assert(v);
         curl_mfprintf(stderr, "[t-%zu] info GnuTLS using %s\n",
                       t->idx, gnutls_protocol_get_name(v));