Skip to content

Commit

Permalink
CMake: Cleanup some compiler flags
Browse files Browse the repository at this point in the history
Enable -Qunused-arguments because it may be a useful warning.
Remove -fwrapv because it is implied by -fno-strict-overflow.

Move GCC-specific flag out of if(GCC) condition. Let CMake enable
it automatically.
  • Loading branch information
randstr committed Nov 17, 2022
1 parent 5754fdf commit 973748f
Showing 1 changed file with 1 addition and 14 deletions.
15 changes: 1 addition & 14 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -616,28 +616,15 @@ else() # ! MSVC
endif()
endif()

if(CMAKE_C_COMPILER_ID MATCHES "Clang")
set(WIRESHARK_COMMON_FLAGS ${WIRESHARK_COMMON_FLAGS}
# avoid "argument unused during compilation" warnings
# (for example, when getting the -gsplit-dwarf option or
# when combining -fwrapv with -fno-strict-overflow)
-Qunused-arguments
)
else()
set(WIRESHARK_COMMON_FLAGS ${WIRESHARK_COMMON_FLAGS}
-fexcess-precision=fast
)
endif()

list(APPEND WIRESHARK_COMMON_FLAGS
# The following are for C and C++
# -O<X> and -g get set by the CMAKE_BUILD_TYPE
-Wall
-Wextra
-Wpointer-arith
-Wformat-security
-fwrapv
-fno-strict-overflow
-fexcess-precision=fast # GCC-only
-Wvla
-Wattributes
-Wpragmas # Clang-only
Expand Down

0 comments on commit 973748f

Please sign in to comment.