With llvm-gcc, just don't do -Wshorten-64-to-32.

If you specify -Werror and -Wshorten-64-to-32, there does not appear to
be any way to get llvm-gcc *NOT* to treat those warnings as errors - not
with pragmas, and not even with -Wno-error=shorten-64-to-32.

Change-Id: Ia82df3f548085cca8d187c4b43c02060b87f0542
Reviewed-on: https://code.wireshark.org/review/29620
Reviewed-by: Guy Harris <guy@alum.mit.edu>
This commit is contained in:
Guy Harris 2018-09-11 18:28:22 -07:00
parent 2f65fbae4e
commit 69a01b650a
1 changed files with 16 additions and 19 deletions

View File

@ -491,9 +491,24 @@ else() # ! MSVC
-Wno-long-long
-Wheader-guard
-Wcomma
-Wshorten-64-to-32
)
#
# For -Wshorten-64-to-32, Apple's llvm-gcc doesn't seem to support
# specifying -Werror and then specifying that -Wshorten-64-to-32
# warnings should *not* be treated as errors - not with pragmas
# and not even with -Werror ... -Wshorten-64-to-32 ...
# -Wno-error=shorten-64-to-32.
#
# So we only add -Wshorten-64-to-32 if either 1) we're not building
# on/for Apple or 2) we're using Clang.
#
if ((NOT APPLE) OR CMAKE_C_COMPILER_ID MATCHES "Clang")
list(APPEND WIRESHARK_COMMON_FLAGS
-Wshorten-64-to-32
)
endif()
#
# Code that may be worth looking into (coding practices)
#
@ -736,24 +751,6 @@ if(NOT DISABLE_WERROR AND NOT ENABLE_EXTRA_COMPILER_WARNINGS)
if (WERROR)
set(WERROR_COMMON_FLAGS "-Werror")
endif()
#
# Apple's llvm-gcc appears not to support suppressing
# warnings with pragmas, so, if we're building on a Mac
# (we check for APPLE), and we're not using Clang, we
# suppress errors for some warnings that we can only
# remove by suppressing them, as they're in generated
# code.
#
# We have to do this *after* -Werror, otherwise the
# compiler decides -Werror means "never mind, make 'em
# all errors.
#
if (APPLE AND NOT CMAKE_C_COMPILER_ID MATCHES "Clang")
set(WERROR_COMMON_FLAGS
"${WERROR_COMMON_FLAGS} -Wno-error=shorten-64-to-32 -Wno-error=unused-function"
)
endif()
endif()
endif()