Skip to content

Commit fedd2e0

Browse files
committed
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 f32255b)
1 parent fb18228 commit fedd2e0

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

CHANGES

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ DayOfTheWeek, Month DD, YYYY / The Tcpdump Group
8484
Do not require vsnprintf().
8585
tests: Use the -tttt option, by default, for the tests.
8686
autoconf, CMake: Get the size of a void * and a time_t.
87+
Fix propagation of cc_werr_cflags() output.
8788
Documentation:
8889
Fixed errors in doc/README.Win32.md.
8990

CMakeLists.txt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1063,9 +1063,13 @@ endif()
10631063
# usage: cmake -DEXTRA_CFLAGS='-Wall -Wextra -Werror' ...
10641064
#
10651065
if(NOT "${EXTRA_CFLAGS}" STREQUAL "")
1066-
foreach(_extra_cflag ${EXTRA_CFLAGS})
1067-
check_and_add_compiler_option("${_extra_cflag}")
1068-
endforeach(_extra_cflag)
1066+
# The meaning of EXTRA_CFLAGS is "use the exact specified options, or the
1067+
# build risks failing to fail", not "try every specified option, omit those
1068+
# that do not work and use the rest". Thus use add_compile_options(), not
1069+
# foreach()/check_and_add_compiler_option(). Another reason to do that is
1070+
# that the effect lasts in testprogs/ and testprogs/fuzz/.
1071+
string(REPLACE " " ";" _extra_cflags_list ${EXTRA_CFLAGS})
1072+
add_compile_options(${_extra_cflags_list})
10691073
message(STATUS "Added extra compile options (${EXTRA_CFLAGS})")
10701074
endif()
10711075

build_common.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,10 @@ cc_werr_cflags() {
179179
echo '-qhalt=w'
180180
;;
181181
suncc-*)
182-
echo '-errwarn=%all'
182+
# GCC and Clang print an identification for every warning, which is
183+
# useful for root cause analysis and bug fixing. Sun C does not do it
184+
# by default, but an additional option makes the style more consistent.
185+
echo '-errwarn=%all -errtags=yes'
183186
;;
184187
esac
185188
}

0 commit comments

Comments
 (0)