]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
ssh: deduplicate SSH backend includes (and fix libssh cmake unity build)
authorViktor Szakats <commit@vsz.me>
Tue, 20 Aug 2024 13:07:38 +0000 (15:07 +0200)
committerViktor Szakats <commit@vsz.me>
Tue, 20 Aug 2024 19:34:24 +0000 (21:34 +0200)
For libssh, it fixes a "unity" build issue where libssh deprecation
warnings were not suppressed before this patch, because the suppression
macro was only set before just one of the two `libssh.h` includes.
If the other was compiled first in unity mode, the warnings appeared.

Seen in local curl-for-win build (`CW_CONFIG=test-x64-libssh-quictls`)
with libssh 0.11.0. (Also in a GHA/macos cmake job upcoming in #14614)

Use this opportunity to drop duplicate SSH header includes from the SSH
modules. It's enough to include them via the common `ssh.h` header.

Closes #14612

lib/vssh/libssh.c
lib/vssh/libssh2.c
lib/vssh/ssh.h
lib/vssh/wolfssh.c

index 120e8f8d51ae85d573f885ba96bbdfad0421257a..dcf26fe409e75aca32ec2c2b9b7594c38b4f96d6 100644 (file)
 
 #include <limits.h>
 
-/* in 0.10.0 or later, ignore deprecated warnings */
-#define SSH_SUPPRESS_DEPRECATED
-#include <libssh/libssh.h>
-#include <libssh/sftp.h>
-
 #ifdef HAVE_NETINET_IN_H
 #include <netinet/in.h>
 #endif
index abf987bf5f2f5478c0050db00c9e271dbe9f732c..b9b64555ad9867de96df22b40f52c4bda366a048 100644 (file)
@@ -30,9 +30,6 @@
 
 #include <limits.h>
 
-#include <libssh2.h>
-#include <libssh2_sftp.h>
-
 #ifdef HAVE_FCNTL_H
 #include <fcntl.h>
 #endif
index 64ef3329884fe7abbb805422a22c6290063ed8bf..2ed78649b9c182247000960f827dea5060ba8ef2 100644 (file)
@@ -30,6 +30,8 @@
 #include <libssh2.h>
 #include <libssh2_sftp.h>
 #elif defined(USE_LIBSSH)
+/* in 0.10.0 or later, ignore deprecated warnings */
+#define SSH_SUPPRESS_DEPRECATED
 #include <libssh/libssh.h>
 #include <libssh/sftp.h>
 #elif defined(USE_WOLFSSH)
index 9f723964d8845172d6635e147d4b0b50231fa01c..fab65d0db4b856b217c48f6adc2ad476e171720b 100644 (file)
@@ -28,8 +28,6 @@
 
 #include <limits.h>
 
-#include <wolfssh/ssh.h>
-#include <wolfssh/wolfsftp.h>
 #include "urldata.h"
 #include "cfilters.h"
 #include "connect.h"