Skip to content

Commit

Permalink
introduce some common variables for use in GCC warning disables:
Browse files Browse the repository at this point in the history
GCC_NO_FORMAT_TRUNCATION    -Wno-format-truncation (GCC 7/8)
GCC_NO_STRINGOP_TRUNCATION  -Wno-stringop-truncation (GCC 8)
GCC_NO_STRINGOP_OVERFLOW    -Wno-stringop-overflow (GCC 8)
GCC_NO_CAST_FUNCTION_TYPE   -Wno-cast-function-type (GCC 8)

use these to turn off warnings for most GCC-8 complaints.  many
of these are false positives, most of the real bugs are already
commited, or are yet to come.


we plan to introduce versions of (some?) of these that use the
"-Wno-error=" form, which still displays the warnings but does
not make it an error, and all of the above will be re-considered
as either being "fix me" (warning still displayed) or "warning
is wrong."
  • Loading branch information
mrgtwentythree committed Oct 13, 2019
1 parent 2e65b46 commit de11d87
Show file tree
Hide file tree
Showing 163 changed files with 563 additions and 241 deletions.
4 changes: 3 additions & 1 deletion bin/pax/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.40 2019/08/15 21:05:16 uwe Exp $
# $NetBSD: Makefile,v 1.41 2019/10/13 07:28:04 mrg Exp $
# @(#)Makefile 8.1 (Berkeley) 5/31/93

.include <bsd.own.mk>
Expand Down Expand Up @@ -50,4 +50,6 @@ LDADD+= -lrmt
DPADD+= ${LIBRMT}
.endif

COPTS.tar.c+= ${GCC_NO_STRINGOP_TRUNCATION}

.include <bsd.prog.mk>
4 changes: 3 additions & 1 deletion crypto/external/bsd/netpgp/bin/netpgpverify/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.17 2019/09/29 23:44:58 mrg Exp $
# $NetBSD: Makefile,v 1.18 2019/10/13 07:28:04 mrg Exp $

PROG=netpgpverify
BINDIR= /usr/bin
Expand Down Expand Up @@ -32,6 +32,8 @@ EXTDIST=${.CURDIR}/../../dist
COPTS+= -Wno-error=implicit-fallthrough
.endif

COPTS.libverify.c+= ${GCC_NO_FORMAT_TRUNCATION}

.include <bsd.prog.mk>

t tst: ${PROG}
Expand Down
4 changes: 3 additions & 1 deletion crypto/external/bsd/netpgp/lib/netpgp/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.3 2018/02/04 03:19:52 christos Exp $
# $NetBSD: Makefile,v 1.4 2019/10/13 07:28:05 mrg Exp $

.include <bsd.own.mk>

Expand Down Expand Up @@ -26,4 +26,6 @@ LIBDPLIBS+= crypto ${OPENSSL}/lib/libcrypto
LIBDPLIBS+= z ${NETBSDSRCDIR}/lib/libz
LIBDPLIBS+= bz2 ${NETBSDSRCDIR}/lib/libbz2

COPTS.crypto.c+= ${GCC_NO_STRINGOP_OVERFLOW}

.include <bsd.lib.mk>
7 changes: 3 additions & 4 deletions crypto/external/bsd/netpgp/lib/verify/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.11 2019/09/29 23:44:58 mrg Exp $
# $NetBSD: Makefile,v 1.12 2019/10/13 07:28:05 mrg Exp $

LIB=netpgpverify
SRCS+=b64.c
Expand Down Expand Up @@ -27,8 +27,7 @@ INCSDIR=/usr/include/netpgp

.include <bsd.own.mk>

.if defined(HAVE_GCC) && ${HAVE_GCC} >= 7 && ${ACTIVE_CC} == "gcc"
COPTS+= -Wno-error=implicit-fallthrough
.endif
COPTS+= ${${ACTIVE_CC} == "gcc":? -Wno-implicit-fallthrough :}
COPTS.libverify.c+= ${GCC_NO_FORMAT_TRUNCATION}

.include <bsd.lib.mk>
4 changes: 3 additions & 1 deletion crypto/external/bsd/openssh/bin/ssh-agent/Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# $NetBSD: Makefile,v 1.2 2010/11/21 19:19:22 adam Exp $
# $NetBSD: Makefile,v 1.3 2019/10/13 07:28:05 mrg Exp $

BINDIR=/usr/bin

