Mercurial > hg > xemacs-beta
comparison src/cmdloop.c @ 2268:61855263cb07
[xemacs-hg @ 2004-09-14 14:32:29 by james]
Identify functions that don't return, including some DEFUNs.
author | james |
---|---|
date | Tue, 14 Sep 2004 14:33:07 +0000 |
parents | f561c3904bb3 |
children | 04bc9d2f42c7 |
comparison
equal
deleted
inserted
replaced
2267:5753220a0f80 | 2268:61855263cb07 |
---|---|
68 Lisp_Object Qerrors_deactivate_region; | 68 Lisp_Object Qerrors_deactivate_region; |
69 | 69 |
70 Lisp_Object Qtop_level; | 70 Lisp_Object Qtop_level; |
71 Lisp_Object Vminibuffer_echo_wait_function; | 71 Lisp_Object Vminibuffer_echo_wait_function; |
72 | 72 |
73 #ifdef LISP_COMMAND_LOOP | |
73 static Lisp_Object command_loop_1 (Lisp_Object dummy); | 74 static Lisp_Object command_loop_1 (Lisp_Object dummy); |
74 EXFUN (Fcommand_loop_1, 0); | 75 EXFUN (Fcommand_loop_1, 0); |
76 #else | |
77 static DECLARE_DOESNT_RETURN_TYPE (Lisp_Object, | |
78 command_loop_1 (Lisp_Object dummy)); | |
79 EXFUN_NORETURN (Fcommand_loop_1, 0); | |
80 #endif | |
75 | 81 |
76 /* There are two possible command loops -- one written entirely in | 82 /* There are two possible command loops -- one written entirely in |
77 C and one written mostly in Lisp, except stuff written in C for | 83 C and one written mostly in Lisp, except stuff written in C for |
78 speed. The advantage of the Lisp command loop is that the user | 84 speed. The advantage of the Lisp command loop is that the user |
79 can specify their own command loop to use by changing the variable | 85 can specify their own command loop to use by changing the variable |
105 check_quit (); /* make Vquit_flag accurate */ | 111 check_quit (); /* make Vquit_flag accurate */ |
106 Vquit_flag = Qnil; | 112 Vquit_flag = Qnil; |
107 return (unbind_to_1 (speccount, Qt)); | 113 return (unbind_to_1 (speccount, Qt)); |
108 } | 114 } |
109 | 115 |
110 DEFUN ("really-early-error-handler", Freally_early_error_handler, 1, 1, 0, /* | 116 DEFUN_NORETURN ("really-early-error-handler", Freally_early_error_handler, |
117 1, 1, 0, /* | |
111 You should almost certainly not be using this. | 118 You should almost certainly not be using this. |
112 */ | 119 */ |
113 (x)) | 120 (x)) |
114 { | 121 { |
115 /* This is an error handler used when we're running temacs and when | 122 /* This is an error handler used when we're running temacs and when |
132 stderr_out ("*** Killing XEmacs\n"); | 139 stderr_out ("*** Killing XEmacs\n"); |
133 #ifdef HAVE_MS_WINDOWS | 140 #ifdef HAVE_MS_WINDOWS |
134 Fmswindows_message_box (build_msg_string ("Initialization error"), | 141 Fmswindows_message_box (build_msg_string ("Initialization error"), |
135 Qnil, Qnil); | 142 Qnil, Qnil); |
136 #endif | 143 #endif |
137 return Fkill_emacs (make_int (-1)); | 144 Fkill_emacs (make_int (-1)); |
145 RETURN_NOT_REACHED (Qnil); | |
138 } | 146 } |
139 | 147 |
140 | 148 |
141 /**********************************************************************/ | 149 /**********************************************************************/ |
142 /* Command-loop (in C) */ | 150 /* Command-loop (in C) */ |
234 editing loop, and reenter the editing loop. | 242 editing loop, and reenter the editing loop. |
235 When there is an error, cmd_error runs and the call | 243 When there is an error, cmd_error runs and the call |
236 to condition_case_1() returns. */ | 244 to condition_case_1() returns. */ |
237 | 245 |
238 /* Avoid confusing the compiler. A helper function for command_loop_2 */ | 246 /* Avoid confusing the compiler. A helper function for command_loop_2 */ |
247 static DECLARE_DOESNT_RETURN (command_loop_3 (void)); | |
248 | |
239 static DOESNT_RETURN | 249 static DOESNT_RETURN |
240 command_loop_3 (void) | 250 command_loop_3 (void) |
241 { | 251 { |
242 /* | 252 /* |
243 * If we are inside of a menu callback we cannot reenter the command loop | 253 * If we are inside of a menu callback we cannot reenter the command loop |
255 is 0. */ | 265 is 0. */ |
256 reset_this_command_keys (Vselected_console, 0); | 266 reset_this_command_keys (Vselected_console, 0); |
257 } | 267 } |
258 } | 268 } |
259 | 269 |
260 static Lisp_Object | 270 static DECLARE_DOESNT_RETURN_TYPE (Lisp_Object, command_loop_2 (Lisp_Object)); |
271 | |
272 static DOESNT_RETURN_TYPE (Lisp_Object) | |
261 command_loop_2 (Lisp_Object dummy) | 273 command_loop_2 (Lisp_Object dummy) |
262 { | 274 { |
263 command_loop_3(); /* doesn't return */ | 275 command_loop_3(); /* doesn't return */ |
264 return Qnil; | 276 RETURN_NOT_REACHED (Qnil); |
265 } | 277 } |
266 | 278 |
267 /* This is called from emacs.c when it's done with initialization. */ | 279 /* This is called from emacs.c when it's done with initialization. */ |
268 | 280 |
269 DOESNT_RETURN | 281 DOESNT_RETURN |
312 Normal termination of the macro or minibuffer causes a throw past us. | 324 Normal termination of the macro or minibuffer causes a throw past us. |
313 See the comment above. | 325 See the comment above. |
314 | 326 |
315 Note that this function never returns (but may be thrown out of). */ | 327 Note that this function never returns (but may be thrown out of). */ |
316 | 328 |
317 Lisp_Object | 329 DOESNT_RETURN_TYPE (Lisp_Object) |
318 call_command_loop (Lisp_Object catch_errors) | 330 call_command_loop (Lisp_Object catch_errors) |
319 { | 331 { |
320 /* This function can GC */ | 332 /* This function can GC */ |
321 if (NILP (catch_errors)) | 333 if (NILP (catch_errors)) |
322 return (command_loop_1 (Qnil)); | 334 command_loop_1 (Qnil); |
323 else | 335 else |
324 return (command_loop_2 (Qnil)); | 336 command_loop_2 (Qnil); |
337 RETURN_NOT_REACHED (Qnil); | |
325 } | 338 } |
326 | 339 |
327 static Lisp_Object | 340 static Lisp_Object |
328 recursive_edit_unwind (Lisp_Object buffer) | 341 recursive_edit_unwind (Lisp_Object buffer) |
329 { | 342 { |
404 return (condition_case_1 (Qt, | 417 return (condition_case_1 (Qt, |
405 command_loop_1, Qnil, | 418 command_loop_1, Qnil, |
406 cold_load_command_error, Qnil)); | 419 cold_load_command_error, Qnil)); |
407 } | 420 } |
408 | 421 |
409 Lisp_Object | 422 DOESNT_RETURN_TYPE (Lisp_Object) |
410 call_command_loop (Lisp_Object catch_errors) | 423 call_command_loop (Lisp_Object catch_errors) |
411 { | 424 { |
412 /* This function can GC */ | 425 /* This function can GC */ |
413 reset_this_command_keys (Vselected_console, 0); /* #### bleagh */ | 426 reset_this_command_keys (Vselected_console, 0); /* #### bleagh */ |
414 | 427 |
428 Fcommand_loop_1 (); | 441 Fcommand_loop_1 (); |
429 else | 442 else |
430 internal_catch (Qtop_level, | 443 internal_catch (Qtop_level, |
431 cold_load_command_loop, Qnil, 0, 0); | 444 cold_load_command_loop, Qnil, 0, 0); |
432 goto loop; | 445 goto loop; |
433 return Qnil; | 446 RETURN_NOT_REACHED (Qnil); |
434 } | 447 } |
435 | 448 |
436 static Lisp_Object | 449 static Lisp_Object |
437 initial_error_handler (Lisp_Object datum, Lisp_Object ignored) | 450 initial_error_handler (Lisp_Object datum, Lisp_Object ignored) |
438 { | 451 { |
478 | 491 |
479 /**********************************************************************/ | 492 /**********************************************************************/ |
480 /* Guts of command loop */ | 493 /* Guts of command loop */ |
481 /**********************************************************************/ | 494 /**********************************************************************/ |
482 | 495 |
483 static Lisp_Object | 496 #ifdef LISP_COMMAND_LOOP |
497 static Lisp_Object | |
498 #else | |
499 static DOESNT_RETURN_TYPE (Lisp_Object) | |
500 #endif | |
484 command_loop_1 (Lisp_Object dummy) | 501 command_loop_1 (Lisp_Object dummy) |
485 { | 502 { |
486 /* This function can GC */ | 503 /* This function can GC */ |
487 /* #### not correct with Vselected_console */ | 504 /* #### not correct with Vselected_console */ |
488 XCONSOLE (Vselected_console)->prefix_arg = Qnil; | 505 XCONSOLE (Vselected_console)->prefix_arg = Qnil; |
489 return (Fcommand_loop_1 ()); | 506 Fcommand_loop_1 (); |
507 #ifdef LISP_COMMAND_LOOP | |
508 return Qnil; | |
509 #else | |
510 RETURN_NOT_REACHED (Qnil); | |
511 #endif | |
490 } | 512 } |
491 | 513 |
492 /* This is the actual command reading loop, sans error-handling | 514 /* This is the actual command reading loop, sans error-handling |
493 encapsulation. This is used for both the C and Lisp command | 515 encapsulation. This is used for both the C and Lisp command |
494 loops. Originally this function was written in Lisp when | 516 loops. Originally this function was written in Lisp when |
497 Under the C command loop, this function will never return | 519 Under the C command loop, this function will never return |
498 (although someone might throw past it). Under the Lisp | 520 (although someone might throw past it). Under the Lisp |
499 command loop, this will return only when the user specifies | 521 command loop, this will return only when the user specifies |
500 a new command loop by changing the command-loop variable. */ | 522 a new command loop by changing the command-loop variable. */ |
501 | 523 |
502 DEFUN ("command-loop-1", Fcommand_loop_1, 0, 0, 0, /* | 524 #ifdef LISP_COMMAND_LOOP |
525 #define DEFUN_COMMAND_LOOP(a,b,c,d,e,f) DEFUN (a, b, c, d, e, f) | |
526 #else | |
527 #define DEFUN_COMMAND_LOOP(a,b,c,d,e,f) DEFUN_NORETURN (a, b, c, d, e, f) | |
528 #endif | |
529 | |
530 DEFUN_COMMAND_LOOP ("command-loop-1", Fcommand_loop_1, 0, 0, 0, /* | |
503 Invoke the internals of the canonical editor command loop. | 531 Invoke the internals of the canonical editor command loop. |
504 Don't call this unless you know what you're doing. | 532 Don't call this unless you know what you're doing. |
505 */ | 533 */ |
506 ()) | 534 ()) |
507 { | 535 { |