[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/emacs-24 r108639: * lisp.h (eassert): Assum
From: |
Paul Eggert |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/emacs-24 r108639: * lisp.h (eassert): Assume C89 or later. |
Date: |
Fri, 02 Nov 2012 01:47:06 -0000 |
User-agent: |
Bazaar (2.5.0) |
------------------------------------------------------------
revno: 108639
committer: Paul Eggert <address@hidden>
branch nick: trunk
timestamp: Sun 2012-06-17 01:21:25 -0700
message:
* lisp.h (eassert): Assume C89 or later.
This removes the need for CHECK.
(CHECK): Remove. Its comments about always evaluating its
argument were confusing, as 'eassert' typically does not evaluate
its argument.
modified:
src/ChangeLog
src/lisp.h
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog 2012-06-17 07:57:28 +0000
+++ b/src/ChangeLog 2012-06-17 08:21:25 +0000
@@ -1,5 +1,11 @@
2012-06-17 Paul Eggert <address@hidden>
+ * lisp.h (eassert): Assume C89 or later.
+ This removes the need for CHECK.
+ (CHECK): Remove. Its comments about always evaluating its
+ argument were confusing, as 'eassert' typically does not evaluate
+ its argument.
+
* coding.c (produce_chars): Use ptrdiff_t, not int.
* xterm.c (x_draw_underwave): Check for integer overflow.
=== modified file 'src/lisp.h'
--- a/src/lisp.h 2012-06-14 02:27:39 +0000
+++ b/src/lisp.h 2012-06-17 08:21:25 +0000
@@ -106,7 +106,12 @@
/* Extra internal type checking? */
-#ifdef ENABLE_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. */
+#ifndef ENABLE_CHECKING
+# define eassert(X) ((void) (0 && (X))) /* Check that X compiles. */
+#else /* ENABLE_CHECKING */
extern void die (const char *, const char *, int) NO_RETURN;
@@ -114,39 +119,16 @@
it to 1 using a debugger to temporarily disable aborting on
detected internal inconsistencies or error conditions.
- Testing suppress_checking after the supplied condition ensures that
- the side effects produced by CHECK will be consistent, independent
- of whether ENABLE_CHECKING is defined, or whether the checks are
- suppressed at run time.
-
In some cases, a good compiler may be able to optimize away the
- CHECK macro altogether, e.g., if XSTRING (x) uses CHECK to test
+ eassert macro altogether, e.g., if XSTRING (x) uses eassert to test
STRINGP (x), but a particular use of XSTRING is invoked only after
testing that STRINGP (x) is true, making the test redundant. */
-
extern int suppress_checking EXTERNALLY_VISIBLE;
-#define CHECK(check,msg) (((check) || suppress_checking \
- ? (void) 0 \
- : die ((msg), __FILE__, __LINE__)), \
- 0)
-#else
-
-/* Produce same side effects and result, but don't complain. */
-#define CHECK(check,msg) ((check),0)
-
-#endif
-
-/* Define an Emacs version of "assert", since some system ones are
- flaky. */
-#ifndef ENABLE_CHECKING
-#define eassert(X) ((void) (0 && (X))) /* Check that X compiles. */
-#else /* ENABLE_CHECKING */
-#if defined (__GNUC__) && __GNUC__ >= 2 && defined (__STDC__)
-#define eassert(cond) CHECK (cond, "assertion failed: " #cond)
-#else
-#define eassert(cond) CHECK (cond, "assertion failed")
-#endif
+# define eassert(cond) \
+ ((cond) || suppress_checking \
+ ? (void) 0 \
+ : die ("assertion failed: " # cond, __FILE__, __LINE__))
#endif /* ENABLE_CHECKING */
/* Use the configure flag --enable-check-lisp-object-type to make
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/emacs-24 r108639: * lisp.h (eassert): Assume C89 or later.,
Paul Eggert <=