PROG= ssh-agent
SRCS= ssh-agent.c ssh-pkcs11-client.c

COPTS.ssh-agent.c+= ${GCC_NO_FORMAT_TRUNCATION}

.include <bsd.prog.mk>
4 changes: 3 additions & 1 deletion crypto/external/bsd/openssh/bin/ssh-keygen/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.5 2019/10/12 18:32:21 christos Exp $
# $NetBSD: Makefile,v 1.6 2019/10/13 07:28:05 mrg Exp $

BINDIR= /usr/bin

Expand All @@ -7,4 +7,6 @@ SRCS= ssh-keygen.c moduli.c sshsig.c

COPTS.ssh-keygen.c= -Wno-pointer-sign

COPTS.ssh-keygen.c+= ${GCC_NO_FORMAT_TRUNCATION}

.include <bsd.prog.mk>
4 changes: 3 additions & 1 deletion crypto/external/bsd/openssh/bin/ssh/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.14 2018/04/06 18:58:59 christos Exp $
# $NetBSD: Makefile,v 1.15 2019/10/13 07:28:05 mrg Exp $

.include <bsd.own.mk>

Expand All @@ -23,4 +23,6 @@ LDADD+= -lgssapi -lheimntlm ${LIBKRB5_LDADD}
DPADD+= ${LIBGSSAPI} ${LIBHEIMNTLM} ${LIBKRB5_DPADD}
.endif

COPTS.sshconnect.c+= ${GCC_NO_FORMAT_TRUNCATION}

.include <bsd.prog.mk>
9 changes: 6 additions & 3 deletions crypto/external/bsd/openssh/bin/sshd/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.18 2019/10/12 18:32:21 christos Exp $
# $NetBSD: Makefile,v 1.19 2019/10/13 07:28:05 mrg Exp $

.include <bsd.own.mk>

Expand Down Expand Up @@ -58,8 +58,6 @@ LDADD+= -lldap -lssl -llber
DPADD+= ${LIBLDAP} ${LIBSSL} ${LIBLBER}
.endif

.include <bsd.prog.mk>

LDADD+= -lcrypt -lutil
DPADD+= ${LIBCRYPT} ${LIBUTIL}

Expand All @@ -72,3 +70,8 @@ CPPFLAGS+=-DSMALL
LDADD+= -lblacklist
DPADD+= ${LIBBLACKLIST}
.endif

COPTS.sshlogin.c+= ${GCC_NO_STRINGOP_TRUNCATION}
COPTS.ldapauth.c+= ${GCC_NO_STRINGOP_TRUNCATION} ${GCC_NO_STRINGOP_OVERFLOW}

.include <bsd.prog.mk>
5 changes: 4 additions & 1 deletion crypto/external/bsd/openssh/lib/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.28 2019/10/12 18:32:22 christos Exp $
# $NetBSD: Makefile,v 1.29 2019/10/13 07:28:05 mrg Exp $

.include <bsd.own.mk>

Expand Down Expand Up @@ -120,4 +120,7 @@ COPTS.poly1305.c+= -O0
COPTS.umac.c+= -O0
.endif

COPTS.hostfile.c+= ${GCC_NO_FORMAT_TRUNCATION}
COPTS.sshkey.c+= ${GCC_NO_FORMAT_TRUNCATION}

.include <bsd.lib.mk>
3 changes: 2 additions & 1 deletion external/bsd/am-utils/bin/amd/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.12 2017/05/21 15:28:38 riastradh Exp $
# $NetBSD: Makefile,v 1.13 2019/10/13 07:28:05 mrg Exp $

.include "${.CURDIR}/../Makefile.inc"

Expand Down Expand Up @@ -73,5 +73,6 @@ build_version.h: get_args.c
echo '#define BUILD_HOST "'unknown'"' >> ${.TARGET}
echo '#define BUILD_DATE "'unknown'"' >> ${.TARGET}

COPTS.sun_map.c+= ${GCC_NO_STRINGOP_TRUNCATION}

.include <bsd.prog.mk>
6 changes: 2 additions & 4 deletions external/bsd/fetch/lib/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.14 2019/10/10 02:30:43 kre Exp $
# $NetBSD: Makefile,v 1.15 2019/10/13 07:28:05 mrg Exp $

