From: Lionel Sambuc Date: Tue, 2 Sep 2014 13:22:15 +0000 (+0200) Subject: Fix -DNEDUG builds X-Git-Tag: v3.3.0~26 X-Git-Url: http://zhaoyanbai.com/repos/man.isc-hmac-fixup.html?a=commitdiff_plain;h=20a91f7755ccb876035f671d877a5065507dc887;p=minix.git Fix -DNEDUG builds - assert() is macro which is defined as empty, while panic is always present. I added an explicit abort() after the macro to make sure the function never returns in case of wrong flags. - Fixed gcc build with -NDEBUG, -Os for ARM. * A few 'may be used uninitialized' messages * A few new missing support library functions where added in libminc. Change-Id: I69fcda2cd3888390b7ddeff4c0cd849105ce86ff --- diff --git a/external/bsd/flex/dist/scanopt.c b/external/bsd/flex/dist/scanopt.c index cad3a9685..527c35600 100644 --- a/external/bsd/flex/dist/scanopt.c +++ b/external/bsd/flex/dist/scanopt.c @@ -715,6 +715,11 @@ int scanopt (svoid, arg, optindex) struct _aux *auxp; int is_short; int opt_offset = -1; +#if defined(__minix) + /* triggers a 'may be used uninitialized', when compiled with gcc, + * asserts off, and -Os. */ + is_short = 0; +#endif /* defined(__minix) */ s = (struct _scanopt_t *) svoid; diff --git a/minix/lib/libc/gen/fslib.c b/minix/lib/libc/gen/fslib.c index 0613d5933..dcc99815e 100644 --- a/minix/lib/libc/gen/fslib.c +++ b/minix/lib/libc/gen/fslib.c @@ -4,6 +4,7 @@ #include #include #include +#include /* for abort() */ #include #include #include /* for unshort :-( */ @@ -56,5 +57,8 @@ uint8_t fs_mode_to_type(mode_t mode) else if(S_ISSOCK(mode)) return DT_SOCK; assert(0 && "unknown type"); + + /* assert()s are removed on NDEBUG builds. */ + abort(); } diff --git a/minix/lib/libminc/Makefile b/minix/lib/libminc/Makefile index 4d3093460..21a859e7a 100644 --- a/minix/lib/libminc/Makefile +++ b/minix/lib/libminc/Makefile @@ -127,7 +127,8 @@ CPPFLAGS.sha2.c+= -D_STANDALONE CPPFLAGS.sha2.c+= -I${NETBSDSRCDIR}/sys .for f in \ - divdi3.o moddi3.o udivdi3.o umoddi3.o qdivrem.o + ashrdi3.o divdi3.o lshldi3.o lshrdi3.o moddi3.o \ + udivdi3.o umoddi3.o qdivrem.o ${f} ${f:C/\.o/.bc/}: ${LIBCOMMONCDIR}/quad/${f:C/\.o/.c/} OBJS+= ${f} CLEANFILES+= ${f} diff --git a/usr.bin/make/targ.c b/usr.bin/make/targ.c index 17ea4f06a..4de1aea80 100644 --- a/usr.bin/make/targ.c +++ b/usr.bin/make/targ.c @@ -338,6 +338,11 @@ Targ_FindNode(const char *name, int flags) Boolean isNew; /* Set TRUE if Hash_CreateEntry had to create */ /* an entry for the node */ +#if defined(__minix) + /* triggers a 'may be used uninitialized', when compiled with gcc, + * asserts off, and -Os. */ + he = NULL; +#endif /* defined(__minix) */ if (!(flags & (TARG_CREATE | TARG_NOHASH))) { he = Hash_FindEntry(&targets, name); if (he == NULL) diff --git a/usr.bin/mkdep/mkdep.c b/usr.bin/mkdep/mkdep.c index b059b32f1..44f13e707 100644 --- a/usr.bin/mkdep/mkdep.c +++ b/usr.bin/mkdep/mkdep.c @@ -230,9 +230,13 @@ main(int argc, char **argv) const char *prefix = NULL; const char *suffixes = NULL, *s; suff_list_t *suff_list = NULL, *sl; -#ifdef __minix +#if defined(__minix) size_t nr; -#endif + + /* triggers a 'may be used uninitialized', when compiled with gcc, + * asserts off, and -Os. */ + slen = 0; +#endif /* defined(__minix) */ suf = NULL; /* XXXGCC -Wuninitialized [sun2] */ sl = NULL; /* XXXGCC -Wuninitialized [sun2] */ diff --git a/usr.bin/vis/vis.c b/usr.bin/vis/vis.c index 1509c81c4..dda34f0eb 100644 --- a/usr.bin/vis/vis.c +++ b/usr.bin/vis/vis.c @@ -166,6 +166,11 @@ process(FILE *fp) char buff[4 * MB_LEN_MAX + 1]; /* max encoding length for one char */ int mbilen, cerr = 0, raerr = 0; +#if defined(__minix) + /* triggers a 'may be used uninitialized', when compiled with gcc, + * asserts off, and -Os. */ + rachar = 0; +#endif /* defined(__minix) */ /* * The input stream is considered to be multibyte characters. * The input loop will read this data inputing one character,