diff options
| author | Paul Eggert | 2011-06-30 22:12:00 -0700 |
|---|---|---|
| committer | Paul Eggert | 2011-06-30 22:12:00 -0700 |
| commit | bbc6b304672eb229e6750692a1b4e83277ded115 (patch) | |
| tree | 5419d939903352103bccb146669af19e7255ecc3 /src | |
| parent | fb81de5fb57e946c936cce4f2f3753255bc2e8da (diff) | |
| download | emacs-bbc6b304672eb229e6750692a1b4e83277ded115.tar.gz emacs-bbc6b304672eb229e6750692a1b4e83277ded115.zip | |
* eval.c (struct backtrace): Simplify and port the data structure.
Do not assume that "int nargs : BITS_PER_INT - 2;" produces a
signed bit field, as this assumption is not portable and it makes
Emacs crash when compiled with Sun C 5.8 on sparc. Do not use
"char debug_on_exit : 1" as this is not portable either; instead,
use the portable "unsigned int debug_on_exit : 1". Remove unused
member evalargs. Remove obsolete comments about cc bombing out.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 10 | ||||
| -rw-r--r-- | src/eval.c | 23 |
2 files changed, 13 insertions, 20 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index dc51a2633ac..85cf1d2a255 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,13 @@ | |||
| 1 | 2011-07-01 Paul Eggert <eggert@cs.ucla.edu> | ||
| 2 | |||
| 3 | * eval.c (struct backtrace): Simplify and port the data structure. | ||
| 4 | Do not assume that "int nargs : BITS_PER_INT - 2;" produces a | ||
| 5 | signed bit field, as this assumption is not portable and it makes | ||
| 6 | Emacs crash when compiled with Sun C 5.8 on sparc. Do not use | ||
| 7 | "char debug_on_exit : 1" as this is not portable either; instead, | ||
| 8 | use the portable "unsigned int debug_on_exit : 1". Remove unused | ||
| 9 | member evalargs. Remove obsolete comments about cc bombing out. | ||
| 10 | |||
| 1 | 2011-06-30 Jan Djärv <jan.h.d@swipnet.se> | 11 | 2011-06-30 Jan Djärv <jan.h.d@swipnet.se> |
| 2 | 12 | ||
| 3 | * xsettings.c: Include glib-object.h, gio/gio.h if HAVE_GSETTINGS. | 13 | * xsettings.c: Include glib-object.h, gio/gio.h if HAVE_GSETTINGS. |
diff --git a/src/eval.c b/src/eval.c index 6ca8eacb100..cb8b4f3ea07 100644 --- a/src/eval.c +++ b/src/eval.c | |||
| @@ -32,25 +32,14 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 32 | #include "xterm.h" | 32 | #include "xterm.h" |
| 33 | #endif | 33 | #endif |
| 34 | 34 | ||
| 35 | /* This definition is duplicated in alloc.c and keyboard.c. */ | ||
| 36 | /* Putting it in lisp.h makes cc bomb out! */ | ||
| 37 | |||
| 38 | struct backtrace | 35 | struct backtrace |
| 39 | { | 36 | { |
| 40 | struct backtrace *next; | 37 | struct backtrace *next; |
| 41 | Lisp_Object *function; | 38 | Lisp_Object *function; |
| 42 | Lisp_Object *args; /* Points to vector of args. */ | 39 | Lisp_Object *args; /* Points to vector of args. */ |
| 43 | #define NARGS_BITS (BITS_PER_INT - 2) | 40 | ptrdiff_t nargs; /* Length of vector. */ |
| 44 | /* Let's not use size_t because we want to allow negative values (for | ||
| 45 | UNEVALLED). Also let's steal 2 bits so we save a word (or more for | ||
| 46 | alignment). In any case I doubt Emacs would survive a function call with | ||
| 47 | more than 500M arguments. */ | ||
| 48 | int nargs : NARGS_BITS; /* Length of vector. | ||
| 49 | If nargs is UNEVALLED, args points | ||
| 50 | to slot holding list of unevalled args. */ | ||
| 51 | char evalargs : 1; | ||
| 52 | /* Nonzero means call value of debugger when done with this operation. */ | 41 | /* Nonzero means call value of debugger when done with this operation. */ |
| 53 | char debug_on_exit : 1; | 42 | unsigned int debug_on_exit : 1; |
| 54 | }; | 43 | }; |
| 55 | 44 | ||
| 56 | static struct backtrace *backtrace_list; | 45 | static struct backtrace *backtrace_list; |
| @@ -2291,7 +2280,6 @@ eval_sub (Lisp_Object form) | |||
| 2291 | backtrace.function = &original_fun; /* This also protects them from gc. */ | 2280 | backtrace.function = &original_fun; /* This also protects them from gc. */ |
| 2292 | backtrace.args = &original_args; | 2281 | backtrace.args = &original_args; |
| 2293 | backtrace.nargs = UNEVALLED; | 2282 | backtrace.nargs = UNEVALLED; |
| 2294 | backtrace.evalargs = 1; | ||
| 2295 | backtrace.debug_on_exit = 0; | 2283 | backtrace.debug_on_exit = 0; |
| 2296 | 2284 | ||
| 2297 | if (debug_on_next_call) | 2285 | if (debug_on_next_call) |
| @@ -2325,10 +2313,7 @@ eval_sub (Lisp_Object form) | |||
| 2325 | xsignal2 (Qwrong_number_of_arguments, original_fun, numargs); | 2313 | xsignal2 (Qwrong_number_of_arguments, original_fun, numargs); |
| 2326 | 2314 | ||
| 2327 | else if (XSUBR (fun)->max_args == UNEVALLED) | 2315 | else if (XSUBR (fun)->max_args == UNEVALLED) |
| 2328 | { | 2316 | val = (XSUBR (fun)->function.aUNEVALLED) (args_left); |
| 2329 | backtrace.evalargs = 0; | ||
| 2330 | val = (XSUBR (fun)->function.aUNEVALLED) (args_left); | ||
| 2331 | } | ||
| 2332 | else if (XSUBR (fun)->max_args == MANY) | 2317 | else if (XSUBR (fun)->max_args == MANY) |
| 2333 | { | 2318 | { |
| 2334 | /* Pass a vector of evaluated arguments. */ | 2319 | /* Pass a vector of evaluated arguments. */ |
| @@ -2984,7 +2969,6 @@ usage: (funcall FUNCTION &rest ARGUMENTS) */) | |||
| 2984 | backtrace.function = &args[0]; | 2969 | backtrace.function = &args[0]; |
| 2985 | backtrace.args = &args[1]; | 2970 | backtrace.args = &args[1]; |
| 2986 | backtrace.nargs = nargs - 1; | 2971 | backtrace.nargs = nargs - 1; |
| 2987 | backtrace.evalargs = 0; | ||
| 2988 | backtrace.debug_on_exit = 0; | 2972 | backtrace.debug_on_exit = 0; |
| 2989 | 2973 | ||
| 2990 | if (debug_on_next_call) | 2974 | if (debug_on_next_call) |
| @@ -3141,7 +3125,6 @@ apply_lambda (Lisp_Object fun, Lisp_Object args) | |||
| 3141 | 3125 | ||
| 3142 | backtrace_list->args = arg_vector; | 3126 | backtrace_list->args = arg_vector; |
| 3143 | backtrace_list->nargs = i; | 3127 | backtrace_list->nargs = i; |
| 3144 | backtrace_list->evalargs = 0; | ||
| 3145 | tem = funcall_lambda (fun, numargs, arg_vector); | 3128 | tem = funcall_lambda (fun, numargs, arg_vector); |
| 3146 | 3129 | ||
| 3147 | /* Do the debug-on-exit now, while arg_vector still exists. */ | 3130 | /* Do the debug-on-exit now, while arg_vector still exists. */ |