alloc.c: Import and export fewer symbols, and remove unused items.
authorPaul Eggert <eggert@cs.ucla.edu>
Mon, 11 Apr 2011 04:39:49 +0000 (21:39 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Mon, 11 Apr 2011 04:39:49 +0000 (21:39 -0700)
* lisp.h (suppress_checking, die): Declare only if ENABLE_CHECKING
is defined.
(suppress_checking): Add EXTERNALLY_VISIBLE attribute, so that
it's not optimized away by whole-program optimization.
(message_enable_multibyte, free_misc): Remove.
(catchlist, handlerlist, mark_backtrace):
Declare only if BYTE_MARK_STACK.
(mark_byte_stack): Likewise, fixing a ifdef-vs-if typo.
* alloc.c (pure): Export only if VIRT_ADDR_VARIES is defined.
(message_enable_multibyte): Remove decl.
(free_misc, interval_free_list, float_block, float_block_index):
(n_float_blocks, float_free_list, cons_block, cons_block_index):
(cons_free_list, last_marked_index):
Now static.
(suppress_checking, die): Define only if ENABLE_CHECKING is defined.
* eval.c (catchlist, handlerlist): Export only if BYTE_MARK_STACK.
(mark_backtrace): Define only if BYTE_MARK_STACK.
* xdisp.c (message_enable_multibyte): Now static.

src/ChangeLog
src/alloc.c
src/eval.c
src/lisp.h
src/xdisp.c

index 0be406a..4335833 100644 (file)
@@ -1,5 +1,25 @@
 2011-04-11  Paul Eggert  <eggert@cs.ucla.edu>
 
+       alloc.c: Import and export fewer symbols, and remove unused items.
+       * lisp.h (suppress_checking, die): Declare only if ENABLE_CHECKING
+       is defined.
+       (suppress_checking): Add EXTERNALLY_VISIBLE attribute, so that
+       it's not optimized away by whole-program optimization.
+       (message_enable_multibyte, free_misc): Remove.
+       (catchlist, handlerlist, mark_backtrace):
+       Declare only if BYTE_MARK_STACK.
+       (mark_byte_stack): Likewise, fixing a ifdef-vs-if typo.
+       * alloc.c (pure): Export only if VIRT_ADDR_VARIES is defined.
+       (message_enable_multibyte): Remove decl.
+       (free_misc, interval_free_list, float_block, float_block_index):
+       (n_float_blocks, float_free_list, cons_block, cons_block_index):
+       (cons_free_list, last_marked_index):
+       Now static.
+       (suppress_checking, die): Define only if ENABLE_CHECKING is defined.
+       * eval.c (catchlist, handlerlist): Export only if BYTE_MARK_STACK.
+       (mark_backtrace): Define only if BYTE_MARK_STACK.
+       * xdisp.c (message_enable_multibyte): Now static.
+
        Declare Lisp_Object Q* variables to be 'static' if not exproted.
        This makes it easier for human readers (and static analyzers)
        to see whether these variables are used from other modules.
index ad3dfa9..7803ccd 100644 (file)
@@ -212,6 +212,9 @@ static int malloc_hysteresis;
    remapping on more recent systems because this is less important
    nowadays than in the days of small memories and timesharing.  */
 
+#ifndef VIRT_ADDR_VARIES
+static
+#endif
 EMACS_INT pure[(PURESIZE + sizeof (EMACS_INT) - 1) / sizeof (EMACS_INT)] = {1,};
 #define PUREBEG (char *) pure
 
@@ -281,8 +284,7 @@ static struct Lisp_String *allocate_string (void);
 static void compact_small_strings (void);
 static void free_large_strings (void);
 static void sweep_strings (void);
-
-extern int message_enable_multibyte;
+static void free_misc (Lisp_Object);
 
 /* When scanning the C stack for live Lisp objects, Emacs keeps track
    of what memory allocated via lisp_malloc is intended for what
@@ -1341,7 +1343,7 @@ static int total_free_intervals, total_intervals;
 
 /* List of free intervals.  */
 
-INTERVAL interval_free_list;
+static INTERVAL interval_free_list;
 
 /* Total number of interval blocks now in use.  */
 
@@ -2460,19 +2462,19 @@ struct float_block
 
 /* Current float_block.  */
 
-struct float_block *float_block;
+static struct float_block *float_block;
 
 /* Index of first unused Lisp_Float in the current float_block.  */
 
-int float_block_index;
+static int float_block_index;
 
 /* Total number of float blocks now in use.  */
 
-int n_float_blocks;
+static int n_float_blocks;
 
 /* Free-list of Lisp_Floats.  */
 
-struct Lisp_Float *float_free_list;
+static struct Lisp_Float *float_free_list;
 
 
 /* Initialize float allocation.  */
@@ -2572,15 +2574,15 @@ struct cons_block
 
 /* Current cons_block.  */
 
-struct cons_block *cons_block;
+static struct cons_block *cons_block;
 
 /* Index of first unused Lisp_Cons in the current block.  */
 
-int cons_block_index;
+static int cons_block_index;
 
 /* Free-list of Lisp_Cons structures.  */
 
-struct Lisp_Cons *cons_free_list;
+static struct Lisp_Cons *cons_free_list;
 
 /* Total number of cons blocks now in use.  */
 
@@ -3168,7 +3170,7 @@ allocate_misc (void)
 
 /* Free a Lisp_Misc object */
 
-void
+static void
 free_misc (Lisp_Object misc)
 {
   XMISCTYPE (misc) = Lisp_Misc_Free;
@@ -5216,7 +5218,7 @@ mark_face_cache (struct face_cache *c)
 
 #define LAST_MARKED_SIZE 500
 static Lisp_Object last_marked[LAST_MARKED_SIZE];
-int last_marked_index;
+static int last_marked_index;
 
 /* For debugging--call abort when we cdr down this many
    links of a list, in mark_object.  In debugging,
@@ -6108,6 +6110,7 @@ Frames, windows, buffers, and subprocesses count as vectors
   return Flist (8, consed);
 }
 
+#ifdef ENABLE_CHECKING
 int suppress_checking;
 
 void
@@ -6117,6 +6120,7 @@ die (const char *msg, const char *file, int line)
           file, line, msg);
   abort ();
 }
+#endif
 \f
 /* Initialization */
 
index cefdf78..dddedc7 100644 (file)
@@ -57,8 +57,23 @@ struct backtrace
 };
 
 struct backtrace *backtrace_list;
+
+#if !BYTE_MARK_STACK
+static
+#endif
 struct catchtag *catchlist;
 
+/* Chain of condition handlers currently in effect.
+   The elements of this chain are contained in the stack frames
+   of Fcondition_case and internal_condition_case.
+   When an error is signaled (by calling Fsignal, below),
+   this chain is searched for an element that applies.  */
+
+#if !BYTE_MARK_STACK
+static
+#endif
+struct handler *handlerlist;
+
 #ifdef DEBUG_GCPRO
 /* Count levels of GCPRO to detect failure to UNGCPRO.  */
 int gcpro_level;
@@ -1345,14 +1360,6 @@ usage: (unwind-protect BODYFORM UNWINDFORMS...)  */)
   return unbind_to (count, val);
 }
 \f
