This is an automated email from the ASF dual-hosted git repository.
eolivelli pushed a commit to branch branch-3.7.0
in repository https://gitbox.apache.org/repos/asf/zookeeper.git
The following commit(s) were added to refs/heads/branch-3.7.0 by this push:
new 93410bf ZOOKEEPER-4201: C client: Disable SASL deprecation warnings
on macOS
93410bf is described below
commit 93410bf4968845af3c741383a007c9d4d15d9b59
Author: Damien Diederen <[email protected]>
AuthorDate: Wed Feb 17 20:20:38 2021 +0100
ZOOKEEPER-4201: C client: Disable SASL deprecation warnings on macOS
This patch works around the numerous deprecation notices added to the
CyrusSASL library on macOS. It is a direct "port" of the solution to
MESOS-3030, which hit exactly the same problem:
https://issues.apache.org/jira/browse/MESOS-3030
https://reviews.apache.org/r/39230/diff/3/
The PR also includes a fix for the the `clockid_t` compilation issue
mentioned in the ticket description, but the test suite as a whole remains
broken on macOS as its linker does not support the `--wrap` option.
Author: Damien Diederen <[email protected]>
Reviewers: Enrico Olivelli <[email protected]>, Mate Szalay-Beko
<[email protected]>
Closes #1593 from ztzg/ZOOKEEPER-4201-catalina-c-client-fixes
(cherry picked from commit 58b4c10be5e6b992caac3b99a506e1d61bdec24d)
Signed-off-by: Enrico Olivelli <[email protected]>
---
zookeeper-client/zookeeper-client-c/src/cli.c | 16 ++++++++++++++++
zookeeper-client/zookeeper-client-c/src/zk_sasl.c | 15 +++++++++++++++
zookeeper-client/zookeeper-client-c/tests/LibCSymTable.h | 1 +
.../zookeeper-client-c/tests/TestSASLAuth.cc | 14 ++++++++++++++
4 files changed, 46 insertions(+)
diff --git a/zookeeper-client/zookeeper-client-c/src/cli.c
b/zookeeper-client/zookeeper-client-c/src/cli.c
index 1864e56..823ed72 100644
--- a/zookeeper-client/zookeeper-client-c/src/cli.c
+++ b/zookeeper-client/zookeeper-client-c/src/cli.c
@@ -948,6 +948,17 @@ int main(int argc, char **argv) {
zoo_deterministic_conn_order(1); // enable deterministic order
#ifdef HAVE_CYRUS_SASL_H
+ /*
+ * We need to disable the deprecation warnings as Apple has
+ * decided to deprecate all of CyrusSASL's functions with OS 10.11
+ * (see MESOS-3030, ZOOKEEPER-4201). We are using GCC pragmas also
+ * for covering clang.
+ */
+#ifdef __APPLE__
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+#endif
+
if (mechlist) {
zoo_sasl_params_t sasl_params = { 0 };
int sr;
@@ -977,6 +988,11 @@ int main(int argc, char **argv) {
return errno;
}
}
+
+#ifdef __APPLE__
+#pragma GCC diagnostic pop
+#endif
+
#endif /* HAVE_CYRUS_SASL_H */
if (!zh) {
diff --git a/zookeeper-client/zookeeper-client-c/src/zk_sasl.c
b/zookeeper-client/zookeeper-client-c/src/zk_sasl.c
index e0ccfb3..6ae7e12 100644
--- a/zookeeper-client/zookeeper-client-c/src/zk_sasl.c
+++ b/zookeeper-client/zookeeper-client-c/src/zk_sasl.c
@@ -48,6 +48,17 @@
#include "zookeeper_log.h"
/*
+ * We need to disable the deprecation warnings as Apple has decided to
+ * deprecate all of CyrusSASL's functions with OS 10.11 (see
+ * MESOS-3030, ZOOKEEPER-4201). We are using GCC pragmas also for
+ * covering clang.
+ */
+#ifdef __APPLE__
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+#endif
+
+/*
* Store a duplicate of src, or NULL, into *target. Returns
* ZSYSTEMERROR if no memory could be allocated, ZOK otherwise.
*/
@@ -539,3 +550,7 @@ sasl_callback_t *zoo_sasl_make_basic_callbacks(const char
*user,
return xcallbacks;
}
}
+
+#ifdef __APPLE__
+#pragma GCC diagnostic pop
+#endif
diff --git a/zookeeper-client/zookeeper-client-c/tests/LibCSymTable.h
b/zookeeper-client/zookeeper-client-c/tests/LibCSymTable.h
index 1b6f9db..08028ab 100644
--- a/zookeeper-client/zookeeper-client-c/tests/LibCSymTable.h
+++ b/zookeeper-client/zookeeper-client-c/tests/LibCSymTable.h
@@ -26,6 +26,7 @@
#include <dlfcn.h>
#include <cassert>
#include <poll.h>
+#include <time.h>
#include <unistd.h> // needed for _POSIX_MONOTONIC_CLOCK
#ifdef THREADED
diff --git a/zookeeper-client/zookeeper-client-c/tests/TestSASLAuth.cc
b/zookeeper-client/zookeeper-client-c/tests/TestSASLAuth.cc
index e6aa4cb..c98d4bf 100644
--- a/zookeeper-client/zookeeper-client-c/tests/TestSASLAuth.cc
+++ b/zookeeper-client/zookeeper-client-c/tests/TestSASLAuth.cc
@@ -130,6 +130,16 @@ public:
}
#ifdef HAVE_CYRUS_SASL_H
+
+ // We need to disable the deprecation warnings as Apple has
+ // decided to deprecate all of CyrusSASL's functions with OS 10.11
+ // (see MESOS-3030, ZOOKEEPER-4201). We are using GCC pragmas also
+ // for covering clang.
+#ifdef __APPLE__
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+#endif
+
void testClientSASLHelper(const char *hostPorts, const char *path) {
startServer();
@@ -260,6 +270,10 @@ public:
stopServer();
}
+#ifdef __APPLE__
+#pragma GCC diagnostic pop
+#endif
+
#endif /* HAVE_CYRUS_SASL_H */
};