LIB= fetch
SRCS= fetch.c common.c ftp.c http.c file.c
Expand Down Expand Up @@ -36,8 +36,6 @@ httperr.h: ${LIBFETCHDIR}/http.errors ${LIBFETCHDIR}/errlist.sh
CFLAGS+= -Wno-macro-redefined # _REENTRANT redefined
.endif

.if defined(HAVE_GCC) && ${HAVE_GCC} >= 8 && ${ACTIVE_CC} == "gcc"
COPTS.http.c += -Wno-error=stringop-truncation
.endif
COPTS.http.c+= ${GCC_NO_STRINGOP_TRUNCATION}

.include <bsd.lib.mk>
5 changes: 4 additions & 1 deletion external/bsd/flex/bin/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# from: @(#)Makefile 5.4 (Berkeley) 6/24/90
# $NetBSD: Makefile,v 1.14 2019/09/29 23:44:58 mrg Exp $
# $NetBSD: Makefile,v 1.15 2019/10/13 07:28:06 mrg Exp $
#
# By default, flex will be configured to generate 8-bit scanners only if the
# -8 flag is given. If you want it to always generate 8-bit scanners, add
Expand Down Expand Up @@ -78,4 +78,7 @@ COPTS.scan.c+= -O1
. endif
.endif

COPTS.filter.c+= ${GCC_NO_FORMAT_TRUNCATION}
COPTS.misc.c+= ${GCC_NO_FORMAT_TRUNCATION}

.include <bsd.prog.mk>
4 changes: 3 additions & 1 deletion external/bsd/ipf/Makefile.inc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# $NetBSD: Makefile.inc,v 1.3 2017/01/11 12:19:43 joerg Exp $
# $NetBSD: Makefile.inc,v 1.4 2019/10/13 07:28:06 mrg Exp $

WARNS?= 1 # XXX -Wcast-qual -Wshadow
CWARNFLAGS.clang+= -Wno-format -Wno-tautological-compare \
Expand Down Expand Up @@ -32,6 +32,8 @@ LDADD+= -L${IPFOBJDIR} -lipf -lkvm

CLEANFILES+= y.tab.c y.tab.h

COPTS+= ${GCC_NO_STRINGOP_TRUNCATION}

.PATH: ${UDIST} \
${UDIST}/lib \
${UDIST}/tools \
Expand Down
4 changes: 3 additions & 1 deletion external/bsd/ipf/bin/ipftest/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.6 2019/09/29 23:44:58 mrg Exp $
# $NetBSD: Makefile,v 1.7 2019/10/13 07:28:06 mrg Exp $

.include <bsd.own.mk>

Expand Down Expand Up @@ -109,4 +109,6 @@ COPTS.ipf_y.c+= -O1
. endif
.endif

COPTS.fil.c+= ${GCC_NO_STRINGOP_OVERFLOW}

.include <bsd.prog.mk>
4 changes: 3 additions & 1 deletion external/bsd/iscsi/lib/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.4 2012/01/01 01:19:20 wrstuden Exp $
# $NetBSD: Makefile,v 1.5 2019/10/13 07:28:06 mrg Exp $

.include <bsd.own.mk>

Expand All @@ -23,4 +23,6 @@ ISCSIDIST= ${.CURDIR}/../dist

LIBDPLIBS+= pthread ${.CURDIR}/../../../../lib/libpthread

COPTS.target.c+= ${GCC_NO_FORMAT_TRUNCATION}

.include <bsd.lib.mk>
5 changes: 4 additions & 1 deletion external/bsd/libarchive/lib/libarchive/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.10 2019/07/24 14:07:17 joerg Exp $
# $NetBSD: Makefile,v 1.11 2019/10/13 07:28:06 mrg Exp $

.include <bsd.init.mk>

Expand Down Expand Up @@ -455,4 +455,7 @@ COPTS.archive_read_support_format_7zip.c += -Wno-error=implicit-fallthrough
COPTS.archive_read_support_format_mtree.c += -Wno-error=implicit-fallthrough
.endif

COPTS.target.c+= ${GCC_NO_STRINGOP_TRUNCATION}
COPTS.archive_write_set_format_iso9660.c+= ${GCC_NO_STRINGOP_TRUNCATION}

.include <bsd.lib.mk>
9 changes: 4 additions & 5 deletions external/bsd/libpcap/lib/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.25 2019/10/01 16:02:12 christos Exp $
# $NetBSD: Makefile,v 1.26 2019/10/13 07:28:06 mrg Exp $

