Skip to content

Commit

Permalink
CMake: Do not disable -Werror with "extra compiler warnings"
Browse files Browse the repository at this point in the history
Give the ENABLE_WERROR option full control of -Werror. Silently
overriding the user configuration is potentially confusing and
unnecessary.
  • Loading branch information
randstr committed Nov 17, 2022
1 parent 2443df7 commit e1d492e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ Code Checks + Clang Warnings:
- cd build
- printf "\e[0Ksection_start:%s:cmake_section[collapsed=true]\r\e[0KRunning CMake" "$( date +%s)"
# We don't have an "All options" job, so build fuzzshark and tfshark here.
- cmake -DENABLE_EXTRA_COMPILER_WARNINGS=on -DENABLE_CHECKHF_CONFLICT=on -DCMAKE_EXPORT_COMPILE_COMMANDS=on -DBUILD_fuzzshark=ON -DBUILD_tfshark=On -DBUILD_logray=ON -DENABLE_CCACHE=ON -G Ninja ..
- cmake -DENABLE_EXTRA_COMPILER_WARNINGS=on -DENABLE_WERROR=off -DENABLE_CHECKHF_CONFLICT=on -DCMAKE_EXPORT_COMPILE_COMMANDS=on -DBUILD_fuzzshark=ON -DBUILD_tfshark=On -DBUILD_logray=ON -DENABLE_CCACHE=ON -G Ninja ..
- printf "\e[0Ksection_end:%s:cmake_section\r\e[0K" "$( date +%s)"
- mkdir ../html
- script --command ninja --flush --quiet --return ../tmp_clang_report.txt
Expand Down
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -718,7 +718,7 @@ else() # ! MSVC
# These are not enabled by default, because the warnings they
# produce are very hard or impossible to eliminate.
#
if(ENABLE_EXTRA_COMPILER_WARNINGS) # This overrides -Werror
if(ENABLE_EXTRA_COMPILER_WARNINGS)
list(APPEND WIRESHARK_COMMON_FLAGS
# The following are for C and C++
-Wpedantic
Expand Down Expand Up @@ -963,7 +963,7 @@ if(MSVC)
endif()

set(WERROR_COMMON_FLAGS "")
if(ENABLE_WERROR AND NOT ENABLE_EXTRA_COMPILER_WARNINGS)
if(ENABLE_WERROR)
if(CMAKE_C_COMPILER_ID MATCHES "MSVC")
set(WERROR_COMMON_FLAGS "/WX")
else()
Expand Down
2 changes: 1 addition & 1 deletion CMakeOptions.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ option(ENABLE_DEBUG_MBS "Enable extra debug checks for detecting invalid multib
option(ENABLE_CCACHE "Speed up compiling and linking using ccache if possible" OFF)
option(DISABLE_FRAME_LARGER_THAN_WARNING "Disable warning if the size of a function frame is large" OFF)
option(EXTCAP_ANDROIDDUMP_LIBPCAP "Build androiddump using libpcap" OFF)
option(ENABLE_EXTRA_COMPILER_WARNINGS "Do additional compiler warnings (disables -Werror)" OFF)
option(ENABLE_EXTRA_COMPILER_WARNINGS "Do additional compiler warnings (noisy)" OFF)
option(ENABLE_CODE_ANALYSIS "Enable the compiler's static analyzer if possible" OFF)
option(ENABLE_ASAN "Enable AddressSanitizer (ASAN) for debugging (degrades performance)" OFF)
option(ENABLE_TSAN "Enable ThreadSanitizer (TSan) for debugging" OFF)
Expand Down

0 comments on commit e1d492e

Please sign in to comment.