]> Savannah Git Hosting - gnulib.git/commitdiff
stdint: port to strict C11 left shift
authorPaul Eggert <eggert@cs.ucla.edu>
Mon, 11 Apr 2016 15:42:02 +0000 (08:42 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Mon, 11 Apr 2016 15:42:36 +0000 (08:42 -0700)
* lib/stdint.in.h (_STDINT_MIN, _STDINT_MAX):
Pacify clang -Wshift-negative-value, which should be an issue only
on clang setups where stdint.h does not conform to C11 or to C++11.
Problem reported by Philipp Stephani in: http://bugs.gnu.org/23261

ChangeLog
lib/stdint.in.h

index 77f1be96cb064f110a2ac8822c61e326f2daa438..6c5913dabfd5382e31fb4ae292554ef63f22fab4 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2016-04-11  Paul Eggert  <eggert@cs.ucla.edu>
+
+       stdint: port to strict C11 left shift
+       * lib/stdint.in.h (_STDINT_MIN, _STDINT_MAX):
+       Pacify clang -Wshift-negative-value, which should be an issue only
+       on clang setups where stdint.h does not conform to C11 or to C++11.
+       Problem reported by Philipp Stephani in: http://bugs.gnu.org/23261
+
 2016-04-09  Paul Eggert  <eggert@penguin.cs.ucla.edu>
 
        mbrtowc: work around glibc bug#19932
index f22e7d52590f293612f2ebde8ba7b1cf69691941..51fee75d587bc4ec7acba2481440ec239d6fd622 100644 (file)
    picky compilers.  */
 
 #define _STDINT_MIN(signed, bits, zero) \
-  ((signed) ? (- ((zero) + 1) << ((bits) ? (bits) - 1 : 0)) : (zero))
+  ((signed) ? ~ _STDINT_MAX (signed, bits, zero) : (zero))
 
 #define _STDINT_MAX(signed, bits, zero) \
-  ((signed) \
-   ? ~ _STDINT_MIN (signed, bits, zero) \
-   : /* 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)
+  (((((zero) + 1) << ((bits) ? (bits) - 1 - (signed) : 0)) - 1) * 2 + 1)
 
 #if !GNULIB_defined_stdint_types