-/* Chain of condition handlers currently in effect.
-   The elements of this chain are contained in the stack frames
-   of Fcondition_case and internal_condition_case.
-   When an error is signaled (by calling Fsignal, below),
-   this chain is searched for an element that applies.  */
-
-struct handler *handlerlist;
-
 DEFUN ("condition-case", Fcondition_case, Scondition_case, 2, UNEVALLED, 0,
        doc: /* Regain control when an error is signaled.
 Executes BODYFORM and returns its value if no error happens.
@@ -3629,6 +3636,7 @@ If NFRAMES is more than the number of frames, the value is nil.  */)
 }
 
 \f
+#if BYTE_MARK_STACK
 void
 mark_backtrace (void)
 {
@@ -3648,6 +3656,7 @@ mark_backtrace (void)
        mark_object (backlist->args[i]);
     }
 }
+#endif
 
 void
 syms_of_eval (void)
index fb44002..b06626a 100644 (file)
@@ -55,11 +55,11 @@ extern void check_cons_list (void);
 #endif
 
 /* Extra internal type checking?  */
-extern int suppress_checking;
-extern void die (const char *, const char *, int) NO_RETURN;
 
 #ifdef ENABLE_CHECKING
 
+extern void die (const char *, const char *, int) NO_RETURN;
+
 /* The suppress_checking variable is initialized to 0 in alloc.c.  Set
    it to 1 using a debugger to temporarily disable aborting on
    detected internal inconsistencies or error conditions.
@@ -74,6 +74,8 @@ extern void die (const char *, const char *, int) NO_RETURN;
    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__)),  \
@@ -1968,8 +1970,6 @@ struct handler
     struct handler *next;
   };
 
-extern struct handler *handlerlist;
-
 /* This structure helps implement the `catch' and `throw' control
    structure.  A struct catchtag contains all the information needed
    to restore the state of the interpreter after a non-local jump.
@@ -2005,7 +2005,6 @@ struct catchtag
   struct byte_stack *byte_stack;
 };
 
-extern struct catchtag *catchlist;
 extern struct backtrace *backtrace_list;
 
 extern Lisp_Object memory_signal_data;
@@ -2615,7 +2614,6 @@ extern Lisp_Object Qrisky_local_variable;
 extern struct frame *last_glyphless_glyph_frame;
 extern unsigned last_glyphless_glyph_face_id;
 extern int last_glyphless_glyph_merged_face_id;
-extern int message_enable_multibyte;
 extern int noninteractive_need_newline;
 extern Lisp_Object echo_area_buffer[2];
 extern void add_to_log (const char *, Lisp_Object, Lisp_Object);
@@ -2724,7 +2722,6 @@ extern Lisp_Object make_float (double);
 extern void display_malloc_warning (void);
 extern int inhibit_garbage_collection (void);
 extern Lisp_Object make_save_value (void *, int);
-extern void free_misc (Lisp_Object);
 extern void free_marker (Lisp_Object);
 extern void free_cons (struct Lisp_Cons *);
 extern void init_alloc_once (void);
@@ -2822,6 +2819,10 @@ extern Lisp_Object Qand_rest;
 extern Lisp_Object Vautoload_queue;
 extern Lisp_Object Vsignaling_function;
 extern int handling_signal;
+#if BYTE_MARK_STACK
+extern struct catchtag *catchlist;
+extern struct handler *handlerlist;
+#endif
 /* To run a normal hook, use the appropriate function from the list below.
    The calling convention:
 
@@ -2882,7 +2883,9 @@ extern Lisp_Object safe_call (size_t, Lisp_Object *);
 extern Lisp_Object safe_call1 (Lisp_Object, Lisp_Object);
 extern Lisp_Object safe_call2 (Lisp_Object, Lisp_Object, Lisp_Object);
 extern void init_eval (void);
+#if BYTE_MARK_STACK
 extern void mark_backtrace (void);
+#endif
 extern void syms_of_eval (void);
 
 /* Defined in editfns.c */
@@ -3255,7 +3258,7 @@ extern int read_bytecode_char (int);
 extern Lisp_Object Qbytecode;
 extern void syms_of_bytecode (void);
 extern struct byte_stack *byte_stack_list;
-#ifdef BYTE_MARK_STACK
+#if BYTE_MARK_STACK
 extern void mark_byte_stack (void);
 #endif
 extern void unmark_byte_stack (void);
index b5ba209..ec9a112 100644 (file)
@@ -504,7 +504,7 @@ Lisp_Object Vmessage_stack;
 /* Nonzero means multibyte characters were enabled when the echo area
    message was specified.  */
 
-int message_enable_multibyte;
+static int message_enable_multibyte;
 
 /* Nonzero if we should redraw the mode lines on the next redisplay.  */