From: Denis Ovsienko Date: Mon, 4 Mar 2024 11:43:20 +0000 (+0000) Subject: Fix propagation of cc_werr_cflags() output. [skip ci] X-Git-Tag: tcpdump-4.99.5~58 X-Git-Url: https://git.tcpdump.org/tcpdump/commitdiff_plain/fedd2e0371f565395dbf2cac2ae66e9937ca1656 Fix propagation of cc_werr_cflags() output. [skip ci] Same as in libpcap. It is not the propagation that tcpdump needs from this change, but the proper application of compiler options. (cherry picked from commit f32255ba1324e14dcb3def10c9141adccb21cf60) --- diff --git a/CHANGES b/CHANGES index f5eb70c6..1883b972 100644 --- a/CHANGES +++ b/CHANGES @@ -84,6 +84,7 @@ DayOfTheWeek, Month DD, YYYY / The Tcpdump Group Do not require vsnprintf(). tests: Use the -tttt option, by default, for the tests. autoconf, CMake: Get the size of a void * and a time_t. + Fix propagation of cc_werr_cflags() output. Documentation: Fixed errors in doc/README.Win32.md. diff --git a/CMakeLists.txt b/CMakeLists.txt index bf24ed19..ac30eca8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1063,9 +1063,13 @@ endif() # usage: cmake -DEXTRA_CFLAGS='-Wall -Wextra -Werror' ... # if(NOT "${EXTRA_CFLAGS}" STREQUAL "") - foreach(_extra_cflag ${EXTRA_CFLAGS}) - check_and_add_compiler_option("${_extra_cflag}") - endforeach(_extra_cflag) + # The meaning of EXTRA_CFLAGS is "use the exact specified options, or the + # build risks failing to fail", not "try every specified option, omit those + # that do not work and use the rest". Thus use add_compile_options(), not + # foreach()/check_and_add_compiler_option(). Another reason to do that is + # that the effect lasts in testprogs/ and testprogs/fuzz/. + string(REPLACE " " ";" _extra_cflags_list ${EXTRA_CFLAGS}) + add_compile_options(${_extra_cflags_list}) message(STATUS "Added extra compile options (${EXTRA_CFLAGS})") endif() diff --git a/build_common.sh b/build_common.sh index 3c9d7d4c..a512f284 100644 --- a/build_common.sh +++ b/build_common.sh @@ -179,7 +179,10 @@ cc_werr_cflags() { echo '-qhalt=w' ;; suncc-*) - echo '-errwarn=%all' + # GCC and Clang print an identification for every warning, which is + # useful for root cause analysis and bug fixing. Sun C does not do it + # by default, but an additional option makes the style more consistent. + echo '-errwarn=%all -errtags=yes' ;; esac }