diff options
| author | Stefan Monnier | 2010-12-19 00:43:42 -0500 |
|---|---|---|
| committer | Stefan Monnier | 2010-12-19 00:43:42 -0500 |
| commit | ef1b0ba7e5a82308514b8427cd84994805e61a4f (patch) | |
| tree | b859dcfe452c6b493b20c58a2c6af1d8032c296f /src/eval.c | |
| parent | 45720dc368101aa88ba2ec88f6259ae4aaf3d847 (diff) | |
| download | emacs-ef1b0ba7e5a82308514b8427cd84994805e61a4f.tar.gz emacs-ef1b0ba7e5a82308514b8427cd84994805e61a4f.zip | |
Minor clean up to silence some gcc warnings.
* src/window.c (Fset_window_buffer):
* src/xterm.c (x_set_frame_alpha): Restructure code to silence
compiler warning.
(handle_one_xevent): Remove unused var `p'.
(do_ewmh_fullscreen): Remove unused var `lval'.
(xembed_set_info): Remove unused var `atom'.
* src/textprop.c (Fremove_list_of_text_properties): Add braces to silence
compiler warning.
* src/fontset.c (fontset_id_valid_p, dump_fontset):
* src/ftfont.c (ftfont_drive_otf): Modernize k&r declaration.
* src/eval.c (Feval, Ffuncall): Avoid unneeded gotos.
* src/dispnew.c (update_frame, update_frame_1): Compile the `do_pause'
label only when it's used.
* src/image.c (x_create_bitmap_from_xpm_data):
* src/dispextern.h (x_create_bitmap_from_xpm_data): Use const char** like
its callers.
* src/coding.c (detect_coding_utf_16): Remove unused vars `src_base' and
`consumed_chars'.
(DECODE_EMACS_MULE_21_COMPOSITION): Remove unused var `charbuf_base'.
(decode_coding_emacs_mule): Remove unused label `retry'.
(detect_eol): Add parens to silence compiler warning.
* src/alloc.c (bytes_used_when_reconsidered): Move to the #ifdef where
it's used to silence the compiler.
(make_number): Modernize k&r declaration.
(mark_char_table): Add parens to silence compiler warning.
Diffstat (limited to 'src/eval.c')
| -rw-r--r-- | src/eval.c | 262 |
1 files changed, 131 insertions, 131 deletions
diff --git a/src/eval.c b/src/eval.c index 8580ceb8c38..f8874ddd559 100644 --- a/src/eval.c +++ b/src/eval.c | |||
| @@ -2291,14 +2291,12 @@ DEFUN ("eval", Feval, Seval, 1, 1, 0, | |||
| 2291 | (XSUBR (fun)->max_args >= 0 && XSUBR (fun)->max_args < XINT (numargs))) | 2291 | (XSUBR (fun)->max_args >= 0 && XSUBR (fun)->max_args < XINT (numargs))) |
| 2292 | xsignal2 (Qwrong_number_of_arguments, original_fun, numargs); | 2292 | xsignal2 (Qwrong_number_of_arguments, original_fun, numargs); |
| 2293 | 2293 | ||
| 2294 | if (XSUBR (fun)->max_args == UNEVALLED) | 2294 | else if (XSUBR (fun)->max_args == UNEVALLED) |
| 2295 | { | 2295 | { |
| 2296 | backtrace.evalargs = 0; | 2296 | backtrace.evalargs = 0; |
| 2297 | val = (XSUBR (fun)->function.aUNEVALLED) (args_left); | 2297 | val = (XSUBR (fun)->function.aUNEVALLED) (args_left); |
| 2298 | goto done; | ||
| 2299 | } | 2298 | } |
| 2300 | 2299 | else if (XSUBR (fun)->max_args == MANY) | |
| 2301 | if (XSUBR (fun)->max_args == MANY) | ||
| 2302 | { | 2300 | { |
| 2303 | /* Pass a vector of evaluated arguments */ | 2301 | /* Pass a vector of evaluated arguments */ |
| 2304 | Lisp_Object *vals; | 2302 | Lisp_Object *vals; |
| @@ -2324,73 +2322,76 @@ DEFUN ("eval", Feval, Seval, 1, 1, 0, | |||
| 2324 | val = (XSUBR (fun)->function.aMANY) (XINT (numargs), vals); | 2322 | val = (XSUBR (fun)->function.aMANY) (XINT (numargs), vals); |
| 2325 | UNGCPRO; | 2323 | UNGCPRO; |
| 2326 | SAFE_FREE (); | 2324 | SAFE_FREE (); |
| 2327 | goto done; | ||
| 2328 | } | 2325 | } |
| 2329 | 2326 | else | |
| 2330 | GCPRO3 (args_left, fun, fun); | ||
| 2331 | gcpro3.var = argvals; | ||
| 2332 | gcpro3.nvars = 0; | ||
| 2333 | |||
| 2334 | maxargs = XSUBR (fun)->max_args; | ||
| 2335 | for (i = 0; i < maxargs; args_left = Fcdr (args_left)) | ||
| 2336 | { | 2327 | { |
| 2337 | argvals[i] = Feval (Fcar (args_left)); | 2328 | GCPRO3 (args_left, fun, fun); |
| 2338 | gcpro3.nvars = ++i; | 2329 | gcpro3.var = argvals; |
| 2339 | } | 2330 | gcpro3.nvars = 0; |
| 2340 | 2331 | ||
| 2341 | UNGCPRO; | 2332 | maxargs = XSUBR (fun)->max_args; |
| 2333 | for (i = 0; i < maxargs; args_left = Fcdr (args_left)) | ||
| 2334 | { | ||
| 2335 | argvals[i] = Feval (Fcar (args_left)); | ||
| 2336 | gcpro3.nvars = ++i; | ||
| 2337 | } | ||
| 2342 | 2338 | ||
| 2343 | backtrace.args = argvals; | 2339 | UNGCPRO; |
| 2344 | backtrace.nargs = XINT (numargs); | ||
| 2345 | 2340 | ||
| 2346 | switch (i) | 2341 | backtrace.args = argvals; |
| 2347 | { | 2342 | backtrace.nargs = XINT (numargs); |
| 2348 | case 0: | 2343 | |
| 2349 | val = (XSUBR (fun)->function.a0) (); | 2344 | switch (i) |
| 2350 | goto done; | 2345 | { |
| 2351 | case 1: | 2346 | case 0: |
| 2352 | val = (XSUBR (fun)->function.a1) (argvals[0]); | 2347 | val = (XSUBR (fun)->function.a0 ()); |
| 2353 | goto done; | 2348 | break; |
| 2354 | case 2: | 2349 | case 1: |
| 2355 | val = (XSUBR (fun)->function.a2) (argvals[0], argvals[1]); | 2350 | val = (XSUBR (fun)->function.a1 (argvals[0])); |
| 2356 | goto done; | 2351 | break; |
| 2357 | case 3: | 2352 | case 2: |
| 2358 | val = (XSUBR (fun)->function.a3) (argvals[0], argvals[1], | 2353 | val = (XSUBR (fun)->function.a2 (argvals[0], argvals[1])); |
| 2359 | argvals[2]); | 2354 | break; |
| 2360 | goto done; | 2355 | case 3: |
| 2361 | case 4: | 2356 | val = (XSUBR (fun)->function.a3 |
| 2362 | val = (XSUBR (fun)->function.a4) (argvals[0], argvals[1], | 2357 | (argvals[0], argvals[1], argvals[2])); |
| 2363 | argvals[2], argvals[3]); | 2358 | break; |
| 2364 | goto done; | 2359 | case 4: |
| 2365 | case 5: | 2360 | val = (XSUBR (fun)->function.a4 |
| 2366 | val = (XSUBR (fun)->function.a5) (argvals[0], argvals[1], argvals[2], | 2361 | (argvals[0], argvals[1], argvals[2], argvals[3])); |
| 2367 | argvals[3], argvals[4]); | 2362 | break; |
| 2368 | goto done; | 2363 | case 5: |
| 2369 | case 6: | 2364 | val = (XSUBR (fun)->function.a5 |
| 2370 | val = (XSUBR (fun)->function.a6) (argvals[0], argvals[1], argvals[2], | 2365 | (argvals[0], argvals[1], argvals[2], argvals[3], |
| 2371 | argvals[3], argvals[4], argvals[5]); | 2366 | argvals[4])); |
| 2372 | goto done; | 2367 | break; |
| 2373 | case 7: | 2368 | case 6: |
| 2374 | val = (XSUBR (fun)->function.a7) (argvals[0], argvals[1], argvals[2], | 2369 | val = (XSUBR (fun)->function.a6 |
| 2375 | argvals[3], argvals[4], argvals[5], | 2370 | (argvals[0], argvals[1], argvals[2], argvals[3], |
| 2376 | argvals[6]); | 2371 | argvals[4], argvals[5])); |
| 2377 | goto done; | 2372 | break; |
| 2378 | 2373 | case 7: | |
| 2379 | case 8: | 2374 | val = (XSUBR (fun)->function.a7 |
| 2380 | val = (XSUBR (fun)->function.a8) (argvals[0], argvals[1], argvals[2], | 2375 | (argvals[0], argvals[1], argvals[2], argvals[3], |
| 2381 | argvals[3], argvals[4], argvals[5], | 2376 | argvals[4], argvals[5], argvals[6])); |
| 2382 | argvals[6], argvals[7]); | 2377 | break; |
| 2383 | goto done; | 2378 | |
| 2384 | 2379 | case 8: | |
| 2385 | default: | 2380 | val = (XSUBR (fun)->function.a8 |
| 2386 | /* Someone has created a subr that takes more arguments than | 2381 | (argvals[0], argvals[1], argvals[2], argvals[3], |
| 2387 | is supported by this code. We need to either rewrite the | 2382 | argvals[4], argvals[5], argvals[6], argvals[7])); |
| 2388 | subr to use a different argument protocol, or add more | 2383 | break; |
| 2389 | cases to this switch. */ | 2384 | |
| 2390 | abort (); | 2385 | default: |
| 2386 | /* Someone has created a subr that takes more arguments than | ||
| 2387 | is supported by this code. We need to either rewrite the | ||
| 2388 | subr to use a different argument protocol, or add more | ||
| 2389 | cases to this switch. */ | ||
| 2390 | abort (); | ||
| 2391 | } | ||
| 2391 | } | 2392 | } |
| 2392 | } | 2393 | } |
| 2393 | if (COMPILEDP (fun)) | 2394 | else if (COMPILEDP (fun)) |
| 2394 | val = apply_lambda (fun, original_args, 1); | 2395 | val = apply_lambda (fun, original_args, 1); |
| 2395 | else | 2396 | else |
| 2396 | { | 2397 | { |
| @@ -2413,7 +2414,6 @@ DEFUN ("eval", Feval, Seval, 1, 1, 0, | |||
| 2413 | else | 2414 | else |
| 2414 | xsignal1 (Qinvalid_function, original_fun); | 2415 | xsignal1 (Qinvalid_function, original_fun); |
| 2415 | } | 2416 | } |
| 2416 | done: | ||
| 2417 | CHECK_CONS_LIST (); | 2417 | CHECK_CONS_LIST (); |
| 2418 | 2418 | ||
| 2419 | lisp_eval_depth--; | 2419 | lisp_eval_depth--; |
| @@ -2956,83 +2956,84 @@ usage: (funcall FUNCTION &rest ARGUMENTS) */) | |||
| 2956 | 2956 | ||
| 2957 | if (SUBRP (fun)) | 2957 | if (SUBRP (fun)) |
| 2958 | { | 2958 | { |
| 2959 | if (numargs < XSUBR (fun)->min_args | 2959 | if (numargs < XSUBR (fun)->min_args |
| 2960 | || (XSUBR (fun)->max_args >= 0 && XSUBR (fun)->max_args < numargs)) | 2960 | || (XSUBR (fun)->max_args >= 0 && XSUBR (fun)->max_args < numargs)) |
| 2961 | { | 2961 | { |
| 2962 | XSETFASTINT (lisp_numargs, numargs); | 2962 | XSETFASTINT (lisp_numargs, numargs); |
| 2963 | xsignal2 (Qwrong_number_of_arguments, original_fun, lisp_numargs); | 2963 | xsignal2 (Qwrong_number_of_arguments, original_fun, lisp_numargs); |
| 2964 | } | 2964 | } |
| 2965 | 2965 | ||
| 2966 | if (XSUBR (fun)->max_args == UNEVALLED) | 2966 | else if (XSUBR (fun)->max_args == UNEVALLED) |
| 2967 | xsignal1 (Qinvalid_function, original_fun); | 2967 | xsignal1 (Qinvalid_function, original_fun); |
| 2968 | 2968 | ||
| 2969 | if (XSUBR (fun)->max_args == MANY) | 2969 | else if (XSUBR (fun)->max_args == MANY) |
| 2970 | { | 2970 | val = (XSUBR (fun)->function.aMANY) (numargs, args + 1); |
| 2971 | val = (XSUBR (fun)->function.aMANY) (numargs, args + 1); | ||
| 2972 | goto done; | ||
| 2973 | } | ||
| 2974 | |||
| 2975 | if (XSUBR (fun)->max_args > numargs) | ||
| 2976 | { | ||
| 2977 | internal_args = (Lisp_Object *) alloca (XSUBR (fun)->max_args * sizeof (Lisp_Object)); | ||
| 2978 | memcpy (internal_args, args + 1, numargs * sizeof (Lisp_Object)); | ||
| 2979 | for (i = numargs; i < XSUBR (fun)->max_args; i++) | ||
| 2980 | internal_args[i] = Qnil; | ||
| 2981 | } | ||
| 2982 | else | 2971 | else |
| 2983 | internal_args = args + 1; | ||
| 2984 | switch (XSUBR (fun)->max_args) | ||
| 2985 | { | 2972 | { |
| 2986 | case 0: | 2973 | if (XSUBR (fun)->max_args > numargs) |
| 2987 | val = (XSUBR (fun)->function.a0) (); | 2974 | { |
| 2988 | goto done; | 2975 | internal_args = (Lisp_Object *) alloca (XSUBR (fun)->max_args * sizeof (Lisp_Object)); |
| 2989 | case 1: | 2976 | memcpy (internal_args, args + 1, numargs * sizeof (Lisp_Object)); |
| 2990 | val = (XSUBR (fun)->function.a1) (internal_args[0]); | 2977 | for (i = numargs; i < XSUBR (fun)->max_args; i++) |
| 2991 | goto done; | 2978 | internal_args[i] = Qnil; |
| 2992 | case 2: | 2979 | } |
| 2993 | val = (XSUBR (fun)->function.a2) (internal_args[0], internal_args[1]); | 2980 | else |
| 2994 | goto done; | 2981 | internal_args = args + 1; |
| 2995 | case 3: | 2982 | switch (XSUBR (fun)->max_args) |
| 2996 | val = (XSUBR (fun)->function.a3) (internal_args[0], internal_args[1], | 2983 | { |
| 2997 | internal_args[2]); | 2984 | case 0: |
| 2998 | goto done; | 2985 | val = (XSUBR (fun)->function.a0 ()); |
| 2999 | case 4: | 2986 | break; |
| 3000 | val = (XSUBR (fun)->function.a4) (internal_args[0], internal_args[1], | 2987 | case 1: |
| 3001 | internal_args[2], internal_args[3]); | 2988 | val = (XSUBR (fun)->function.a1 (internal_args[0])); |
| 3002 | goto done; | 2989 | break; |
| 3003 | case 5: | 2990 | case 2: |
| 3004 | val = (XSUBR (fun)->function.a5) (internal_args[0], internal_args[1], | 2991 | val = (XSUBR (fun)->function.a2 |
| 3005 | internal_args[2], internal_args[3], | 2992 | (internal_args[0], internal_args[1])); |
| 3006 | internal_args[4]); | 2993 | break; |
| 3007 | goto done; | 2994 | case 3: |
| 3008 | case 6: | 2995 | val = (XSUBR (fun)->function.a3 |
| 3009 | val = (XSUBR (fun)->function.a6) (internal_args[0], internal_args[1], | 2996 | (internal_args[0], internal_args[1], internal_args[2])); |
| 3010 | internal_args[2], internal_args[3], | 2997 | break; |
| 3011 | internal_args[4], internal_args[5]); | 2998 | case 4: |
| 3012 | goto done; | 2999 | val = (XSUBR (fun)->function.a4 |
| 3013 | case 7: | 3000 | (internal_args[0], internal_args[1], internal_args[2], |
| 3014 | val = (XSUBR (fun)->function.a7) (internal_args[0], internal_args[1], | 3001 | internal_args[3])); |
| 3015 | internal_args[2], internal_args[3], | 3002 | break; |
| 3016 | internal_args[4], internal_args[5], | 3003 | case 5: |
| 3017 | internal_args[6]); | 3004 | val = (XSUBR (fun)->function.a5 |
| 3018 | goto done; | 3005 | (internal_args[0], internal_args[1], internal_args[2], |
| 3019 | 3006 | internal_args[3], internal_args[4])); | |
| 3020 | case 8: | 3007 | break; |
| 3021 | val = (XSUBR (fun)->function.a8) (internal_args[0], internal_args[1], | 3008 | case 6: |
| 3022 | internal_args[2], internal_args[3], | 3009 | val = (XSUBR (fun)->function.a6 |
| 3023 | internal_args[4], internal_args[5], | 3010 | (internal_args[0], internal_args[1], internal_args[2], |
| 3024 | internal_args[6], internal_args[7]); | 3011 | internal_args[3], internal_args[4], internal_args[5])); |
| 3025 | goto done; | 3012 | break; |
| 3026 | 3013 | case 7: | |
| 3027 | default: | 3014 | val = (XSUBR (fun)->function.a7 |
| 3028 | 3015 | (internal_args[0], internal_args[1], internal_args[2], | |
| 3029 | /* If a subr takes more than 8 arguments without using MANY | 3016 | internal_args[3], internal_args[4], internal_args[5], |
| 3030 | or UNEVALLED, we need to extend this function to support it. | 3017 | internal_args[6])); |
| 3031 | Until this is done, there is no way to call the function. */ | 3018 | break; |
| 3032 | abort (); | 3019 | |
| 3020 | case 8: | ||
| 3021 | val = (XSUBR (fun)->function.a8 | ||
| 3022 | (internal_args[0], internal_args[1], internal_args[2], | ||
| 3023 | internal_args[3], internal_args[4], internal_args[5], | ||
| 3024 | internal_args[6], internal_args[7])); | ||
| 3025 | break; | ||
| 3026 | |||
| 3027 | default: | ||
| 3028 | |||
| 3029 | /* If a subr takes more than 8 arguments without using MANY | ||
| 3030 | or UNEVALLED, we need to extend this function to support it. | ||
| 3031 | Until this is done, there is no way to call the function. */ | ||
| 3032 | abort (); | ||
| 3033 | } | ||
| 3033 | } | 3034 | } |
| 3034 | } | 3035 | } |
| 3035 | if (COMPILEDP (fun)) | 3036 | else if (COMPILEDP (fun)) |
| 3036 | val = funcall_lambda (fun, numargs, args + 1); | 3037 | val = funcall_lambda (fun, numargs, args + 1); |
| 3037 | else | 3038 | else |
| 3038 | { | 3039 | { |
| @@ -3054,7 +3055,6 @@ usage: (funcall FUNCTION &rest ARGUMENTS) */) | |||
| 3054 | else | 3055 | else |
| 3055 | xsignal1 (Qinvalid_function, original_fun); | 3056 | xsignal1 (Qinvalid_function, original_fun); |
| 3056 | } | 3057 | } |
| 3057 | done: | ||
| 3058 | CHECK_CONS_LIST (); | 3058 | CHECK_CONS_LIST (); |
| 3059 | lisp_eval_depth--; | 3059 | lisp_eval_depth--; |
| 3060 | if (backtrace.debug_on_exit) | 3060 | if (backtrace.debug_on_exit) |