diff options
| author | lukem <lukem@NetBSD.org> | 2023-05-30 18:54:21 +0000 |
|---|---|---|
| committer | lukem <lukem@NetBSD.org> | 2023-05-30 18:54:21 +0000 |
| commit | be9c601ade84c5f6d5ad72d06256f3f1fc84c2f0 (patch) | |
| tree | f7d2104be43486da711a1e567b8953728943a377 | |
| parent | a226cb0efc621a678526e83312786b47a4786197 (diff) | |
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.
| -rw-r--r-- | tools/compat/configure.ac | 16 | ||||
| -rw-r--r-- | tools/compat/defs.mk.in | 9 |
2 files changed, 20 insertions, 5 deletions
diff --git a/tools/compat/configure.ac b/tools/compat/configure.ac index 2bedaeb185a..2cc723e36f3 100644 --- a/tools/compat/configure.ac +++ b/tools/compat/configure.ac @@ -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_FLAG, [^-Wno-], [-W])) 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 --git a/tools/compat/defs.mk.in b/tools/compat/defs.mk.in index 31e565fd7c1..a5096d8eda0 100644 --- a/tools/compat/defs.mk.in +++ b/tools/compat/defs.mk.in @@ -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 |
