aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2018-09-11 18:28:22 -0700
committerGuy Harris <guy@alum.mit.edu>2018-09-12 01:28:57 +0000
commit69a01b650ac6c48b46d72838188ec1a5ffc40765 (patch)
tree0c73209d285bb49b18541b731d94c4fb0d3d4bb0
parent2f65fbae4ecced197370004d72f69c4e1283c2c3 (diff)
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>
-rw-r--r--CMakeLists.txt35
1 files changed, 16 insertions, 19 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index dab3f82..de23e91 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -491,10 +491,25 @@ 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)
#
if((NOT ENABLE_ASAN) AND (NOT ENABLE_TSAN) AND (NOT ENABLE_UBSAN) AND (NOT DISABLE_FRAME_LARGER_THAN_WARNING))
@@ -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()