]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Fix propagation of cc_werr_cflags() output. [skip ci]
authorDenis Ovsienko <[email protected]>
Mon, 4 Mar 2024 11:43:20 +0000 (11:43 +0000)
committerDenis Ovsienko <[email protected]>
Mon, 4 Mar 2024 11:43:20 +0000 (11:43 +0000)
Same as in libpcap.  It is not the propagation that tcpdump needs from
this change, but the proper application of compiler options.

CHANGES
CMakeLists.txt
build_common.sh

diff --git a/CHANGES b/CHANGES
index 7fc2dfd14b83161704f8418ed10ba1a25b96a3d8..f71b58efc6dfb254d48a969abaac576ab3855cfd 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -50,6 +50,7 @@ DayOfTheWeek, Month DD, YYYY / The Tcpdump Group
         Tru64 Unix}, SINIX and Ultrix.
       Fix compiling on GNU/Hurd.
       Make illumos build warning-free.
+      Fix propagation of cc_werr_cflags() output.
 
 DayOfTheWeek, Month DD, YYYY / The Tcpdump Group
   Summary for 4.99.5 tcpdump release (so far!)
index ee3eb9529a78afd3383791b87c5295dbe1207f2a..6c25efa23bfe8ec3c52208cc25258fcab0b14f32 100644 (file)
@@ -1036,9 +1036,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()
 
index 792b6ddf6a96a3c151e6d3aeb90fa978c5fa395b..cd43aa93331a5d1f908b2867866a5562c077e40e 100644 (file)
@@ -196,7 +196,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'
         ;;
     msvc-*)
         # XXX - what?