Skip to content

Commit

Permalink
lib: supress deprecation warnings in apple builds
Browse files Browse the repository at this point in the history
On apple builds, the gssapi/ldap/securetransport headers deprecate
almost everything which leads to a wall of compiler warnings on use in
code.

Suppress those warning that may hide other warnings/errors.

Closes #15763
  • Loading branch information
icing authored and bagder committed Dec 17, 2024
1 parent f7e065f commit ef90ee3
Show file tree
Hide file tree
Showing 8 changed files with 64 additions and 4 deletions.
4 changes: 0 additions & 4 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,6 @@ permissions: {}
#
# For Secure Transport, curl implements features that require a target
# newer than the 10.8 required by `CFURLCreateDataAndPropertiesFromResource`.
# In this case `-Wno-deprecated-declarations` still comes handy to pacify
# deprecation warnings, though the real solution would be to avoid calling
# that function.

env:
LDFLAGS: -w # suppress 'object file was built for newer macOS version than being linked' warnings
Expand Down Expand Up @@ -118,7 +115,6 @@ jobs:
compiler: clang
configure: --enable-debug --with-secure-transport --with-libssh2=$(brew --prefix libssh2)
macos-version-min: '10.12' # for monotonic timers
cflags: '-Wno-deprecated-declarations'
- name: 'SecureTransport libssh2'
compiler: gcc-12
configure: --enable-debug --with-secure-transport --with-libssh2=$(brew --prefix libssh2)
Expand Down
9 changes: 9 additions & 0 deletions lib/curl_gssapi.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@
#define CURL_ALIGN8
#endif

#if defined(__GNUC__) && defined(__APPLE__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif

gss_OID_desc Curl_spnego_mech_oid CURL_ALIGN8 = {
6, (char *)"\x2b\x06\x01\x05\x05\x02"
};
Expand Down Expand Up @@ -149,4 +154,8 @@ void Curl_gss_log_error(struct Curl_easy *data, const char *prefix,
#endif
}

#if defined(__GNUC__) && defined(__APPLE__)
#pragma GCC diagnostic pop
#endif

#endif /* HAVE_GSSAPI */
9 changes: 9 additions & 0 deletions lib/krb5.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@
#include "curl_memory.h"
#include "memdebug.h"

#if defined(__GNUC__) && defined(__APPLE__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif

static CURLcode ftpsend(struct Curl_easy *data, struct connectdata *conn,
const char *cmd)
{
Expand Down Expand Up @@ -924,4 +929,8 @@ Curl_sec_end(struct connectdata *conn)
conn->mech = NULL;
}

#if defined(__GNUC__) && defined(__APPLE__)
#pragma GCC diagnostic pop
#endif

#endif /* HAVE_GSSAPI && !CURL_DISABLE_FTP */
10 changes: 10 additions & 0 deletions lib/ldap.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@

#if !defined(CURL_DISABLE_LDAP) && !defined(USE_OPENLDAP)

#if defined(__GNUC__) && defined(__APPLE__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif

/*
* Notice that USE_OPENLDAP is only a source code selection switch. When
* libcurl is built with USE_OPENLDAP defined the libcurl source code that
Expand Down Expand Up @@ -1113,4 +1118,9 @@ static void _ldap_free_urldesc(LDAPURLDesc *ludp)
free(ludp);
}
#endif /* !HAVE_LDAP_URL_PARSE */

#if defined(__GNUC__) && defined(__APPLE__)
#pragma GCC diagnostic pop
#endif

#endif /* !CURL_DISABLE_LDAP && !USE_OPENLDAP */
9 changes: 9 additions & 0 deletions lib/socks_gssapi.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@
#include "curl_memory.h"
#include "memdebug.h"

#if defined(__GNUC__) && defined(__APPLE__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif

#define MAX_GSS_LEN 1024

static gss_ctx_id_t gss_context = GSS_C_NO_CONTEXT;
Expand Down Expand Up @@ -537,4 +542,8 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(struct Curl_cfilter *cf,
return CURLE_OK;
}

#if defined(__GNUC__) && defined(__APPLE__)
#pragma GCC diagnostic pop
#endif

#endif /* HAVE_GSSAPI && !CURL_DISABLE_PROXY */
9 changes: 9 additions & 0 deletions lib/vauth/krb5_gssapi.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@
#include "curl_memory.h"
#include "memdebug.h"

#if defined(__GNUC__) && defined(__APPLE__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif

/*
* Curl_auth_is_gssapi_supported()
*
Expand Down Expand Up @@ -321,4 +326,8 @@ void Curl_auth_cleanup_gssapi(struct kerberos5data *krb5)
}
}

#if defined(__GNUC__) && defined(__APPLE__)
#pragma GCC diagnostic pop
#endif

#endif /* HAVE_GSSAPI && USE_KERBEROS5 */
9 changes: 9 additions & 0 deletions lib/vauth/spnego_gssapi.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@
#include "curl_memory.h"
#include "memdebug.h"

#if defined(__GNUC__) && defined(__APPLE__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif

/*
* Curl_auth_is_spnego_supported()
*
Expand Down Expand Up @@ -288,4 +293,8 @@ void Curl_auth_cleanup_spnego(struct negotiatedata *nego)
nego->havemultiplerequests = FALSE;
}

#if defined(__GNUC__) && defined(__APPLE__)
#pragma GCC diagnostic pop
#endif

#endif /* HAVE_GSSAPI && USE_SPNEGO */
9 changes: 9 additions & 0 deletions lib/vtls/sectransp.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@
#pragma GCC diagnostic ignored "-Waddress"
#endif

#if defined(__GNUC__) && defined(__APPLE__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif

#include <limits.h>

#include <Security/Security.h>
Expand Down Expand Up @@ -2770,6 +2775,10 @@ const struct Curl_ssl Curl_ssl_sectransp = {
NULL, /* get_channel_binding */
};

#if defined(__GNUC__) && defined(__APPLE__)
#pragma GCC diagnostic pop
#endif

#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
Expand Down

0 comments on commit ef90ee3

Please sign in to comment.