diff options
| author | Paul Eggert | 2011-04-10 21:39:49 -0700 |
|---|---|---|
| committer | Paul Eggert | 2011-04-10 21:39:49 -0700 |
| commit | 244ed9077fe7ccebbc15c7157cb45832f46a46d3 (patch) | |
| tree | 4c3916d81881be940d2dd33d9abda979f88e5580 | |
| parent | 955cbe7b1720f09b2991b7d981147d9cc79d52e3 (diff) | |
| download | emacs-244ed9077fe7ccebbc15c7157cb45832f46a46d3.tar.gz emacs-244ed9077fe7ccebbc15c7157cb45832f46a46d3.zip | |
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.
| -rw-r--r-- | src/ChangeLog | 20 | ||||
| -rw-r--r-- | src/alloc.c | 28 | ||||
| -rw-r--r-- | src/eval.c | 25 | ||||
| -rw-r--r-- | src/lisp.h | 19 | ||||
| -rw-r--r-- | src/xdisp.c | 2 |
5 files changed, 65 insertions, 29 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 0be406a6e7b..43358338c4d 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,5 +1,25 @@ | |||
| 1 | 2011-04-11 Paul Eggert <eggert@cs.ucla.edu> | 1 | 2011-04-11 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 2 | ||
| 3 | alloc.c: Import and export fewer symbols, and remove unused items. | ||
| 4 | * lisp.h (suppress_checking, die): Declare only if ENABLE_CHECKING | ||
| 5 | is defined. | ||
| 6 | (suppress_checking): Add EXTERNALLY_VISIBLE attribute, so that | ||
| 7 | it's not optimized away by whole-program optimization. | ||
| 8 | (message_enable_multibyte, free_misc): Remove. | ||
| 9 | (catchlist, handlerlist, mark_backtrace): | ||
| 10 | Declare only if BYTE_MARK_STACK. | ||
| 11 | (mark_byte_stack): Likewise, fixing a ifdef-vs-if typo. | ||
| 12 | * alloc.c (pure): Export only if VIRT_ADDR_VARIES is defined. | ||
| 13 | (message_enable_multibyte): Remove decl. | ||
| 14 | (free_misc, interval_free_list, float_block, float_block_index): | ||
| 15 | (n_float_blocks, float_free_list, cons_block, cons_block_index): | ||
| 16 | (cons_free_list, last_marked_index): | ||
| 17 | Now static. | ||
| 18 | (suppress_checking, die): Define only if ENABLE_CHECKING is defined. | ||
| 19 | * eval.c (catchlist, handlerlist): Export only if BYTE_MARK_STACK. | ||
| 20 | (mark_backtrace): Define only if BYTE_MARK_STACK. | ||
| 21 | * xdisp.c (message_enable_multibyte): Now static. | ||
| 22 | |||
| 3 | Declare Lisp_Object Q* variables to be 'static' if not exproted. | 23 | Declare Lisp_Object Q* variables to be 'static' if not exproted. |
| 4 | This makes it easier for human readers (and static analyzers) | 24 | This makes it easier for human readers (and static analyzers) |
| 5 | to see whether these variables are used from other modules. | 25 | to see whether these variables are used from other modules. |
diff --git a/src/alloc.c b/src/alloc.c index ad3dfa96cd2..7803ccdc976 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -212,6 +212,9 @@ static int malloc_hysteresis; | |||
| 212 | remapping on more recent systems because this is less important | 212 | remapping on more recent systems because this is less important |
| 213 | nowadays than in the days of small memories and timesharing. */ | 213 | nowadays than in the days of small memories and timesharing. */ |
| 214 | 214 | ||
| 215 | #ifndef VIRT_ADDR_VARIES | ||
| 216 | static | ||
| 217 | #endif | ||
| 215 | EMACS_INT pure[(PURESIZE + sizeof (EMACS_INT) - 1) / sizeof (EMACS_INT)] = {1,}; | 218 | EMACS_INT pure[(PURESIZE + sizeof (EMACS_INT) - 1) / sizeof (EMACS_INT)] = {1,}; |
| 216 | #define PUREBEG (char *) pure | 219 | #define PUREBEG (char *) pure |
| 217 | 220 | ||
| @@ -281,8 +284,7 @@ static struct Lisp_String *allocate_string (void); | |||
| 281 | static void compact_small_strings (void); | 284 | static void compact_small_strings (void); |
| 282 | static void free_large_strings (void); | 285 | static void free_large_strings (void); |
| 283 | static void sweep_strings (void); | 286 | static void sweep_strings (void); |
| 284 | 287 | static void free_misc (Lisp_Object); | |
| 285 | extern int message_enable_multibyte; | ||
| 286 | 288 | ||
| 287 | /* When scanning the C stack for live Lisp objects, Emacs keeps track | 289 | /* When scanning the C stack for live Lisp objects, Emacs keeps track |
| 288 | of what memory allocated via lisp_malloc is intended for what | 290 | of what memory allocated via lisp_malloc is intended for what |
| @@ -1341,7 +1343,7 @@ static int total_free_intervals, total_intervals; | |||
| 1341 | 1343 | ||
| 1342 | /* List of free intervals. */ | 1344 | /* List of free intervals. */ |
| 1343 | 1345 | ||
| 1344 | INTERVAL interval_free_list; | 1346 | static INTERVAL interval_free_list; |
| 1345 | 1347 | ||
| 1346 | /* Total number of interval blocks now in use. */ | 1348 | /* Total number of interval blocks now in use. */ |
| 1347 | 1349 | ||
| @@ -2460,19 +2462,19 @@ struct float_block | |||
| 2460 | 2462 | ||
| 2461 | /* Current float_block. */ | 2463 | /* Current float_block. */ |
| 2462 | 2464 | ||
| 2463 | struct float_block *float_block; | 2465 | static struct float_block *float_block; |
| 2464 | 2466 | ||
| 2465 | /* Index of first unused Lisp_Float in the current float_block. */ | 2467 | /* Index of first unused Lisp_Float in the current float_block. */ |
| 2466 | 2468 | ||
| 2467 | int float_block_index; | 2469 | static int float_block_index; |
| 2468 | 2470 | ||
| 2469 | /* Total number of float blocks now in use. */ | 2471 | /* Total number of float blocks now in use. */ |
| 2470 | 2472 | ||
| 2471 | int n_float_blocks; | 2473 | static int n_float_blocks; |
| 2472 | 2474 | ||
| 2473 | /* Free-list of Lisp_Floats. */ | 2475 | /* Free-list of Lisp_Floats. */ |
| 2474 | 2476 | ||
| 2475 | struct Lisp_Float *float_free_list; | 2477 | static struct Lisp_Float *float_free_list; |
| 2476 | 2478 | ||
| 2477 | 2479 | ||
| 2478 | /* Initialize float allocation. */ | 2480 | /* Initialize float allocation. */ |
| @@ -2572,15 +2574,15 @@ struct cons_block | |||
| 2572 | 2574 | ||
| 2573 | /* Current cons_block. */ | 2575 | /* Current cons_block. */ |
| 2574 | 2576 | ||
| 2575 | struct cons_block *cons_block; | 2577 | static struct cons_block *cons_block; |
| 2576 | 2578 | ||
| 2577 | /* Index of first unused Lisp_Cons in the current block. */ | 2579 | /* Index of first unused Lisp_Cons in the current block. */ |
| 2578 | 2580 | ||
| 2579 | int cons_block_index; | 2581 | static int cons_block_index; |
| 2580 | 2582 | ||
| 2581 | /* Free-list of Lisp_Cons structures. */ | 2583 | /* Free-list of Lisp_Cons structures. */ |
| 2582 | 2584 | ||
| 2583 | struct Lisp_Cons *cons_free_list; | 2585 | static struct Lisp_Cons *cons_free_list; |
| 2584 | 2586 | ||
| 2585 | /* Total number of cons blocks now in use. */ | 2587 | /* Total number of cons blocks now in use. */ |
| 2586 | 2588 | ||
| @@ -3168,7 +3170,7 @@ allocate_misc (void) | |||
| 3168 | 3170 | ||
| 3169 | /* Free a Lisp_Misc object */ | 3171 | /* Free a Lisp_Misc object */ |
| 3170 | 3172 | ||
| 3171 | void | 3173 | static void |
| 3172 | free_misc (Lisp_Object misc) | 3174 | free_misc (Lisp_Object misc) |
| 3173 | { | 3175 | { |
| 3174 | XMISCTYPE (misc) = Lisp_Misc_Free; | 3176 | XMISCTYPE (misc) = Lisp_Misc_Free; |
| @@ -5216,7 +5218,7 @@ mark_face_cache (struct face_cache *c) | |||
| 5216 | 5218 | ||
| 5217 | #define LAST_MARKED_SIZE 500 | 5219 | #define LAST_MARKED_SIZE 500 |
| 5218 | static Lisp_Object last_marked[LAST_MARKED_SIZE]; | 5220 | static Lisp_Object last_marked[LAST_MARKED_SIZE]; |
| 5219 | int last_marked_index; | 5221 | static int last_marked_index; |
| 5220 | 5222 | ||
| 5221 | /* For debugging--call abort when we cdr down this many | 5223 | /* For debugging--call abort when we cdr down this many |
| 5222 | links of a list, in mark_object. In debugging, | 5224 | links of a list, in mark_object. In debugging, |
| @@ -6108,6 +6110,7 @@ Frames, windows, buffers, and subprocesses count as vectors | |||
| 6108 | return Flist (8, consed); | 6110 | return Flist (8, consed); |
| 6109 | } | 6111 | } |
| 6110 | 6112 | ||
| 6113 | #ifdef ENABLE_CHECKING | ||
| 6111 | int suppress_checking; | 6114 | int suppress_checking; |
| 6112 | 6115 | ||
| 6113 | void | 6116 | void |
| @@ -6117,6 +6120,7 @@ die (const char *msg, const char *file, int line) | |||
| 6117 | file, line, msg); | 6120 | file, line, msg); |
| 6118 | abort (); | 6121 | abort (); |
| 6119 | } | 6122 | } |
| 6123 | #endif | ||
| 6120 | 6124 | ||
| 6121 | /* Initialization */ | 6125 | /* Initialization */ |
| 6122 | 6126 | ||
diff --git a/src/eval.c b/src/eval.c index cefdf784faf..dddedc77286 100644 --- a/src/eval.c +++ b/src/eval.c | |||
| @@ -57,8 +57,23 @@ struct backtrace | |||
| 57 | }; | 57 | }; |
| 58 | 58 | ||
| 59 | struct backtrace *backtrace_list; | 59 | struct backtrace *backtrace_list; |
| 60 | |||
| 61 | #if !BYTE_MARK_STACK | ||
| 62 | static | ||
| 63 | #endif | ||
| 60 | struct catchtag *catchlist; | 64 | struct catchtag *catchlist; |
| 61 | 65 | ||
| 66 | /* Chain of condition handlers currently in effect. | ||
| 67 | The elements of this chain are contained in the stack frames | ||
| 68 | of Fcondition_case and internal_condition_case. | ||
| 69 | When an error is signaled (by calling Fsignal, below), | ||
| 70 | this chain is searched for an element that applies. */ | ||
| 71 | |||
| 72 | #if !BYTE_MARK_STACK | ||
| 73 | static | ||
| 74 | #endif | ||
| 75 | struct handler *handlerlist; | ||
| 76 | |||
| 62 | #ifdef DEBUG_GCPRO | 77 | #ifdef DEBUG_GCPRO |
| 63 | /* Count levels of GCPRO to detect failure to UNGCPRO. */ | 78 | /* Count levels of GCPRO to detect failure to UNGCPRO. */ |
| 64 | int gcpro_level; | 79 | int gcpro_level; |
| @@ -1345,14 +1360,6 @@ usage: (unwind-protect BODYFORM UNWINDFORMS...) */) | |||
| 1345 | return unbind_to (count, val); | 1360 | return unbind_to (count, val); |
| 1346 | } | 1361 | } |
| 1347 | 1362 | ||
| 1348 | /* Chain of condition handlers currently in effect. | ||
| 1349 | The elements of this chain are contained in the stack frames | ||
| 1350 | of Fcondition_case and internal_condition_case. | ||
| 1351 | When an error is signaled (by calling Fsignal, below), | ||
| 1352 | this chain is searched for an element that applies. */ | ||
| 1353 | |||
| 1354 | struct handler *handlerlist; | ||
| 1355 | |||
| 1356 | DEFUN ("condition-case", Fcondition_case, Scondition_case, 2, UNEVALLED, 0, | 1363 | DEFUN ("condition-case", Fcondition_case, Scondition_case, 2, UNEVALLED, 0, |
| 1357 | doc: /* Regain control when an error is signaled. | 1364 | doc: /* Regain control when an error is signaled. |
| 1358 | Executes BODYFORM and returns its value if no error happens. | 1365 | 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. */) | |||
| 3629 | } | 3636 | } |
| 3630 | 3637 | ||
| 3631 | 3638 | ||
| 3639 | #if BYTE_MARK_STACK | ||
| 3632 | void | 3640 | void |
| 3633 | mark_backtrace (void) | 3641 | mark_backtrace (void) |
| 3634 | { | 3642 | { |
| @@ -3648,6 +3656,7 @@ mark_backtrace (void) | |||
| 3648 | mark_object (backlist->args[i]); | 3656 | mark_object (backlist->args[i]); |
| 3649 | } | 3657 | } |
| 3650 | } | 3658 | } |
| 3659 | #endif | ||
| 3651 | 3660 | ||
| 3652 | void | 3661 | void |
| 3653 | syms_of_eval (void) | 3662 | syms_of_eval (void) |
diff --git a/src/lisp.h b/src/lisp.h index fb44002b6a6..b06626ad379 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -55,11 +55,11 @@ extern void check_cons_list (void); | |||
| 55 | #endif | 55 | #endif |
| 56 | 56 | ||
| 57 | /* Extra internal type checking? */ | 57 | /* Extra internal type checking? */ |
| 58 | extern int suppress_checking; | ||
| 59 | extern void die (const char *, const char *, int) NO_RETURN; | ||
| 60 | 58 | ||
| 61 | #ifdef ENABLE_CHECKING | 59 | #ifdef ENABLE_CHECKING |
| 62 | 60 | ||
| 61 | extern void die (const char *, const char *, int) NO_RETURN; | ||
| 62 | |||
| 63 | /* The suppress_checking variable is initialized to 0 in alloc.c. Set | 63 | /* The suppress_checking variable is initialized to 0 in alloc.c. Set |
| 64 | it to 1 using a debugger to temporarily disable aborting on | 64 | it to 1 using a debugger to temporarily disable aborting on |
| 65 | detected internal inconsistencies or error conditions. | 65 | detected internal inconsistencies or error conditions. |
| @@ -74,6 +74,8 @@ extern void die (const char *, const char *, int) NO_RETURN; | |||
| 74 | STRINGP (x), but a particular use of XSTRING is invoked only after | 74 | STRINGP (x), but a particular use of XSTRING is invoked only after |
| 75 | testing that STRINGP (x) is true, making the test redundant. */ | 75 | testing that STRINGP (x) is true, making the test redundant. */ |
| 76 | 76 | ||
| 77 | extern int suppress_checking EXTERNALLY_VISIBLE; | ||
| 78 | |||
| 77 | #define CHECK(check,msg) (((check) || suppress_checking \ | 79 | #define CHECK(check,msg) (((check) || suppress_checking \ |
| 78 | ? (void) 0 \ | 80 | ? (void) 0 \ |
| 79 | : die ((msg), __FILE__, __LINE__)), \ | 81 | : die ((msg), __FILE__, __LINE__)), \ |
| @@ -1968,8 +1970,6 @@ struct handler | |||
| 1968 | struct handler *next; | 1970 | struct handler *next; |
| 1969 | }; | 1971 | }; |
| 1970 | 1972 | ||
| 1971 | extern struct handler *handlerlist; | ||
| 1972 | |||
| 1973 | /* This structure helps implement the `catch' and `throw' control | 1973 | /* This structure helps implement the `catch' and `throw' control |
| 1974 | structure. A struct catchtag contains all the information needed | 1974 | structure. A struct catchtag contains all the information needed |
| 1975 | to restore the state of the interpreter after a non-local jump. | 1975 | to restore the state of the interpreter after a non-local jump. |
| @@ -2005,7 +2005,6 @@ struct catchtag | |||
| 2005 | struct byte_stack *byte_stack; | 2005 | struct byte_stack *byte_stack; |
| 2006 | }; | 2006 | }; |
| 2007 | 2007 | ||
| 2008 | extern struct catchtag *catchlist; | ||
| 2009 | extern struct backtrace *backtrace_list; | 2008 | extern struct backtrace *backtrace_list; |
| 2010 | 2009 | ||
| 2011 | extern Lisp_Object memory_signal_data; | 2010 | extern Lisp_Object memory_signal_data; |
| @@ -2615,7 +2614,6 @@ extern Lisp_Object Qrisky_local_variable; | |||
| 2615 | extern struct frame *last_glyphless_glyph_frame; | 2614 | extern struct frame *last_glyphless_glyph_frame; |
| 2616 | extern unsigned last_glyphless_glyph_face_id; | 2615 | extern unsigned last_glyphless_glyph_face_id; |
| 2617 | extern int last_glyphless_glyph_merged_face_id; | 2616 | extern int last_glyphless_glyph_merged_face_id; |
| 2618 | extern int message_enable_multibyte; | ||
| 2619 | extern int noninteractive_need_newline; | 2617 | extern int noninteractive_need_newline; |
| 2620 | extern Lisp_Object echo_area_buffer[2]; | 2618 | extern Lisp_Object echo_area_buffer[2]; |
| 2621 | extern void add_to_log (const char *, Lisp_Object, Lisp_Object); | 2619 | extern void add_to_log (const char *, Lisp_Object, Lisp_Object); |
| @@ -2724,7 +2722,6 @@ extern Lisp_Object make_float (double); | |||
| 2724 | extern void display_malloc_warning (void); | 2722 | extern void display_malloc_warning (void); |
| 2725 | extern int inhibit_garbage_collection (void); | 2723 | extern int inhibit_garbage_collection (void); |
| 2726 | extern Lisp_Object make_save_value (void *, int); | 2724 | extern Lisp_Object make_save_value (void *, int); |
| 2727 | extern void free_misc (Lisp_Object); | ||
| 2728 | extern void free_marker (Lisp_Object); | 2725 | extern void free_marker (Lisp_Object); |
| 2729 | extern void free_cons (struct Lisp_Cons *); | 2726 | extern void free_cons (struct Lisp_Cons *); |
| 2730 | extern void init_alloc_once (void); | 2727 | extern void init_alloc_once (void); |
| @@ -2822,6 +2819,10 @@ extern Lisp_Object Qand_rest; | |||
| 2822 | extern Lisp_Object Vautoload_queue; | 2819 | extern Lisp_Object Vautoload_queue; |
| 2823 | extern Lisp_Object Vsignaling_function; | 2820 | extern Lisp_Object Vsignaling_function; |
| 2824 | extern int handling_signal; | 2821 | extern int handling_signal; |
| 2822 | #if BYTE_MARK_STACK | ||
| 2823 | extern struct catchtag *catchlist; | ||
| 2824 | extern struct handler *handlerlist; | ||
| 2825 | #endif | ||
| 2825 | /* To run a normal hook, use the appropriate function from the list below. | 2826 | /* To run a normal hook, use the appropriate function from the list below. |
| 2826 | The calling convention: | 2827 | The calling convention: |
| 2827 | 2828 | ||
| @@ -2882,7 +2883,9 @@ extern Lisp_Object safe_call (size_t, Lisp_Object *); | |||
| 2882 | extern Lisp_Object safe_call1 (Lisp_Object, Lisp_Object); | 2883 | extern Lisp_Object safe_call1 (Lisp_Object, Lisp_Object); |
| 2883 | extern Lisp_Object safe_call2 (Lisp_Object, Lisp_Object, Lisp_Object); | 2884 | extern Lisp_Object safe_call2 (Lisp_Object, Lisp_Object, Lisp_Object); |
| 2884 | extern void init_eval (void); | 2885 | extern void init_eval (void); |
| 2886 | #if BYTE_MARK_STACK | ||
| 2885 | extern void mark_backtrace (void); | 2887 | extern void mark_backtrace (void); |
| 2888 | #endif | ||
| 2886 | extern void syms_of_eval (void); | 2889 | extern void syms_of_eval (void); |
| 2887 | 2890 | ||
| 2888 | /* Defined in editfns.c */ | 2891 | /* Defined in editfns.c */ |
| @@ -3255,7 +3258,7 @@ extern int read_bytecode_char (int); | |||
| 3255 | extern Lisp_Object Qbytecode; | 3258 | extern Lisp_Object Qbytecode; |
| 3256 | extern void syms_of_bytecode (void); | 3259 | extern void syms_of_bytecode (void); |
| 3257 | extern struct byte_stack *byte_stack_list; | 3260 | extern struct byte_stack *byte_stack_list; |
| 3258 | #ifdef BYTE_MARK_STACK | 3261 | #if BYTE_MARK_STACK |
| 3259 | extern void mark_byte_stack (void); | 3262 | extern void mark_byte_stack (void); |
| 3260 | #endif | 3263 | #endif |
| 3261 | extern void unmark_byte_stack (void); | 3264 | extern void unmark_byte_stack (void); |
diff --git a/src/xdisp.c b/src/xdisp.c index b5ba2090c70..ec9a112996f 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -504,7 +504,7 @@ Lisp_Object Vmessage_stack; | |||
| 504 | /* Nonzero means multibyte characters were enabled when the echo area | 504 | /* Nonzero means multibyte characters were enabled when the echo area |
| 505 | message was specified. */ | 505 | message was specified. */ |
| 506 | 506 | ||
| 507 | int message_enable_multibyte; | 507 | static int message_enable_multibyte; |
| 508 | 508 | ||
| 509 | /* Nonzero if we should redraw the mode lines on the next redisplay. */ | 509 | /* Nonzero if we should redraw the mode lines on the next redisplay. */ |
| 510 | 510 | ||