From b6c2f771be4c1f0658ede3c2548c573dff25e3bc Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Mon, 28 Aug 2017 21:59:10 +0300 Subject: Remove warning from clang. --- builtin.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'builtin.c') diff --git a/builtin.c b/builtin.c index bf838a8a..cd270e84 100644 --- a/builtin.c +++ b/builtin.c @@ -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 -- cgit v1.2.3