diff options
| author | Paul Eggert | 2013-10-09 10:52:38 -0700 |
|---|---|---|
| committer | Paul Eggert | 2013-10-09 10:52:38 -0700 |
| commit | 0d5d30295a43e14a63369f637233b30b48cd98ba (patch) | |
| tree | c3c6e3b11748748bc2379438bb5f532df8046a7c /src | |
| parent | fa02290953acd2d0cda982d98ffd32e9f6873d28 (diff) | |
| download | emacs-0d5d30295a43e14a63369f637233b30b48cd98ba.tar.gz emacs-0d5d30295a43e14a63369f637233b30b48cd98ba.zip | |
* 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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 11 | ||||
| -rw-r--r-- | src/lisp.h | 9 |
2 files changed, 14 insertions, 6 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 3ae42ea87c8..7800959b091 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,14 @@ | |||
| 1 | 2013-10-09 Paul Eggert <eggert@cs.ucla.edu> | ||
| 2 | |||
| 3 | * lisp.h (eassert): Don't use 'assume'. | ||
| 4 | Sometimes 'assume' wins in performance, and sometimes it loses, | ||
| 5 | so it shouldn't be used all the time. Perhaps we need two | ||
| 6 | flavors of 'eassert', one for where 'assume' is far more likely | ||
| 7 | to help or to hurt; but that can be done later. | ||
| 8 | Problem reported by Dmitry Andipov in | ||
| 9 | <http://lists.gnu.org/archive/html/emacs-devel/2013-10/msg00276.html>. | ||
| 10 | Also, don't include <verify.h>; no longer needed. | ||
| 11 | |||
| 1 | 2013-10-09 Glenn Morris <rgm@gnu.org> | 12 | 2013-10-09 Glenn Morris <rgm@gnu.org> |
| 2 | 13 | ||
| 3 | * eval.c (Fcond): Doc tweak. | 14 | * eval.c (Fcond): Doc tweak. |
diff --git a/src/lisp.h b/src/lisp.h index 3773398d773..6638cc66e9f 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -31,7 +31,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 31 | #include <limits.h> | 31 | #include <limits.h> |
| 32 | 32 | ||
| 33 | #include <intprops.h> | 33 | #include <intprops.h> |
| 34 | #include <verify.h> | ||
| 35 | 34 | ||
| 36 | INLINE_HEADER_BEGIN | 35 | INLINE_HEADER_BEGIN |
| 37 | 36 | ||
| @@ -115,11 +114,9 @@ typedef EMACS_UINT uprintmax_t; | |||
| 115 | /* Extra internal type checking? */ | 114 | /* Extra internal type checking? */ |
| 116 | 115 | ||
| 117 | /* Define an Emacs version of 'assert (COND)'. COND should be free of | 116 | /* Define an Emacs version of 'assert (COND)'. COND should be free of |
| 118 | side effects; it may be evaluated zero or more times. If COND is false, | 117 | side effects; it may be evaluated zero or more times. */ |
| 119 | Emacs reliably crashes if ENABLE_CHECKING is defined and behavior | ||
| 120 | is undefined if not. The compiler may assume COND while optimizing. */ | ||
| 121 | #ifndef ENABLE_CHECKING | 118 | #ifndef ENABLE_CHECKING |
| 122 | # define eassert(cond) assume (cond) | 119 | # define eassert(cond) ((void) (0 && (cond))) /* Check that COND compiles. */ |
| 123 | #else /* ENABLE_CHECKING */ | 120 | #else /* ENABLE_CHECKING */ |
| 124 | 121 | ||
| 125 | extern _Noreturn void die (const char *, const char *, int); | 122 | extern _Noreturn void die (const char *, const char *, int); |
| @@ -136,7 +133,7 @@ extern bool suppress_checking EXTERNALLY_VISIBLE; | |||
| 136 | 133 | ||
| 137 | # define eassert(cond) \ | 134 | # define eassert(cond) \ |
| 138 | (suppress_checking || (cond) \ | 135 | (suppress_checking || (cond) \ |
| 139 | ? assume (cond) \ | 136 | ? (void) 0 \ |
| 140 | : die (# cond, __FILE__, __LINE__)) | 137 | : die (# cond, __FILE__, __LINE__)) |
| 141 | #endif /* ENABLE_CHECKING */ | 138 | #endif /* ENABLE_CHECKING */ |
| 142 | 139 | ||