Merge pull request #3140 from bluca/clang_tautological

Problem: build broken with clang 6 on Android NDK 17
This commit is contained in:
Simon Giesecke 2018-05-28 15:30:42 +02:00 committed by GitHub
commit bbc903884f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 1 deletions

View File

@ -35,6 +35,18 @@ if(COMPILER_SUPPORTS_C11)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu11")
endif()
if(NOT MSVC)
# clang 6 has a warning that does not make sense on multi-platform code
CHECK_CXX_COMPILER_FLAG("-Wno-tautological-constant-compare" CXX_HAS_TAUT_WARNING)
if(CXX_HAS_TAUT_WARNING)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-tautological-constant-compare")
endif()
CHECK_C_COMPILER_FLAG("-Wno-tautological-constant-compare" CC_HAS_TAUT_WARNING)
if(CC_HAS_TAUT_WARNING)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-tautological-constant-compare")
endif()
endif()
# Will be used to add flags to pkg-config useful when apps want to statically link
set (pkg_config_libs_private "")

View File

@ -812,6 +812,12 @@ AM_CONDITIONAL([WITH_CLANG_FORMAT], [$WITH_CLANG_FORMAT])
# unittests will not build without the static libzmq.a
AM_CONDITIONAL(ENABLE_STATIC, test "x$enable_static" = "xyes")
# clang 6 has a warning that does not make sense on multi-platform code
AX_CHECK_COMPILE_FLAG([-Wno-tautological-constant-compare],
[CFLAGS+=" -Wno-tautological-constant-compare" CXXFLAGS+=" -Wno-tautological-constant-compare"],
[],
[-Werror])
# Subst LIBZMQ_EXTRA_CFLAGS & CXXFLAGS & LDFLAGS
AC_SUBST(LIBZMQ_EXTRA_CFLAGS)
AC_SUBST(LIBZMQ_EXTRA_CXXFLAGS)

View File

@ -255,7 +255,7 @@ zmq::fd_t zmq::tipc_connecter_t::connect ()
// Following code should handle both Berkeley-derived socket
// implementations and Solaris.
int err = 0;
#if ZMQ_HAVE_VXWORKS
#ifdef ZMQ_HAVE_VXWORKS
int len = sizeof (err);
#else
socklen_t len = sizeof (err);