diff src/lisp.h @ 1333:1b0339b048ce

[xemacs-hg @ 2003-03-02 09:38:37 by ben] To: xemacs-patches@xemacs.org PROBLEMS: Include nt/PROBLEMS and update. Add note about incremental linking badness. cmdloop.el, custom.el, dumped-lisp.el, files.el, keydefs.el, keymap.el, lisp-mode.el, make-docfile.el, replace.el, simple.el, subr.el, view-less.el, wid-edit.el: Lots of syncing with FSF 21.2. Use if-fboundp in wid-edit.el. New file newcomment.el from FSF. internals/internals.texi: Fix typo. (Build-Time Dependencies): New node. PROBLEMS: Delete. config.inc.samp, xemacs.mak: Eliminate HAVE_VC6, use SUPPORT_EDIT_AND_CONTINUE in its place. No incremental linking unless SUPPORT_EDIT_AND_CONTINUE, since it can cause nasty crashes in pdump. Put warnings about this in config.inc.samp. Report the full compile flags used for src and lib-src in the Installation output. alloc.c, lisp.h, ralloc.c, regex.c: Use ALLOCA() in regex.c to avoid excessive stack allocation. Also fix subtle problem with REL_ALLOC() -- any call to malloc() (direct or indirect) may relocate rel-alloced data, causing buffer text to shift. After any such call, regex must update all its pointers to such data. Add a system, when ERROR_CHECK_MALLOC, whereby regex.c indicates all the places it is prepared to handle malloc()/realloc()/free(), and any calls anywhere in XEmacs outside of this will trigger an abort. alloc.c, dialog-msw.c, eval.c, event-stream.c, general-slots.h, insdel.c, lisp.h, menubar-msw.c, menubar-x.c: Change *run_hook*_trapping_problems to take a warning class, not a string. Factor out code to issue warnings, add flag to call_trapping_problems() to postpone warning issue, and make *run_hook*_trapping_problems issue their own warnings tailored to the hook, postponed in the case of safe_run_hook_trapping_problems() so that the appropriate message can be issued about resetting to nil only when not `quit'. Make record_unwind_protect_restoring_int() non-static. dumper.c: Issue notes about incremental linking problems under Windows. fileio.c: Mule-ize encrypt/decrypt-string code. text.h: Spacing changes.
author ben
date Sun, 02 Mar 2003 09:38:54 +0000
parents b531bf8658e9
children 01c57eb70ae9
line wrap: on
line diff
--- a/src/lisp.h	Sun Mar 02 02:18:12 2003 +0000
+++ b/src/lisp.h	Sun Mar 02 09:38:54 2003 +0000
@@ -1145,6 +1145,13 @@
 extern Bytecount __temp_alloca_size__;
 extern Bytecount funcall_alloca_count;
 
+#ifdef ERROR_CHECK_MALLOC
+extern int regex_malloc_disallowed;
+#define REGEX_MALLOC_CHECK() assert (!regex_malloc_disallowed)
+#else
+#define REGEX_MALLOC_CHECK() ((void) 0)
+#endif
+
 /* Do stack or heap alloca() depending on size.
 
 NOTE: The use of a global temporary like this is unsafe if ALLOCA() occurs
@@ -1153,7 +1160,8 @@
 expression has side effects -- something easy to forget. */
 
 #define ALLOCA(size)					\
-  (__temp_alloca_size__ = (size),			\
+  (REGEX_MALLOC_CHECK (),				\
+   __temp_alloca_size__ = (size),			\
    __temp_alloca_size__  > MAX_ALLOCA_VS_C_ALLOCA ?	\
    xemacs_c_alloca (__temp_alloca_size__) :		\
    (need_to_check_c_alloca ? xemacs_c_alloca (0) : 0,	\
@@ -1172,7 +1180,8 @@
    function! */
 
 #define MALLOC_OR_ALLOCA(size)				\
-  (__temp_alloca_size__ = (size),			\
+  (REGEX_MALLOC_CHECK (),				\
+   __temp_alloca_size__ = (size),			\
    __temp_alloca_size__  > MAX_ALLOCA_VS_MALLOC ?	\
    xmalloc_and_record_unwind (__temp_alloca_size__) :	\
    (need_to_check_c_alloca ? xemacs_c_alloca (0) : 0,	\
@@ -1187,6 +1196,7 @@
    which ensures constant amortized time per element. */
 #define DO_REALLOC(basevar, sizevar, needed_size, type)	do {	\
   Bytecount do_realloc_needed_size = (needed_size);		\
+  REGEX_MALLOC_CHECK ();					\
   if ((sizevar) < do_realloc_needed_size)			\
     {								\
       if ((sizevar) < 32)					\
@@ -3560,7 +3570,7 @@
 extern int need_to_garbage_collect;
 extern int need_to_check_c_alloca;
 extern int need_to_signal_post_gc;
-extern Lisp_Object Qpost_gc_hook;
+extern Lisp_Object Qpost_gc_hook, Qgarbage_collecting;
 void recompute_funcall_allocation_flag (void);
 
 #ifdef MEMORY_USAGE_STATS
@@ -4038,6 +4048,7 @@
 #define INHIBIT_ANY_CHANGE_AFFECTING_REDISPLAY (1<<14)
 #define INHIBIT_ENTERING_DEBUGGER (1<<15)
 #define CALL_WITH_SUSPENDED_ERRORS (1<<16)
+#define POSTPONE_WARNING_ISSUE (1<<17)
 
 enum check_allowed_operation
 {
@@ -4086,32 +4097,27 @@
 				   Lisp_Object, int);
 Lisp_Object eval_in_buffer_trapping_problems (const char *, struct buffer *,
 					    Lisp_Object, int);
-Lisp_Object run_hook_trapping_problems (const char *, Lisp_Object, int);
-Lisp_Object safe_run_hook_trapping_problems (const char *, Lisp_Object, int);
-Lisp_Object run_hook_with_args_in_buffer_trapping_problems (const char
-							    *warning_string,
-							    struct buffer
-							    *buf, int nargs,
+Lisp_Object run_hook_trapping_problems (Lisp_Object, Lisp_Object, int);
+Lisp_Object safe_run_hook_trapping_problems (Lisp_Object, Lisp_Object, int);
+Lisp_Object run_hook_with_args_in_buffer_trapping_problems (Lisp_Object,
+							    struct buffer *,
+							    int nargs,
 							    Lisp_Object *args,
 							    enum
 							    run_hooks_condition
 							    cond, int flags);
-Lisp_Object run_hook_with_args_trapping_problems (const char *warning_string,
+Lisp_Object run_hook_with_args_trapping_problems (Lisp_Object,
 						  int nargs,
 						  Lisp_Object *args,
 						  enum run_hooks_condition
 						  cond,
 						  int flags);
-Lisp_Object va_run_hook_with_args_trapping_problems (const char
-						     *warning_string,
+Lisp_Object va_run_hook_with_args_trapping_problems (Lisp_Object,
 						     Lisp_Object hook_var,
 						     int nargs, ...);
-Lisp_Object va_run_hook_with_args_in_buffer_trapping_problems (const char
-							       *warning_string,
-							       struct buffer
-							       *buf,
-							       Lisp_Object
-							       hook_var,
+Lisp_Object va_run_hook_with_args_in_buffer_trapping_problems (Lisp_Object,
+							       struct buffer *,
+							       Lisp_Object,
 							       int nargs, ...);
 Lisp_Object call_with_suspended_errors (lisp_fn_t, Lisp_Object,
 					Lisp_Object,
@@ -4133,6 +4139,7 @@
 int record_unwind_protect (Lisp_Object (*) (Lisp_Object), Lisp_Object);
 int record_unwind_protect_freeing (void *ptr);
 int record_unwind_protect_freeing_dynarr (void *ptr);
+int record_unwind_protect_restoring_int (int *addr, int val);
 int internal_bind_int (int *addr, int newval);
 int internal_bind_lisp_object (Lisp_Object *addr, Lisp_Object newval);
 void do_autoload (Lisp_Object, Lisp_Object); /* GCPROs both arguments */