USE_SHLIBDIR=yes
.include <bsd.own.mk>
Expand Down Expand Up @@ -165,10 +165,9 @@ CLEANFILES+= tokdefs.h scanner.h

COPTS.bpf_image.c+= -Wno-format-nonliteral

.if defined(HAVE_GCC) && ${HAVE_GCC} >= 7 && ${ACTIVE_CC} == "gcc"
COPTS.pcap.c+= -Wno-error=format-truncation
COPTS.gencode.c+= -Wno-error=implicit-fallthrough
.endif
COPTS.gencode.c+= ${${ACTIVE_CC} == "gcc" && ${HAVE_GCC:U0} >= 7:? -Wno-error=implicit-fallthrough :}
COPTS.pcap.c+= ${GCC_NO_FORMAT_TRUNCATION}
COPTS.pcap-bpf.c+= ${GCC_NO_STRINGOP_TRUNCATION}

CWARNFLAGS.clang+= -Wno-format-extra-args \
-Wno-unneeded-internal-declaration
Expand Down
3 changes: 2 additions & 1 deletion external/bsd/llvm/lib/libLLVMAnalysis/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.25 2018/07/17 18:55:27 joerg Exp $
# $NetBSD: Makefile,v 1.26 2019/10/13 07:28:06 mrg Exp $

LIB= LLVMAnalysis

Expand Down Expand Up @@ -99,4 +99,5 @@ SRCS+= AliasAnalysis.cpp \
.include <bsd.hostlib.mk>
.else
.include <bsd.lib.mk>
COPTS.ValueTracking.cpp+= ${GCC_NO_STRINGOP_OVERFLOW}
.endif
3 changes: 2 additions & 1 deletion external/bsd/llvm/lib/libLLVMRuntimeDyld/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.10 2019/03/10 12:14:06 mrg Exp $
# $NetBSD: Makefile,v 1.11 2019/10/13 07:28:06 mrg Exp $

LIB= LLVMRuntimeDyld

Expand All @@ -21,4 +21,5 @@ SRCS+= RuntimeDyldELFMips.cpp
.include <bsd.hostlib.mk>
.else
.include <bsd.lib.mk>
COPTS.RuntimeDyldChecker.cpp+= ${GCC_NO_STRINGOP_OVERFLOW}
.endif
4 changes: 3 additions & 1 deletion external/bsd/mdocml/bin/mandoc/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.18 2019/03/11 17:59:28 christos Exp $
# $NetBSD: Makefile,v 1.19 2019/10/13 07:28:06 mrg Exp $

.include <bsd.own.mk>

Expand Down Expand Up @@ -46,4 +46,6 @@ SRCS+= ${SRCS.libmandoc} compat_strtonum.c compat_reallocarray.c

COPTS.man_term.c+= -Wno-error=array-bounds

COPTS.tbl_term.c+= ${GCC_NO_FORMAT_TRUNCATION}

.include <bsd.prog.mk>
7 changes: 6 additions & 1 deletion external/bsd/ntp/bin/ntpd/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.23 2019/10/04 09:47:27 mrg Exp $
# $NetBSD: Makefile,v 1.24 2019/10/13 07:28:07 mrg Exp $

.include <bsd.own.mk>

Expand Down Expand Up @@ -93,5 +93,10 @@ COPTS.ntp_control.c+= -Wno-error=maybe-uninitialized
.endif

COPTS.ntp_loopfilter.c+= ${${ACTIVE_CC} == "gcc" && ${HAVE_GCC:U0} == 8:? -Wno-error=restrict :}
COPTS.ntp_loopfilter.c+= ${GCC_NO_FORMAT_TRUNCATION}
COPTS.ntp_crypto.c+= ${GCC_NO_FORMAT_TRUNCATION}
COPTS.refclock_parse.c+= ${GCC_NO_FORMAT_TRUNCATION}
COPTS.refclock_leitch.c+= ${GCC_NO_FORMAT_TRUNCATION}
COPTS.refclock_neoclock4x.c+= ${GCC_NO_FORMAT_TRUNCATION}

.include <bsd.prog.mk>
4 changes: 3 additions & 1 deletion external/bsd/ntp/bin/ntpq/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.7 2013/12/28 03:19:43 christos Exp $
# $NetBSD: Makefile,v 1.8 2019/10/13 07:28:07 mrg Exp $

