]> git.eshelyaron.com Git - emacs.git/commitdiff
Pacify Apple clang 11 __builtin_assume
authorPaul Eggert <eggert@cs.ucla.edu>
Sat, 15 Aug 2020 02:29:14 +0000 (19:29 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Sat, 15 Aug 2020 02:29:46 +0000 (19:29 -0700)
Problem reported by Mattias EngdegĂ„rd in:
https://lists.gnu.org/r/emacs-devel/2020-08/msg00300.html
* src/lisp.h (bool_vector_bitref, bool_vector_set):
Use eassert instead of eassume for bool_vector_size checks.

src/lisp.h

index 2962babb4fefe452a809c9ec6a13dc89f53018fb..eaf1c6ce6dfb4cbcfcec17c5261b305df7127cee 100644 (file)
@@ -1809,7 +1809,8 @@ bool_vector_uchar_data (Lisp_Object a)
 INLINE bool
 bool_vector_bitref (Lisp_Object a, EMACS_INT i)
 {
-  eassume (0 <= i && i < bool_vector_size (a));
+  eassume (0 <= i);
+  eassert (i < bool_vector_size (a));
   return !! (bool_vector_uchar_data (a)[i / BOOL_VECTOR_BITS_PER_CHAR]
             & (1 << (i % BOOL_VECTOR_BITS_PER_CHAR)));
 }
@@ -1825,11 +1826,11 @@ bool_vector_ref (Lisp_Object a, EMACS_INT i)
 INLINE void
 bool_vector_set (Lisp_Object a, EMACS_INT i, bool b)
 {
-  unsigned char *addr;
-
-  eassume (0 <= i && i < bool_vector_size (a));
-  addr = &bool_vector_uchar_data (a)[i / BOOL_VECTOR_BITS_PER_CHAR];
+  eassume (0 <= i);
+  eassert (i < bool_vector_size (a));
 
+  unsigned char *addr
+    = &bool_vector_uchar_data (a)[i / BOOL_VECTOR_BITS_PER_CHAR];
   if (b)
     *addr |= 1 << (i % BOOL_VECTOR_BITS_PER_CHAR);
   else