rewrite some code to avoid gcc 4.8 complaining

This commit is contained in:
tg
2012-10-03 16:16:15 +00:00
parent b55d9870e3
commit c39bfe09ee
3 changed files with 18 additions and 10 deletions

10
sh.h
View File

@@ -157,7 +157,7 @@
#endif
#ifdef EXTERN
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.590 2012/10/03 15:55:37 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.591 2012/10/03 16:16:13 tg Exp $");
#endif
#define MKSH_VERSION "R40 2012/09/07"
@@ -1559,9 +1559,11 @@ EXTERN mksh_ari_t histsize; /* history size */
/* user and system time of last j_waitjed job */
EXTERN struct timeval j_usrtime, j_systime;
#define notoktomul(fac1, fac2) (((fac1) != 0) && ((fac2) != 0) && \
((SIZE_MAX / (fac2)) < (fac1)))
#define notoktoadd(val, cnst) ((val) > (SIZE_MAX - (cnst)))
#define notok2mul(max, val, c) (((val) != 0) && ((c) != 0) && \
(((max) / (c)) < (val)))
#define notok2add(max, val, c) ((val) > ((max) - (c)))
#define notoktomul(val, cnst) notok2mul(SIZE_MAX, (val), (cnst))
#define notoktoadd(val, cnst) notok2add(SIZE_MAX, (val), (cnst))
#define checkoktoadd(val, cnst) do { \
if (notoktoadd((val), (cnst))) \
internal_errorf(Tintovfl, (size_t)(val), \