diff src/alloc.c @ 28406:451721e784a8

Stop assuming interval pointers and lisp objects can be distinguished by inspection. Beginnings of support for expensive internal consistency checks. * config.in (ENABLE_CHECKING): Undef. * lisp.h (struct interval): Replace "parent" field with a union of interval pointer and Lisp_Object; add new bitfield to use as discriminant. Change other flag fields to bitfields. (CHECK): New macro for consistency checking. If ENABLE_CHECKING is defined and the supplied test fails, print a message and abort. (eassert): New macro. Use CHECK to provide an assert-like facility. * intervals.h (NULL_INTERVAL_P): Now applies only to real interval pointers; abort if the value looks like a lisp object. (NULL_INTERVAL_P, NULL_PARENT, HAS_PARENT, HAS_OBJECT, SET_PARENT, SET_OBJECT, INTERVAL_PARENT, GET_INTERVAL_OBJECT, COPY_PARENT): Modify for new interval parent definition. * alloc.c (mark_interval_tree, MARK_INTERVAL_TREE, UNMARK_BALANCE_INTERVALS): Update references that need an addressable lisp object in the interval structure. (die): New function. (suppress_checking): New variable. * intervals.c (interval_start_pos): Just return 0 if there's no parent object.
author Ken Raeburn <raeburn@raeburn.org>
date Wed, 29 Mar 2000 22:14:34 +0000
parents 7a3e8a76057b
children ecba29fa0198
line wrap: on
line diff
--- a/src/alloc.c	Wed Mar 29 21:57:22 2000 +0000
+++ b/src/alloc.c	Wed Mar 29 22:14:34 2000 +0000
@@ -766,7 +766,7 @@
 
   /* XMARK expands to an assignment; the LHS of an assignment can't be
      a cast.  */
-  XMARK (* (Lisp_Object *) &tree->parent);
+  XMARK (tree->up.obj);
 
   traverse_intervals (tree, 1, 0, mark_interval, Qnil);
 }
@@ -777,7 +777,7 @@
 #define MARK_INTERVAL_TREE(i)				\
   do {							\
     if (!NULL_INTERVAL_P (i)				\
-	&& ! XMARKBIT (*(Lisp_Object *) &i->parent))	\
+	&& ! XMARKBIT (i->up.obj))			\
       mark_interval_tree (i);				\
   } while (0)
 
@@ -790,7 +790,7 @@
   do {							\
    if (! NULL_INTERVAL_P (i))				\
      {							\
-       XUNMARK (* (Lisp_Object *) (&(i)->parent));	\
+       XUNMARK ((i)->up.obj);				\
        (i) = balance_intervals (i);			\
      }							\
   } while (0)
@@ -4649,6 +4649,18 @@
 
   return Flist (8, consed);
 }
+
+int suppress_checking;
+void
+die (msg, file, line)
+     const char *msg;
+     const char *file;
+     int line;
+{
+  fprintf (stderr, "\r\nEmacs fatal error: %s:%d: %s\r\n",
+	   file, line, msg);
+  abort ();
+}
 
 /* Initialization */