In other words, take on the behavior of eassert_and_assume.
This makes Emacs 0.2% smaller on my platform (Fedora 19, x86-64).
(eassert_and_assume): Remove. All uses replaced by eassert.
2013-10-03 Paul Eggert <eggert@cs.ucla.edu>
+ * lisp.h (eassert): Assume that COND is true when optimizing.
+ In other words, take on the behavior of eassert_and_assume.
+ This makes Emacs 0.2% smaller on my platform (Fedora 19, x86-64).
+ (eassert_and_assume): Remove. All uses replaced by eassert.
+
* xdisp.c (Qglyphless_char): Now static.
Adjust to merge from gnulib.
ptrdiff_t exact_needed_bytes;
ptrdiff_t needed_bytes;
- eassert_and_assume (nr_bits >= 0);
+ eassert (nr_bits >= 0);
exact_needed_bytes = ROUNDUP ((size_t) nr_bits, CHAR_BIT) / CHAR_BIT;
needed_bytes = ROUNDUP ((size_t) nr_bits, BITS_PER_SIZE_T) / CHAR_BIT;
total_payload_bytes = bool_vector_payload_bytes
(XFASTINT (length), &exact_payload_bytes);
- eassert_and_assume (exact_payload_bytes <= total_payload_bytes);
- eassert_and_assume (0 <= exact_payload_bytes);
+ eassert (exact_payload_bytes <= total_payload_bytes);
+ eassert (0 <= exact_payload_bytes);
needed_elements = ROUNDUP ((size_t) ((bool_header_size - header_size)
+ total_payload_bytes),
ptrdiff_t payload_bytes =
bool_vector_payload_bytes (bv->size, NULL);
- eassert_and_assume (payload_bytes >= 0);
+ eassert (payload_bytes >= 0);
size = bool_header_size + ROUNDUP (payload_bytes, word_size);
}
else
static size_t
bool_vector_spare_mask (ptrdiff_t nr_bits)
{
- eassert_and_assume (nr_bits > 0);
+ eassert (nr_bits > 0);
return (((size_t) 1) << (nr_bits % BITS_PER_SIZE_T)) - 1;
}
nr_bits = min (nr_bits, XBOOL_VECTOR (dest)->size);
}
- eassert_and_assume (nr_bits >= 0);
+ eassert (nr_bits >= 0);
nr_words = ROUNDUP (nr_bits, BITS_PER_SIZE_T) / BITS_PER_SIZE_T;
adata = (size_t *) XBOOL_VECTOR (dest)->data;
bdata = (size_t *) XBOOL_VECTOR (b)->data;
adata = (size_t *) XBOOL_VECTOR (a)->data;
- eassert_and_assume (nr_bits >= 0);
+ eassert (nr_bits >= 0);
for (i = 0; i < nr_bits / BITS_PER_SIZE_T; i++)
bdata[i] = ~adata[i];
match = NILP (b) ? (size_t) -1 : 0;
adata = (size_t *) XBOOL_VECTOR (a)->data;
- eassert_and_assume (nr_bits >= 0);
+ eassert (nr_bits >= 0);
for (i = 0; i < nr_bits / BITS_PER_SIZE_T; ++i)
count += popcount_size_t (adata[i] ^ match);
/* Extra internal type checking? */
-/* Define an Emacs version of 'assert (COND)', since some
- system-defined 'assert's are flaky. COND should be free of side
- effects; it may or may not be evaluated. */
+/* Define an Emacs version of 'assert (COND)'. COND should be free of
+ side effects; it may be evaluated zero or more times. If COND is false,
+ Emacs reliably crashes if ENABLE_CHECKING is defined and behavior
+ is undefined if not. The compiler may assume COND while optimizing. */
#ifndef ENABLE_CHECKING
-# define eassert(X) ((void) (0 && (X))) /* Check that X compiles. */
+# define eassert(cond) assume (cond)
#else /* ENABLE_CHECKING */
extern _Noreturn void die (const char *, const char *, int);
# define eassert(cond) \
(suppress_checking || (cond) \
- ? (void) 0 \
+ ? assume (cond) \
: die (# cond, __FILE__, __LINE__))
#endif /* ENABLE_CHECKING */
-/* When checking is enabled, identical to eassert. When checking is
- * disabled, instruct the compiler (when the compiler has such
- * capability) to assume that cond is true and optimize
- * accordingly. */
-#define eassert_and_assume(cond) (eassert (cond), assume (cond))
-
\f
/* Use the configure flag --enable-check-lisp-object-type to make
Lisp_Object use a struct type instead of the default int. The flag