Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/tools/compat tools/compat: disable host CC warnings



details:   https://anonhg.NetBSD.org/src/rev/02004a311978
branches:  trunk
changeset: 376074:02004a311978
user:      lukem <lukem%NetBSD.org@localhost>
date:      Tue May 30 18:54:21 2023 +0000

description:
tools/compat: disable host CC warnings

Determine if the host CC supports flags to disable various
warnings similar to <bsd.own.mk> GCC_*, CLANG_*, and CC_*,
and override the <bsd.own.mk> equivalents in defs.mk.

Silences "warning: unknown warning option '...'" from our source.
External source (e.g., binutils and gcc) need their own fixes
to enhance their detection of supported clang compiler flags.

diffstat:

 tools/compat/configure.ac |  16 ++++++++++++----
 tools/compat/defs.mk.in   |   9 ++++++++-
 2 files changed, 20 insertions(+), 5 deletions(-)

diffs (64 lines):

diff -r 25a4808bcb15 -r 02004a311978 tools/compat/configure.ac
--- a/tools/compat/configure.ac Tue May 30 18:39:19 2023 +0000
+++ b/tools/compat/configure.ac Tue May 30 18:54:21 2023 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: configure.ac,v 1.103 2023/05/30 18:39:19 lukem Exp $
+#      $NetBSD: configure.ac,v 1.104 2023/05/30 18:54:21 lukem Exp $
 #
 # Autoconf definition file for libnbcompat.
 #
@@ -339,6 +339,7 @@ m4_pushdef([NB_WFLAG], m4_bpatsubst(NB_F
 m4_pushdef([NB_VAR], [CC]m4_translit(NB_FLAG, [-a-z], [_A-Z]))
 AX_CHECK_COMPILE_FLAG(NB_WFLAG, [AS_VAR_SET(NB_VAR,NB_FLAG)], [], [$cc_fail_unknown])
 AC_SUBST(NB_VAR)
+m4_append([NB_CC_FLAG_VARS], NB_VAR, [ ])
 m4_popdef([NB_FLAG])
 m4_popdef([NB_WFLAG])
 m4_popdef([NB_VAR])
@@ -347,13 +348,20 @@ m4_popdef([NB_VAR])
 dnl Disable use of pre-compiled headers on Darwin.
 NB_CC_FLAG([-no-cpp-precomp])
 
+dnl Detect HOST_CC support for <bsd.own.mk> CC_* warnings
+NB_CC_FLAG([-Wno-format-truncation])
+NB_CC_FLAG([-Wno-maybe-uninitialized])
+NB_CC_FLAG([-Wno-stringop-overflow])
+NB_CC_FLAG([-Wno-stringop-truncation])
 
 AC_OUTPUT()
 
-# Display results
-#
+dnl Display results
+dnl
 AC_MSG_NOTICE([========= Configuration results =========])
 AC_MSG_NOTICE([CC                              $CC])
-AC_MSG_NOTICE([CC_NO_CPP_PRECOMP               $CC_NO_CPP_PRECOMP])
+m4_foreach_w([NB_VAR], NB_CC_FLAG_VARS, [dnl
+AC_MSG_NOTICE(m4_format([%-32s],NB_VAR)[$NB_VAR])
+])
 AC_MSG_NOTICE([LIBS                            $LIBS])
 AC_MSG_NOTICE([=========================================])
diff -r 25a4808bcb15 -r 02004a311978 tools/compat/defs.mk.in
--- a/tools/compat/defs.mk.in   Tue May 30 18:39:19 2023 +0000
+++ b/tools/compat/defs.mk.in   Tue May 30 18:54:21 2023 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: defs.mk.in,v 1.14 2023/05/30 18:39:19 lukem Exp $
+#      $NetBSD: defs.mk.in,v 1.15 2023/05/30 18:54:21 lukem Exp $
 #
 # Makefile fragment for building with libnbcompat and associated
 # include files.  It can also be used for building just with
@@ -73,6 +73,13 @@ BUILD_OSTYPE!=  uname -s
 
 HOST_CFLAGS+=  @CC_NO_CPP_PRECOMP@
 
+# Override HOST_CC support for <bsd.own.mk> CC_* warnings
+#
+GCC_NO_FORMAT_TRUNCATION=@CC_WNO_FORMAT_TRUNCATION@
+GCC_NO_MAYBE_UNINITIALIZED=@CC_WNO_MAYBE_UNINITIALIZED@
+GCC_NO_STRINGOP_OVERFLOW=@CC_WNO_STRINGOP_OVERFLOW@
+GCC_NO_STRINGOP_TRUNCATION=@CC_WNO_STRINGOP_TRUNCATION@
+
 HOST_CPPFLAGS+=        ${COMPATINCFLAGS} -I${NETBSDSRCDIR}/tools/compat \
                -DHAVE_NBTOOL_CONFIG_H=1 -D_FILE_OFFSET_BITS=64
 



Home | Main Index | Thread Index | Old Index