[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] stdint: port to strict C11 left shift
From: |
Paul Eggert |
Subject: |
[PATCH] stdint: port to strict C11 left shift |
Date: |
Mon, 11 Apr 2016 08:42:57 -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 | 8 ++++++++
lib/stdint.in.h | 9 ++-------
2 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 77f1be9..6c5913d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2016-04-11 Paul Eggert <address@hidden>
+
+ 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 <address@hidden>
mbrtowc: work around glibc bug#19932
diff --git a/lib/stdint.in.h b/lib/stdint.in.h
index f22e7d5..51fee75 100644
--- a/lib/stdint.in.h
+++ b/lib/stdint.in.h
@@ -118,15 +118,10 @@
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
--
2.5.5
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [PATCH] stdint: port to strict C11 left shift,
Paul Eggert <=