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: support all bsd.own.mk disabled w...



details:   https://anonhg.NetBSD.org/src/rev/6e5a237afad5
branches:  trunk
changeset: 376145:6e5a237afad5
user:      lukem <lukem%NetBSD.org@localhost>
date:      Sat Jun 03 09:10:13 2023 +0000

description:
tools/compat: support all bsd.own.mk disabled warnings

Check the host CC support for all the warnings now in <bsd.own.mk>
and override appropriately in defs.mk.

In general there's a 1:1 mapping, with the special case
CC_WNO_ADDRESS_OF_PACKED_MEMBER which is set from both
@CC_WNO_ADDRESS_OF_PACKED_MEMBER@ (gcc) and
@CC_WNO_ERROR_ADDRESS_OF_PACKED_MEMBER@ (clang).

diffstat:

 tools/compat/configure.ac |  25 +++++++++++++++++--------
 tools/compat/defs.mk.in   |   7 ++++++-
 2 files changed, 23 insertions(+), 9 deletions(-)

diffs (80 lines):

diff -r 5b2b209f681d -r 6e5a237afad5 tools/compat/configure.ac
--- a/tools/compat/configure.ac Sat Jun 03 09:09:01 2023 +0000
+++ b/tools/compat/configure.ac Sat Jun 03 09:10:13 2023 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: configure.ac,v 1.104 2023/05/30 18:54:21 lukem Exp $
+#      $NetBSD: configure.ac,v 1.105 2023/06/03 09:10:13 lukem Exp $
 #
 # Autoconf definition file for libnbcompat.
 #
@@ -332,11 +332,16 @@ cc_fail_unknown=
 AX_CHECK_COMPILE_FLAG([-Werror=unknown-warning-option],
  [AS_VAR_APPEND([cc_fail_unknown], [-Werror=unknown-warning-option])])
 
+dnl NB_CC_FLAG(FLAG)
+dnl    Determine if HOST_CC supports FLAG, and
+dnl    sets output variable VAR (derived from FLAG)
+dnl    to FLAG if it is supported.
+dnl
 AC_DEFUN([NB_CC_FLAG], [dnl
 m4_pushdef([NB_FLAG], [$1])
 dnl gcc ignores unknown -Wno-WARN but will fail unknown equivalent -WWARN.
 m4_pushdef([NB_WFLAG], m4_bpatsubst(NB_FLAG, [^-Wno-], [-W]))
-m4_pushdef([NB_VAR], [CC]m4_translit(NB_FLAG, [-a-z], [_A-Z]))
+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, [ ])
@@ -349,8 +354,14 @@ dnl Disable use of pre-compiled headers 
 NB_CC_FLAG([-no-cpp-precomp])
 
 dnl Detect HOST_CC support for <bsd.own.mk> CC_* warnings
+NB_CC_FLAG([-Wno-address-of-packed-member])
+NB_CC_FLAG([-Wno-cast-function-type])
+NB_CC_FLAG([-Wno-error=address-of-packed-member])
+NB_CC_FLAG([-Wno-format-overflow])
 NB_CC_FLAG([-Wno-format-truncation])
+NB_CC_FLAG([-Wno-implicit-fallthrough])
 NB_CC_FLAG([-Wno-maybe-uninitialized])
+NB_CC_FLAG([-Wno-return-local-addr])
 NB_CC_FLAG([-Wno-stringop-overflow])
 NB_CC_FLAG([-Wno-stringop-truncation])
 
@@ -358,10 +369,8 @@ AC_OUTPUT()
 
 dnl Display results
 dnl
-AC_MSG_NOTICE([========= Configuration results =========])
-AC_MSG_NOTICE([CC                              $CC])
-m4_foreach_w([NB_VAR], NB_CC_FLAG_VARS, [dnl
-AC_MSG_NOTICE(m4_format([%-32s],NB_VAR)[$NB_VAR])
+AC_MSG_NOTICE([============= Configuration results =============])
+m4_foreach_w([NB_VAR], [CC LIBS ]NB_CC_FLAG_VARS, [dnl
+AC_MSG_NOTICE(m4_format([%-40s],NB_VAR)[$NB_VAR])
 ])
-AC_MSG_NOTICE([LIBS                            $LIBS])
-AC_MSG_NOTICE([=========================================])
+AC_MSG_NOTICE([================================================])
diff -r 5b2b209f681d -r 6e5a237afad5 tools/compat/defs.mk.in
--- a/tools/compat/defs.mk.in   Sat Jun 03 09:09:01 2023 +0000
+++ b/tools/compat/defs.mk.in   Sat Jun 03 09:10:13 2023 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: defs.mk.in,v 1.16 2023/06/03 09:09:16 lukem Exp $
+#      $NetBSD: defs.mk.in,v 1.17 2023/06/03 09:10:13 lukem Exp $
 #
 # Makefile fragment for building with libnbcompat and associated
 # include files.  It can also be used for building just with
@@ -75,8 +75,13 @@ HOST_CFLAGS+=        @CC_NO_CPP_PRECOMP@
 
 # Override HOST_CC support for <bsd.own.mk> CC_* warnings
 #
+CC_WNO_ADDRESS_OF_PACKED_MEMBER=@CC_WNO_ADDRESS_OF_PACKED_MEMBER@ @CC_WNO_ERROR_ADDRESS_OF_PACKED_MEMBER@
+CC_WNO_CAST_FUNCTION_TYPE=@CC_WNO_CAST_FUNCTION_TYPE@
+CC_WNO_FORMAT_OVERFLOW=@CC_WNO_FORMAT_OVERFLOW@
 CC_WNO_FORMAT_TRUNCATION=@CC_WNO_FORMAT_TRUNCATION@
+CC_WNO_IMPLICIT_FALLTHROUGH=@CC_WNO_IMPLICIT_FALLTHROUGH@
 CC_WNO_MAYBE_UNINITIALIZED=@CC_WNO_MAYBE_UNINITIALIZED@
+CC_WNO_RETURN_LOCAL_ADDR=@CC_WNO_RETURN_LOCAL_ADDR@
 CC_WNO_STRINGOP_OVERFLOW=@CC_WNO_STRINGOP_OVERFLOW@
 CC_WNO_STRINGOP_TRUNCATION=@CC_WNO_STRINGOP_TRUNCATION@
 



Home | Main Index | Thread Index | Old Index