.include <bsd.own.mk>

Expand All @@ -21,4 +21,6 @@ CPPFLAGS+=-I${IDIST}/include -I${IDIST}/sntp/libopts

.PATH: ${DIST}

COPTS.ntpq.c+= ${GCC_NO_STRINGOP_TRUNCATION}

.include <bsd.prog.mk>
4 changes: 3 additions & 1 deletion external/bsd/ntp/bin/sntp/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.6 2013/12/28 03:19:43 christos Exp $
# $NetBSD: Makefile,v 1.7 2019/10/13 07:28:07 mrg Exp $

USE_FORT?= yes # network client/server

Expand Down Expand Up @@ -31,4 +31,6 @@ CPPFLAGS+= -DSAVENAME=\"/var/db/sntp.state\"
LDADD+= -L${LIBISC} -liscntp -levent -lm
DPADD+= ${LIBM} ${LIBEVENT}

COPTS.utilities.c+= ${GCC_NO_FORMAT_TRUNCATION}

.include <bsd.prog.mk>
4 changes: 3 additions & 1 deletion external/bsd/ntp/lib/libntp/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.20 2018/02/02 01:02:40 mrg Exp $
# $NetBSD: Makefile,v 1.21 2019/10/13 07:28:07 mrg Exp $

LIBISPRIVATE=yes

Expand Down Expand Up @@ -99,4 +99,6 @@ CPPFLAGS.ntp_calendar.c += -DMKREPRO_DATE=\"${MKREPRO_DATE:Q}\"
CPPFLAGS.ntp_calendar.c += -DMKREPRO_TIME=\"${MKREPRO_TIME:Q}\"
.endif

COPTS.timetoa.c+= ${GCC_NO_FORMAT_TRUNCATION}

.include <bsd.lib.mk>
11 changes: 7 additions & 4 deletions external/bsd/pdisk/bin/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.3 2019/09/29 23:44:59 mrg Exp $
# $NetBSD: Makefile,v 1.4 2019/10/13 07:28:07 mrg Exp $

.include <bsd.own.mk>
WARNS=5
Expand All @@ -21,9 +21,12 @@ CPPFLAGS+= -I${SRCDIR}
CPPFLAGS+= -D__unix__

.if defined(HAVE_GCC) && ${HAVE_GCC} >= 7 && ${ACTIVE_CC} == "gcc"
COPTS.file_media.c+= -Wno-error=implicit-fallthrough
COPTS.pathname.c+= -Wno-error=implicit-fallthrough
COPTS.pdisk.c+= -Wno-error=implicit-fallthrough
COPTS.file_media.c+= -Wno-implicit-fallthrough
COPTS.pathname.c+= -Wno-implicit-fallthrough
COPTS.pdisk.c+= -Wno-implicit-fallthrough
.endif

COPTS.partition_map.c+= ${GCC_NO_STRINGOP_TRUNCATION}
COPTS.pdisk.c+= ${GCC_NO_STRINGOP_TRUNCATION}

.include <bsd.prog.mk>
4 changes: 3 additions & 1 deletion external/bsd/ppp/usr.sbin/pppd/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.1 2013/11/28 22:33:43 christos Exp $
# $NetBSD: Makefile,v 1.2 2019/10/13 07:28:07 mrg Exp $

.include "../Makefile.inc"

Expand Down Expand Up @@ -39,4 +39,6 @@ COPTS.${f}.c+= -Wno-pointer-sign

CWARNFLAGS.clang+= -Wno-tautological-compare

COPTS.session.c+= ${GCC_NO_STRINGOP_TRUNCATION}

.include <bsd.prog.mk>
4 changes: 3 additions & 1 deletion external/bsd/ppp/usr.sbin/pppstats/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.1 2013/11/28 22:33:43 christos Exp $
# $NetBSD: Makefile,v 1.2 2019/10/13 07:28:07 mrg Exp $

.include "../Makefile.inc"

Expand All @@ -9,4 +9,6 @@ MAN= pppstats.8
LINKS= ${BINDIR}/pppstats ${BINDIR}/slstats
MLINKS= pppstats.8 slstats.8

COPTS.pppstats.c+= ${GCC_NO_STRINGOP_TRUNCATION}

.include <bsd.prog.mk>
Loading

0 comments on commit de11d87

Please sign in to comment.