From 03ac74ede908465cc64c671bbd209e761dc765dc Mon Sep 17 00:00:00 2001 From: Lionel Sambuc Date: Sat, 31 Mar 2018 19:34:03 +0200 Subject: [PATCH] Fix ARM NDEBUG Builds Change-Id: I1250744d54b75d6380393afe848a6eb8c5dc894d --- external/bsd/bind/bin/named/Makefile | 4 ++++ external/bsd/bind/dist/lib/lwres/lwconfig.c | 6 ++++++ external/bsd/bind/lib/libdns/Makefile | 5 +++++ external/bsd/bind/lib/libisc/Makefile | 5 +++++ external/bsd/dhcp/lib/common/Makefile | 8 ++++++++ external/bsd/dhcpcd/sbin/dhcpcd/Makefile | 4 ++++ external/bsd/nvi/usr.bin/nvi/Makefile | 8 ++++++++ external/bsd/tcpdump/bin/Makefile | 6 ++++++ external/public-domain/sqlite/lib/Makefile | 8 ++++++++ lib/libbz2/Makefile | 8 ++++++++ libexec/httpd/Makefile | 8 ++++++++ minix/net/lwip/Makefile | 8 ++++++++ minix/net/lwip/addr.c | 9 ++++++++- minix/net/lwip/lldata.c | 4 ++-- minix/net/lwip/rttree.c | 2 +- minix/net/lwip/tcpisn.c | 2 +- minix/net/uds/Makefile | 8 ++++++++ minix/net/uds/io.c | 2 +- minix/servers/mib/Makefile | 8 ++++++++ minix/servers/vfs/Makefile | 5 +++++ minix/servers/vfs/misc.c | 9 ++++++++- sbin/ifconfig/Makefile | 3 +++ usr.bin/ftp/Makefile | 8 ++++++++ usr.bin/m4/Makefile | 8 ++++++++ 24 files changed, 139 insertions(+), 7 deletions(-) diff --git a/external/bsd/bind/bin/named/Makefile b/external/bsd/bind/bin/named/Makefile index 95a4942e1..b2102422b 100644 --- a/external/bsd/bind/bin/named/Makefile +++ b/external/bsd/bind/bin/named/Makefile @@ -7,6 +7,10 @@ MAN= named.8 lwresd.8 named.conf.5 BINDIR= /usr/sbin LINKS= ${BINDIR}/named ${BINDIR}/lwresd +.if defined(__MINIX) +CWARNFLAGS.gcc+= -Wno-maybe-uninitialized +.endif # defined(__MINIX) + .include "${.CURDIR}/../Makefile.inc" DIST=${IDIST}/bin/named diff --git a/external/bsd/bind/dist/lib/lwres/lwconfig.c b/external/bsd/bind/dist/lib/lwres/lwconfig.c index 28d118179..3dff9000f 100644 --- a/external/bsd/bind/dist/lib/lwres/lwconfig.c +++ b/external/bsd/bind/dist/lib/lwres/lwconfig.c @@ -606,15 +606,21 @@ lwres_conf_parse(lwres_context_t *ctx, const char *filename) { FILE *fp = NULL; char word[256]; lwres_result_t rval, ret; +#if !defined(NDEBUG) && defined(__minix) lwres_conf_t *confdata; +#endif /* !defined(NDEBUG) && defined(__minix) */ int stopchar; REQUIRE(ctx != NULL); +#if !defined(NDEBUG) && defined(__minix) confdata = &ctx->confdata; +#endif /* !defined(NDEBUG) && defined(__minix) */ REQUIRE(filename != NULL); REQUIRE(strlen(filename) > 0U); +#if !defined(NDEBUG) && defined(__minix) REQUIRE(confdata != NULL); +#endif /* !defined(NDEBUG) && defined(__minix) */ errno = 0; if ((fp = fopen(filename, "r")) == NULL) diff --git a/external/bsd/bind/lib/libdns/Makefile b/external/bsd/bind/lib/libdns/Makefile index 2dd7b53ce..bafe8936b 100644 --- a/external/bsd/bind/lib/libdns/Makefile +++ b/external/bsd/bind/lib/libdns/Makefile @@ -7,6 +7,11 @@ LIB=dns .include "${.CURDIR}/../Makefile.inc" +.if defined(__MINIX) +#LSC: -Wno-maybe-uninitialized while compiling with -DNDEBUG -Os +CWARNFLAGS.gcc+= -Wno-maybe-uninitialized +.endif # defined(__MINIX) + DIST= ${IDIST}/lib/dns .include "${DIST}/api" .include "${DIST}/mapapi" diff --git a/external/bsd/bind/lib/libisc/Makefile b/external/bsd/bind/lib/libisc/Makefile index 319912155..ec247b9e9 100644 --- a/external/bsd/bind/lib/libisc/Makefile +++ b/external/bsd/bind/lib/libisc/Makefile @@ -5,6 +5,11 @@ LIB=isc .include +.if defined(__MINIX) +#LSC: -Wno-maybe-uninitialized while compiling with -DNDEBUG -Os +CWARNFLAGS.gcc+= -Wno-maybe-uninitialized +.endif # defined(__MINIX) + .include "${.CURDIR}/../Makefile.inc" DIST= ${IDIST}/lib/isc diff --git a/external/bsd/dhcp/lib/common/Makefile b/external/bsd/dhcp/lib/common/Makefile index ef92a37fc..a6f2100ca 100644 --- a/external/bsd/dhcp/lib/common/Makefile +++ b/external/bsd/dhcp/lib/common/Makefile @@ -12,3 +12,11 @@ MAN = dhcp-options.5 dhcp-eval.5 DHCPSRCDIR= common .include + +.if defined(__MINIX) +.if !empty(DBG:M-Og) || !empty(CFLAGS:M-Og) || \ + !empty(DBG:M-g) || !empty(CFLAGS:M-g) +#LSC: -Wno-maybe-uninitialized while compiling with -DNDEBUG -Og +CWARNFLAGS.gcc+= -Wno-maybe-uninitialized +.endif +.endif # defined(__MINIX) diff --git a/external/bsd/dhcpcd/sbin/dhcpcd/Makefile b/external/bsd/dhcpcd/sbin/dhcpcd/Makefile index 55d01c71c..2877e6752 100644 --- a/external/bsd/dhcpcd/sbin/dhcpcd/Makefile +++ b/external/bsd/dhcpcd/sbin/dhcpcd/Makefile @@ -14,6 +14,10 @@ CPPFLAGS+= -DHAVE_CONFIG_H .include +.if defined(__MINIX) +CWARNFLAGS.gcc+= -Wno-maybe-uninitialized +.endif # defined(__MINIX) + SRCS+= auth.c hmac_md5.c USE_INET?= yes diff --git a/external/bsd/nvi/usr.bin/nvi/Makefile b/external/bsd/nvi/usr.bin/nvi/Makefile index ccee9484b..d1756ae5c 100644 --- a/external/bsd/nvi/usr.bin/nvi/Makefile +++ b/external/bsd/nvi/usr.bin/nvi/Makefile @@ -6,6 +6,14 @@ USE_WIDECHAR?=yes CWARNFLAGS.clang+= -Wno-uninitialized -Wno-format-security +.if defined(__MINIX) +.if !empty(DBG:M-Og) || !empty(CFLAGS:M-Og) || \ + !empty(DBG:M-g) || !empty(CFLAGS:M-g) +#LSC: -Wno-maybe-uninitialized while compiling with -DNDEBUG -Og +CWARNFLAGS.gcc+= -Wno-maybe-uninitialized +.endif +.endif # defined(__MINIX) + CPPFLAGS+=-I${DIST}/include -I${.CURDIR} -I. -DGTAGS #DBG=-g #CPPFLAGS+=-DLOGDEBUG -DTRACE diff --git a/external/bsd/tcpdump/bin/Makefile b/external/bsd/tcpdump/bin/Makefile index e0e83b299..5caf234a1 100644 --- a/external/bsd/tcpdump/bin/Makefile +++ b/external/bsd/tcpdump/bin/Makefile @@ -6,6 +6,12 @@ CWARNFLAGS.clang+= -Wno-constant-logical-operand -Wno-error=unused-function .include +.if defined(__MINIX) +#LSC: -Wno-unused-but-set-variable while compiling with -DNDEBUG -O2 +#LSC: -Wno-maybe-uninitialized while compiling with -DNDEBUG -O3 +CWARNFLAGS.gcc+= -Wno-unused-but-set-variable -Wno-maybe-uninitialized +.endif # defined(__MINIX) + USE_FORT?= yes # network client BINDIR=/usr/sbin diff --git a/external/public-domain/sqlite/lib/Makefile b/external/public-domain/sqlite/lib/Makefile index 2e107ef99..6e56bc2eb 100644 --- a/external/public-domain/sqlite/lib/Makefile +++ b/external/public-domain/sqlite/lib/Makefile @@ -18,6 +18,14 @@ CLEANFILES+=sqlite3.pc .include +.if defined(__MINIX) +.if !empty(DBG:M-Og) || !empty(CFLAGS:M-Og) || \ + !empty(DBG:M-g) || !empty(CFLAGS:M-g) +#LSC: -Wno-maybe-uninitialized while compiling with -DNDEBUG -Og +CWARNFLAGS.gcc+= -Wno-maybe-uninitialized +.endif +.endif # defined(__MINIX) + all: sqlite3.pc dependall: all diff --git a/lib/libbz2/Makefile b/lib/libbz2/Makefile index ef8182745..11b6c1b49 100644 --- a/lib/libbz2/Makefile +++ b/lib/libbz2/Makefile @@ -15,6 +15,14 @@ SRCS= blocksort.c huffman.c crctable.c randtable.c compress.c \ INCS= bzlib.h INCSDIR= /usr/include +.if defined(__MINIX) +.if !empty(DBG:M-Og) || !empty(CFLAGS:M-Og) || \ + !empty(DBG:M-g) || !empty(CFLAGS:M-g) +#LSC: -Wno-maybe-uninitialized while compiling with -DNDEBUG -Og +CWARNFLAGS.gcc+= -Wno-maybe-uninitialized +.endif +.endif # defined(__MINIX) + # XXX huffman.c gets mis-compiled with 2.95.3 .if ${MACHINE_ARCH} == "vax" COPTS+= -O0 diff --git a/libexec/httpd/Makefile b/libexec/httpd/Makefile index db2e3e48e..659b631ee 100644 --- a/libexec/httpd/Makefile +++ b/libexec/httpd/Makefile @@ -50,6 +50,14 @@ LDADD+= -lnbutil .include +.if defined(__MINIX) +.if !empty(DBG:M-Og) || !empty(CFLAGS:M-Og) || \ + !empty(DBG:M-g) || !empty(CFLAGS:M-g) +#LSC: -Wno-maybe-uninitialized while compiling with -DNDEBUG -Og +CWARNFLAGS.gcc+= -Wno-maybe-uninitialized +.endif +.endif # defined(__MINIX) + .if ${MKCRYPTO} != "no" LDADD+= -lssl -lcrypto diff --git a/minix/net/lwip/Makefile b/minix/net/lwip/Makefile index a463dcfcd..15083862b 100644 --- a/minix/net/lwip/Makefile +++ b/minix/net/lwip/Makefile @@ -31,4 +31,12 @@ LDADD+= -llwip -lsockevent -lsockdriver -lchardriver -lsys -ltimers WARNS?= 5 +.if defined(__MINIX) +.if !empty(DBG:M-Og) || !empty(CFLAGS:M-Og) || \ + !empty(DBG:M-g) || !empty(CFLAGS:M-g) +#LSC: -Wno-maybe-uninitialized while compiling with -DNDEBUG -Og +CWARNFLAGS.gcc+= -Wno-maybe-uninitialized +.endif +.endif # defined(__MINIX) + .include diff --git a/minix/net/lwip/addr.c b/minix/net/lwip/addr.c index 845092124..246a31fa8 100644 --- a/minix/net/lwip/addr.c +++ b/minix/net/lwip/addr.c @@ -581,7 +581,10 @@ addr_put_netmask(struct sockaddr * addr, socklen_t * addr_len, uint8_t type, void addr_normalize(ip_addr_t * dst, const ip_addr_t * src, unsigned int prefix) { - unsigned int addr_len, byte, bit; +#if !defined(NDEBUG) + unsigned int addr_len; +#endif /* !defined(NDEBUG) */ + unsigned int byte, bit; const uint8_t *srcaddr; uint8_t type, *dstaddr; @@ -594,7 +597,9 @@ addr_normalize(ip_addr_t * dst, const ip_addr_t * src, unsigned int prefix) case IPADDR_TYPE_V4: srcaddr = (const uint8_t *)&ip_2_ip4(src)->addr; dstaddr = (uint8_t *)&ip_2_ip4(dst)->addr; +#if !defined(NDEBUG) addr_len = sizeof(ip_2_ip4(src)->addr); +#endif /* !defined(NDEBUG) */ break; @@ -603,7 +608,9 @@ addr_normalize(ip_addr_t * dst, const ip_addr_t * src, unsigned int prefix) srcaddr = (const uint8_t *)&ip_2_ip6(src)->addr; dstaddr = (uint8_t *)&ip_2_ip6(dst)->addr; +#if !defined(NDEBUG) addr_len = sizeof(ip_2_ip6(src)->addr); +#endif /* !defined(NDEBUG) */ break; diff --git a/minix/net/lwip/lldata.c b/minix/net/lwip/lldata.c index 80050c78c..3867c3985 100644 --- a/minix/net/lwip/lldata.c +++ b/minix/net/lwip/lldata.c @@ -425,9 +425,9 @@ lldata_ndp_get(lldata_ndp_num_t num, struct sockaddr_in6 * addr, { const ip6_addr_t *ip6addr; ip_addr_t ipaddr; - struct netif *netif; + struct netif *netif = NULL /*gcc*/; struct ifdev *ifdev; - const uint8_t *lladdr; + const uint8_t *lladdr = NULL /*gcc*/; socklen_t addr_len; ip6addr = nd6_get_neighbor_cache_entry(num, &netif, &lladdr, diff --git a/minix/net/lwip/rttree.c b/minix/net/lwip/rttree.c index eb0033464..73e22495a 100644 --- a/minix/net/lwip/rttree.c +++ b/minix/net/lwip/rttree.c @@ -476,7 +476,7 @@ rttree_add(struct rttree * tree, struct rttree_entry * entry, { struct rttree_node *node, *parent, *link; struct rttree_entry *other_entry; - unsigned int bit, side, side2; + unsigned int bit = 0 /*gcc*/, side, side2; int match; assert(mask != NULL || prefix == tree->rtt_bits); diff --git a/minix/net/lwip/tcpisn.c b/minix/net/lwip/tcpisn.c index 382cf32c2..bf72bc732 100644 --- a/minix/net/lwip/tcpisn.c +++ b/minix/net/lwip/tcpisn.c @@ -78,7 +78,7 @@ tcpisn_secret(struct rmib_call * call __unused, struct rmib_newp * newp) { uint8_t secret[TCPISN_SECRET_HEX_LENGTH], byte, *p; - unsigned int i; + unsigned int i = 0 /*gcc*/; int r; /* First copy out the old (current) ISN secret. */ diff --git a/minix/net/uds/Makefile b/minix/net/uds/Makefile index a85c4483e..bf8ba954f 100644 --- a/minix/net/uds/Makefile +++ b/minix/net/uds/Makefile @@ -10,6 +10,14 @@ FILESDIR= /etc/system.conf.d DPADD+= ${LIBSOCKEVENT} ${LIBSOCKDRIVER} ${LIBSYS} ${LIBTIMERS} LDADD+= -lsockevent -lsockdriver -lsys -ltimers +.if !empty(DBG:M-Os) || !empty(CFLAGS:M-Os) || \ + !empty(DBG:M-Og) || !empty(CFLAGS:M-Og) || \ + !empty(DBG:M-g) || !empty(CFLAGS:M-g) +#LSC: -Wno-maybe-uninitialized while compiling with -DNDEBUG -Os +#LSC: -Wno-maybe-uninitialized while compiling with -DNDEBUG -Og +CWARNFLAGS.gcc+= -Wno-maybe-uninitialized +.endif + WARNS?= 5 .include diff --git a/minix/net/uds/io.c b/minix/net/uds/io.c index 37333c296..1c82940f0 100644 --- a/minix/net/uds/io.c +++ b/minix/net/uds/io.c @@ -1694,7 +1694,7 @@ uds_recv(struct sock * sock, const struct sockdriver_data * data, size_t len, struct udssock *uds = (struct udssock *)sock; size_t seglen, datalen, reslen = 0 /*gcc*/, credpos = 0 /*gcc*/; unsigned int segflags; - int r, partial, may_block; + int r, partial, may_block = 0 /*gcc*/; dprintf(("UDS: recv(%d,%zu,%zu,%u,%u,0x%x)\n", uds_get_id(uds), len, (off != NULL) ? *off : 0, ctl_len, diff --git a/minix/servers/mib/Makefile b/minix/servers/mib/Makefile index bc241a0e2..6b482b5da 100644 --- a/minix/servers/mib/Makefile +++ b/minix/servers/mib/Makefile @@ -1,5 +1,13 @@ # Makefile for the Management Information Base (MIB) server +.include + +.if !empty(DBG:M-Og) || !empty(CFLAGS:M-Og) || \ + !empty(DBG:M-g) || !empty(CFLAGS:M-g) +#LSC: -Wno-maybe-uninitialized while compiling with -DNDEBUG -Og +CWARNFLAGS.gcc+= -Wno-maybe-uninitialized +.endif + PROG= mib SRCS= main.c tree.c remote.c kern.c vm.c hw.c proc.c minix.c diff --git a/minix/servers/vfs/Makefile b/minix/servers/vfs/Makefile index c1ff239b9..a9595a381 100644 --- a/minix/servers/vfs/Makefile +++ b/minix/servers/vfs/Makefile @@ -15,6 +15,11 @@ SRCS+= gcov.c CPPFLAGS+= -DUSE_COVERAGE .endif +.if defined(__MINIX) +#LSC: -Wno-maybe-uninitialized while compiling with -DNDEBUG -O3 +CWARNFLAGS.gcc+= -Wno-maybe-uninitialized +.endif # defined(__MINIX) + CFLAGS+= -Wall -Wextra -Wno-sign-compare -Werror DPADD+= ${LIBSYS} ${LIBTIMERS} ${LIBEXEC} LDADD+= -lsys -ltimers -lexec -lmthread diff --git a/minix/servers/vfs/misc.c b/minix/servers/vfs/misc.c index b9336f3cc..dfc65b424 100644 --- a/minix/servers/vfs/misc.c +++ b/minix/servers/vfs/misc.c @@ -581,7 +581,10 @@ void pm_fork(endpoint_t pproc, endpoint_t cproc, pid_t cpid) * The parent and child parameters tell who forked off whom. The file * system uses the same slot numbers as the kernel. Only PM makes this call. */ - struct fproc *cp, *pp; + struct fproc *cp; +#if !defined(NDEBUG) + struct fproc *pp; +#endif /* !defined(NDEBUG) */ int i, parentno, childno; mutex_t c_fp_lock; @@ -606,7 +609,9 @@ void pm_fork(endpoint_t pproc, endpoint_t cproc, pid_t cpid) /* Increase the counters in the 'filp' table. */ cp = &fproc[childno]; +#if !defined(NDEBUG) pp = &fproc[parentno]; +#endif /* !defined(NDEBUG) */ for (i = 0; i < OPEN_MAX; i++) if (cp->fp_filp[i] != NULL) cp->fp_filp[i]->filp_count++; @@ -615,8 +620,10 @@ void pm_fork(endpoint_t pproc, endpoint_t cproc, pid_t cpid) cp->fp_pid = cpid; cp->fp_endpoint = cproc; +#if !defined(NDEBUG) /* A forking process cannot possibly be suspended on anything. */ assert(pp->fp_blocked_on == FP_BLOCKED_ON_NONE); +#endif /* !defined(NDEBUG) */ /* A child is not a process leader, not being revived, etc. */ cp->fp_flags = FP_NOFLAGS; diff --git a/sbin/ifconfig/Makefile b/sbin/ifconfig/Makefile index 2aef6ef46..928025d39 100644 --- a/sbin/ifconfig/Makefile +++ b/sbin/ifconfig/Makefile @@ -10,6 +10,9 @@ RUMPPRG=ifconfig MAN= ifconfig.8 +.if defined(__MINIX) +CWARNFLAGS.gcc+= -Wno-unused-but-set-variable +.endif # defined(__MINIX) #DBG+=-g SRCS= af_atalk.c af_link.c carp.c .if (${USE_INET6} != "no") diff --git a/usr.bin/ftp/Makefile b/usr.bin/ftp/Makefile index fd3306966..a8aab2c41 100644 --- a/usr.bin/ftp/Makefile +++ b/usr.bin/ftp/Makefile @@ -9,6 +9,14 @@ PROG= ftp SRCS= cmds.c cmdtab.c complete.c domacro.c fetch.c ftp.c main.c \ progressbar.c ruserpass.c util.c +.if defined(__MINIX) +.if !empty(DBG:M-Og) || !empty(CFLAGS:M-Og) || \ + !empty(DBG:M-g) || !empty(CFLAGS:M-g) +#LSC: -Wno-maybe-uninitialized while compiling with -DNDEBUG -Og +CWARNFLAGS.gcc+= -Wno-maybe-uninitialized -Wno-clobbered +.endif +.endif # defined(__MINIX) + # Uncomment the following to provide defaults for gate-ftp operation # #CPPFLAGS+=-DGATE_SERVER=\"ftp-gw.host\" # -DGATE_PORT=21 diff --git a/usr.bin/m4/Makefile b/usr.bin/m4/Makefile index 26944ebc6..d72b181bd 100644 --- a/usr.bin/m4/Makefile +++ b/usr.bin/m4/Makefile @@ -6,6 +6,14 @@ # if you want the paste & spaste macros. .include +.if defined(__MINIX) +.if !empty(DBG:M-Og) || !empty(CFLAGS:M-Og) || \ + !empty(DBG:M-g) || !empty(CFLAGS:M-g) +#LSC: -Wno-maybe-uninitialized while compiling with -DNDEBUG -Og +CWARNFLAGS.gcc+= -Wno-maybe-uninitialized +.endif +.endif # defined(__MINIX) + PROG= m4 CPPFLAGS+= -DEXTENDED -I${.CURDIR}/lib SRCS= parser.y tokenizer.l eval.c expr.c look.c main.c misc.c gnum4.c trace.c -- 2.44.0