From 7ba074fa28dd2d6b6e0e9d156528242aa43314de Mon Sep 17 00:00:00 2001 From: Luca Boccassi Date: Sun, 13 May 2018 17:49:46 +0100 Subject: [PATCH 1/2] Problem: Sun Studio build errors Solution: add compiler flags to support extensions like anonymous structs in unions, fix casting of const, and check for suncc rather than solaris --- configure.ac | 6 ++++++ src/atomic_ptr.hpp | 4 ++++ src/blob.hpp | 2 +- src/err.cpp | 2 +- 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 6cce5383..d0daa89e 100644 --- a/configure.ac +++ b/configure.ac @@ -315,6 +315,12 @@ case "${host_os}" in ;; esac +# Sun Studio does not like anonymous structures in unions +if test "x$libzmq_cv_[]_AC_LANG_ABBREV[]_sun_studio_compiler" = "xyes"; then + CXXFLAGS="${CXXFLAGS} -features=extensions" + CFLAGS="${CFLAGS} -features=extensions" +fi + # Checks for libraries AC_CHECK_LIB([pthread], [pthread_create]) AC_CHECK_LIB([rt], [clock_gettime]) diff --git a/src/atomic_ptr.hpp b/src/atomic_ptr.hpp index ed6d7b41..f7113adc 100644 --- a/src/atomic_ptr.hpp +++ b/src/atomic_ptr.hpp @@ -266,7 +266,11 @@ struct atomic_value_t return (int) (ptrdiff_t) atomic_cas ((void **) &value, 0, 0 #if defined ZMQ_ATOMIC_PTR_MUTEX , +#if defined __SUNPRO_CC + const_cast (sync) +#else sync +#endif #endif ); #endif diff --git a/src/blob.hpp b/src/blob.hpp index 3159bb9d..44de6ac8 100644 --- a/src/blob.hpp +++ b/src/blob.hpp @@ -40,7 +40,7 @@ #define ZMQ_PUSH_OR_EMPLACE_BACK emplace_back #define ZMQ_MOVE(x) std::move (x) #else -#if defined ZMQ_HAVE_SOLARIS +#if defined __SUNPRO_CC template std::pair make_pair_fix_const (const K &k, const V &v) { diff --git a/src/err.cpp b/src/err.cpp index 8a042721..ffbc4b34 100644 --- a/src/err.cpp +++ b/src/err.cpp @@ -387,7 +387,7 @@ int zmq::wsa_error_to_errno (int errcode) #endif -#ifdef HAVE_LIBUNWIND +#if defined(HAVE_LIBUNWIND) && !defined(__SUNPRO_CC) #define UNW_LOCAL_ONLY #include From 09f700f72e4442307e1f842a1aace11a2cc821b8 Mon Sep 17 00:00:00 2001 From: Luca Boccassi Date: Sun, 13 May 2018 17:51:21 +0100 Subject: [PATCH 2/2] Problem: uninitialised class variable warning Solution: initialise it --- src/ipc_listener.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ipc_listener.cpp b/src/ipc_listener.cpp index 470aef75..6023722d 100644 --- a/src/ipc_listener.cpp +++ b/src/ipc_listener.cpp @@ -138,6 +138,7 @@ zmq::ipc_listener_t::ipc_listener_t (io_thread_t *io_thread_, io_object_t (io_thread_), has_file (false), s (retired_fd), + handle ((handle_t) NULL), socket (socket_) { }