From: Bruno Haible Date: Mon, 29 Oct 2007 02:59:04 +0000 (+0100) Subject: Fix "integer overflow" warnings with OSF/1 5.1 cc. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d43b4675e20324bf187ca42bc27233f832449282;p=pspp Fix "integer overflow" warnings with OSF/1 5.1 cc. --- diff --git a/ChangeLog b/ChangeLog index ea419d8af8..911a8cf720 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2007-10-28 Bruno Haible + + * lib/stdint.in.h (_STDINT_MAX): Subtract 1 from an unused signed + integer shift in the signed case. Fixes warnings with OSF/1 5.1 cc. + 2007-10-28 Bruno Haible Fix link errors with Sun C 5.0 on Solaris 10. diff --git a/lib/stdint.in.h b/lib/stdint.in.h index ef0c335975..3dcd9ba082 100644 --- a/lib/stdint.in.h +++ b/lib/stdint.in.h @@ -101,7 +101,10 @@ #define _STDINT_MAX(signed, bits, zero) \ ((signed) \ ? ~ _STDINT_MIN (signed, bits, zero) \ - : ((((zero) + 1) << ((bits) ? (bits) - 1 : 0)) - 1) * 2 + 1) + : /* The expression for the unsigned case. The subtraction of (signed) \ + is a nop in the unsigned case and avoids "signed integer overflow" \ + warnings in the signed case. */ \ + ((((zero) + 1) << ((bits) ? (bits) - 1 - (signed) : 0)) - 1) * 2 + 1) /* 7.18.1.1. Exact-width integer types */