]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
libssh: improve the deprecation warning dismissal
authorTheo <theo@trustwa.re>
Thu, 14 Dec 2023 12:53:23 +0000 (13:53 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Thu, 14 Dec 2023 17:05:53 +0000 (18:05 +0100)
Previous code was compiler dependant, and dismissed all deprecation warnings
indiscriminately.

libssh provides a way to disable the deprecation warnings for libssh only, and
naturally this is the preferred way.

This commit uses that, to prevent the erroneous hiding of potential, unrelated
deprecation warnings.

Fixes #12519
Closes #12520

lib/vssh/libssh.c

index fdb8d3e12ece1e7f47610a50191ed6ad5466cb86..df4e07dfa4e3cc551101c09575f82a59b2092b2a 100644 (file)
 
 #include <limits.h>
 
+/* in 0.10.0 or later, ignore deprecated warnings */
+#include <libssh/libssh_version.h>
+#if (LIBSSH_VERSION_MINOR >= 10) || (LIBSSH_VERSION_MAJOR > 0)
+#define SSH_SUPPRESS_DEPRECATED
+#endif
 #include <libssh/libssh.h>
 #include <libssh/sftp.h>
 
 #include "curl_memory.h"
 #include "memdebug.h"
 
-/* in 0.10.0 or later, ignore deprecated warnings */
-#if defined(__GNUC__) &&                        \
-  (LIBSSH_VERSION_MINOR >= 10) ||               \
-  (LIBSSH_VERSION_MAJOR > 0)
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
-#endif
-
 /* A recent macro provided by libssh. Or make our own. */
 #ifndef SSH_STRING_FREE_CHAR
 #define SSH_STRING_FREE_CHAR(x)                 \
@@ -2957,10 +2954,4 @@ void Curl_ssh_version(char *buffer, size_t buflen)
   (void)msnprintf(buffer, buflen, "libssh/%s", ssh_version(0));
 }
 
-#if defined(__GNUC__) &&                        \
-  (LIBSSH_VERSION_MINOR >= 10) ||               \
-  (LIBSSH_VERSION_MAJOR > 0)
-#pragma GCC diagnostic pop
-#endif
-
 #endif                          /* USE_LIBSSH */