aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2013-11-15 10:01:04 -0800
committerPaul Eggert2013-11-15 10:01:04 -0800
commit2fcc742fc5c1a8de794d78a32c0c0fbf4629ca92 (patch)
tree5f321de82841bd3b633ffb814f09e3fdb28ef4b7 /src
parent82407168e69efbf9c9f6745ef3356cf6f6314cb3 (diff)
downloademacs-2fcc742fc5c1a8de794d78a32c0c0fbf4629ca92.tar.gz
emacs-2fcc742fc5c1a8de794d78a32c0c0fbf4629ca92.zip
* data.c: Work around bogus GCC diagnostic about shift count.
Reported by Eli Zaretskii in <http://lists.gnu.org/archive/html/emacs-devel/2013-11/msg00489.html>. (pre_value): New function. (count_trailing_zero_bits): Use it.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog8
-rw-r--r--src/data.c13
2 files changed, 20 insertions, 1 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 14de1e793b5..f92eb7b85fc 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,11 @@
12013-11-15 Paul Eggert <eggert@cs.ucla.edu>
2
3 * data.c: Work around bogus GCC diagnostic about shift count.
4 Reported by Eli Zaretskii in
5 <http://lists.gnu.org/archive/html/emacs-devel/2013-11/msg00489.html>.
6 (pre_value): New function.
7 (count_trailing_zero_bits): Use it.
8
12013-11-15 Eli Zaretskii <eliz@gnu.org> 92013-11-15 Eli Zaretskii <eliz@gnu.org>
2 10
3 * lisp.h (DEBUGGER_SEES_C_MACROS) [GCC < v3.5]: Pessimistically 11 * lisp.h (DEBUGGER_SEES_C_MACROS) [GCC < v3.5]: Pessimistically
diff --git a/src/data.c b/src/data.c
index 7ff7ac6b130..d0171b5d758 100644
--- a/src/data.c
+++ b/src/data.c
@@ -3078,6 +3078,16 @@ bool_vector_binop_driver (Lisp_Object op1,
3078 return changed ? dest : Qnil; 3078 return changed ? dest : Qnil;
3079} 3079}
3080 3080
3081/* PRECONDITION must be true. Return VALUE. This odd construction
3082 works around a bogus GCC diagnostic "shift count >= width of type". */
3083
3084static int
3085pre_value (bool precondition, int value)
3086{
3087 eassume (precondition);
3088 return precondition ? value : 0;
3089}
3090
3081/* Compute the number of trailing zero bits in val. If val is zero, 3091/* Compute the number of trailing zero bits in val. If val is zero,
3082 return the number of bits in val. */ 3092 return the number of bits in val. */
3083static int 3093static int
@@ -3111,7 +3121,8 @@ count_trailing_zero_bits (bits_word val)
3111 3121
3112 if (BITS_PER_BITS_WORD % BITS_PER_ULL != 0 3122 if (BITS_PER_BITS_WORD % BITS_PER_ULL != 0
3113 && BITS_WORD_MAX == (bits_word) -1) 3123 && BITS_WORD_MAX == (bits_word) -1)
3114 val |= (bits_word) 1 << (BITS_PER_BITS_WORD % BITS_PER_ULL); 3124 val |= (bits_word) 1 << pre_value (ULONG_MAX < BITS_WORD_MAX,
3125 BITS_PER_BITS_WORD % BITS_PER_ULL);
3115 return count + count_trailing_zeros_ll (val); 3126 return count + count_trailing_zeros_ll (val);
3116 } 3127 }
3117} 3128}