diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2017-08-28 21:59:10 +0300 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2017-08-28 21:59:10 +0300 |
commit | b6c2f771be4c1f0658ede3c2548c573dff25e3bc (patch) | |
tree | a560e04677701d6ee867ef6c8c3cda218099c0cb | |
parent | d99032dd298aa1531c96a62b8d32d085694dc1d2 (diff) | |
download | egawk-b6c2f771be4c1f0658ede3c2548c573dff25e3bc.tar.gz egawk-b6c2f771be4c1f0658ede3c2548c573dff25e3bc.tar.bz2 egawk-b6c2f771be4c1f0658ede3c2548c573dff25e3bc.zip |
Remove warning from clang.
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | builtin.c | 9 |
2 files changed, 11 insertions, 3 deletions
@@ -1,3 +1,8 @@ +2017-08-25 Pat Rankin <r.pat.rankin@gmail.com> + + * builtin.c (TYPE_MINIMUM): Use type uintmax_t for the calculation, + deferring the cast to the target type until the final result. + 2017-08-27 Juan Manuel Guerrero <juan.guerrero@gmx.de> * mbsupport.h [__DJGPP_]: Provide multi-byte specific declarations @@ -42,10 +42,13 @@ /* The extra casts work around common compiler bugs. */ #define TYPE_SIGNED(t) (! ((t) 0 < (t) -1)) -/* The outer cast is needed to work around a bug in Cray C 5.0.3.0. - It is necessary at least when t == time_t. */ +/* Note: these assume that negative integers are represented internally + via 2's complement, which is not mandated by C. They also ignore the + fact that signed integer arithmetic overflow can trigger exceptions, + unlike unsigned which is guaranteed not to do so. */ #define TYPE_MINIMUM(t) ((t) (TYPE_SIGNED (t) \ - ? ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1) : (t) 0)) + ? ~ (uintmax_t) 0 << (sizeof (t) * CHAR_BIT - 1) \ + : 0)) #define TYPE_MAXIMUM(t) ((t) (~ (t) 0 - TYPE_MINIMUM (t))) #ifndef INTMAX_MIN |