aboutsummaryrefslogtreecommitdiffstats
path: root/src/lisp.h
diff options
context:
space:
mode:
authorPaul Eggert2013-10-03 09:16:31 -0700
committerPaul Eggert2013-10-03 09:16:31 -0700
commit75273afb0de9e8a8eede149f3afdba0d855e7b5a (patch)
tree3b3ac5db0ac4bc0dface5305f4edaa07324e4c85 /src/lisp.h
parentc9358b45b947dd66de05527629511679bb90392a (diff)
downloademacs-75273afb0de9e8a8eede149f3afdba0d855e7b5a.tar.gz
emacs-75273afb0de9e8a8eede149f3afdba0d855e7b5a.zip
* 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.
Diffstat (limited to 'src/lisp.h')
-rw-r--r--src/lisp.h17
1 files changed, 6 insertions, 11 deletions
diff --git a/src/lisp.h b/src/lisp.h
index 0556a95f365..f949978ceed 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -108,11 +108,12 @@ typedef EMACS_UINT uprintmax_t;
108 108
109/* Extra internal type checking? */ 109/* Extra internal type checking? */
110 110
111/* Define an Emacs version of 'assert (COND)', since some 111/* Define an Emacs version of 'assert (COND)'. COND should be free of
112 system-defined 'assert's are flaky. COND should be free of side 112 side effects; it may be evaluated zero or more times. If COND is false,
113 effects; it may or may not be evaluated. */ 113 Emacs reliably crashes if ENABLE_CHECKING is defined and behavior
114 is undefined if not. The compiler may assume COND while optimizing. */
114#ifndef ENABLE_CHECKING 115#ifndef ENABLE_CHECKING
115# define eassert(X) ((void) (0 && (X))) /* Check that X compiles. */ 116# define eassert(cond) assume (cond)
116#else /* ENABLE_CHECKING */ 117#else /* ENABLE_CHECKING */
117 118
118extern _Noreturn void die (const char *, const char *, int); 119extern _Noreturn void die (const char *, const char *, int);
@@ -129,16 +130,10 @@ extern bool suppress_checking EXTERNALLY_VISIBLE;
129 130
130# define eassert(cond) \ 131# define eassert(cond) \
131 (suppress_checking || (cond) \ 132 (suppress_checking || (cond) \
132 ? (void) 0 \ 133 ? assume (cond) \
133 : die (# cond, __FILE__, __LINE__)) 134 : die (# cond, __FILE__, __LINE__))
134#endif /* ENABLE_CHECKING */ 135#endif /* ENABLE_CHECKING */
135 136
136/* When checking is enabled, identical to eassert. When checking is
137 * disabled, instruct the compiler (when the compiler has such
138 * capability) to assume that cond is true and optimize
139 * accordingly. */
140#define eassert_and_assume(cond) (eassert (cond), assume (cond))
141
142 137
143/* Use the configure flag --enable-check-lisp-object-type to make 138/* Use the configure flag --enable-check-lisp-object-type to make
144 Lisp_Object use a struct type instead of the default int. The flag 139 Lisp_Object use a struct type instead of the default int. The flag