Skip to content

Commit

Permalink
libssh: improve the deprecation warning dismissal
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Theo authored and bagder committed Dec 14, 2023
1 parent de0cd5e commit d21bd21
Showing 1 changed file with 5 additions and 14 deletions.
19 changes: 5 additions & 14 deletions lib/vssh/libssh.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@

#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>

Expand Down Expand Up @@ -89,14 +94,6 @@
#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) \
Expand Down Expand Up @@ -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 */

0 comments on commit d21bd21

Please sign in to comment.