]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp.h (eassert): Don't use 'assume'.
authorPaul Eggert <eggert@cs.ucla.edu>
Wed, 9 Oct 2013 17:52:38 +0000 (10:52 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Wed, 9 Oct 2013 17:52:38 +0000 (10:52 -0700)
Sometimes 'assume' wins in performance, and sometimes it loses,
so it shouldn't be used all the time.  Perhaps we need two
flavors of 'eassert', one for where 'assume' is far more likely
to help or to hurt; but that can be done later.
Problem reported by Dmitry Andipov in
<http://lists.gnu.org/archive/html/emacs-devel/2013-10/msg00276.html>.
Also, don't include <verify.h>; no longer needed.

src/ChangeLog
src/lisp.h

index 3ae42ea87c899a8673491e32b9e3a39f74a58f8b..7800959b0915a500458ecff7653fd82c5a2faa6a 100644 (file)
@@ -1,3 +1,14 @@
+2013-10-09  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * lisp.h (eassert): Don't use 'assume'.
+       Sometimes 'assume' wins in performance, and sometimes it loses,
+       so it shouldn't be used all the time.  Perhaps we need two
+       flavors of 'eassert', one for where 'assume' is far more likely
+       to help or to hurt; but that can be done later.
+       Problem reported by Dmitry Andipov in
+       <http://lists.gnu.org/archive/html/emacs-devel/2013-10/msg00276.html>.
+       Also, don't include <verify.h>; no longer needed.
+
 2013-10-09  Glenn Morris  <rgm@gnu.org>
 
        * eval.c (Fcond): Doc tweak.
index 3773398d77371201efe8f8c359617c8fc47e9ca8..6638cc66e9f0222483fdead9b3b69bd38b13394f 100644 (file)
@@ -31,7 +31,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <limits.h>
 
 #include <intprops.h>
-#include <verify.h>
 
 INLINE_HEADER_BEGIN
 
@@ -115,11 +114,9 @@ typedef EMACS_UINT uprintmax_t;
 /* Extra internal type checking?  */
 
 /* 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.  */
+   side effects; it may be evaluated zero or more times.  */
 #ifndef ENABLE_CHECKING
-# define eassert(cond) assume (cond)
+# define eassert(cond) ((void) (0 && (cond))) /* Check that COND compiles.  */
 #else /* ENABLE_CHECKING */
 
 extern _Noreturn void die (const char *, const char *, int);
@@ -136,7 +133,7 @@ extern bool suppress_checking EXTERNALLY_VISIBLE;
 
 # define eassert(cond)                                         \
    (suppress_checking || (cond)                                \
-    ? assume (cond)                                            \
+    ? (void) 0                                                 \
     : die (# cond, __FILE__, __LINE__))
 #endif /* ENABLE_CHECKING */