1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-26 10:49:33 +00:00

Make the function member of Lisp_Subr use standard C prototypes.

* src/lisp.h (struct Lisp_Subr): Use a union for the function member.
(DECL_ALIGN): Add a cast for the function.
* src/eval.c (Feval, Ffuncall): Use the proper type for each type
function call.
This commit is contained in:
Dan Nicolaescu 2010-07-06 19:49:37 -07:00
parent 67aecef9f5
commit c0f2f16b6a
3 changed files with 62 additions and 43 deletions

View File

@ -1,3 +1,11 @@
2010-07-07 Dan Nicolaescu <dann@ics.uci.edu>
Make the function member of Lisp_Subr use standard C prototypes.
* lisp.h (struct Lisp_Subr): Use a union for the function member.
(DECL_ALIGN): Add a cast for the function.
* eval.c (Feval, Ffuncall): Use the proper type for each type
function call.
2010-07-06 Chong Yidong <cyd@stupidchicken.com>
* fringe.c (draw_fringe_bitmap_1): Use lookup_named_face to get

View File

@ -2330,7 +2330,7 @@ DEFUN ("eval", Feval, Seval, 1, 1, 0,
if (XSUBR (fun)->max_args == UNEVALLED)
{
backtrace.evalargs = 0;
val = (*XSUBR (fun)->function) (args_left);
val = (XSUBR (fun)->function.a1) (args_left);
goto done;
}
@ -2356,7 +2356,7 @@ DEFUN ("eval", Feval, Seval, 1, 1, 0,
backtrace.args = vals;
backtrace.nargs = XINT (numargs);
val = (*XSUBR (fun)->function) (XINT (numargs), vals);
val = (XSUBR (fun)->function.am) (XINT (numargs), vals);
UNGCPRO;
goto done;
}
@ -2380,40 +2380,40 @@ DEFUN ("eval", Feval, Seval, 1, 1, 0,
switch (i)
{
case 0:
val = (*XSUBR (fun)->function) ();
val = (XSUBR (fun)->function.a0) ();
goto done;
case 1:
val = (*XSUBR (fun)->function) (argvals[0]);
val = (XSUBR (fun)->function.a1) (argvals[0]);
goto done;
case 2:
val = (*XSUBR (fun)->function) (argvals[0], argvals[1]);
val = (XSUBR (fun)->function.a2) (argvals[0], argvals[1]);
goto done;
case 3:
val = (*XSUBR (fun)->function) (argvals[0], argvals[1],
argvals[2]);
val = (XSUBR (fun)->function.a3) (argvals[0], argvals[1],
argvals[2]);
goto done;
case 4:
val = (*XSUBR (fun)->function) (argvals[0], argvals[1],
argvals[2], argvals[3]);
val = (XSUBR (fun)->function.a4) (argvals[0], argvals[1],
argvals[2], argvals[3]);
goto done;
case 5:
val = (*XSUBR (fun)->function) (argvals[0], argvals[1], argvals[2],
argvals[3], argvals[4]);
val = (XSUBR (fun)->function.a5) (argvals[0], argvals[1], argvals[2],
argvals[3], argvals[4]);
goto done;
case 6:
val = (*XSUBR (fun)->function) (argvals[0], argvals[1], argvals[2],
argvals[3], argvals[4], argvals[5]);
val = (XSUBR (fun)->function.a6) (argvals[0], argvals[1], argvals[2],
argvals[3], argvals[4], argvals[5]);
goto done;
case 7:
val = (*XSUBR (fun)->function) (argvals[0], argvals[1], argvals[2],
argvals[3], argvals[4], argvals[5],
argvals[6]);
val = (XSUBR (fun)->function.a7) (argvals[0], argvals[1], argvals[2],
argvals[3], argvals[4], argvals[5],
argvals[6]);
goto done;
case 8:
val = (*XSUBR (fun)->function) (argvals[0], argvals[1], argvals[2],
argvals[3], argvals[4], argvals[5],
argvals[6], argvals[7]);
val = (XSUBR (fun)->function.a8) (argvals[0], argvals[1], argvals[2],
argvals[3], argvals[4], argvals[5],
argvals[6], argvals[7]);
goto done;
default:
@ -3011,7 +3011,7 @@ usage: (funcall FUNCTION &rest ARGUMENTS) */)
if (XSUBR (fun)->max_args == MANY)
{
val = (*XSUBR (fun)->function) (numargs, args + 1);
val = (XSUBR (fun)->function.am) (numargs, args + 1);
goto done;
}
@ -3027,44 +3027,44 @@ usage: (funcall FUNCTION &rest ARGUMENTS) */)
switch (XSUBR (fun)->max_args)
{
case 0:
val = (*XSUBR (fun)->function) ();
val = (XSUBR (fun)->function.a0) ();
goto done;
case 1:
val = (*XSUBR (fun)->function) (internal_args[0]);
val = (XSUBR (fun)->function.a1) (internal_args[0]);
goto done;
case 2:
val = (*XSUBR (fun)->function) (internal_args[0], internal_args[1]);
val = (XSUBR (fun)->function.a2) (internal_args[0], internal_args[1]);
goto done;
case 3:
val = (*XSUBR (fun)->function) (internal_args[0], internal_args[1],
internal_args[2]);
val = (XSUBR (fun)->function.a3) (internal_args[0], internal_args[1],
internal_args[2]);
goto done;
case 4:
val = (*XSUBR (fun)->function) (internal_args[0], internal_args[1],
internal_args[2], internal_args[3]);
val = (XSUBR (fun)->function.a4) (internal_args[0], internal_args[1],
internal_args[2], internal_args[3]);
goto done;
case 5:
val = (*XSUBR (fun)->function) (internal_args[0], internal_args[1],
internal_args[2], internal_args[3],
internal_args[4]);
val = (XSUBR (fun)->function.a5) (internal_args[0], internal_args[1],
internal_args[2], internal_args[3],
internal_args[4]);
goto done;
case 6:
val = (*XSUBR (fun)->function) (internal_args[0], internal_args[1],
internal_args[2], internal_args[3],
internal_args[4], internal_args[5]);
val = (XSUBR (fun)->function.a6) (internal_args[0], internal_args[1],
internal_args[2], internal_args[3],
internal_args[4], internal_args[5]);
goto done;
case 7:
val = (*XSUBR (fun)->function) (internal_args[0], internal_args[1],
internal_args[2], internal_args[3],
internal_args[4], internal_args[5],
internal_args[6]);
val = (XSUBR (fun)->function.a7) (internal_args[0], internal_args[1],
internal_args[2], internal_args[3],
internal_args[4], internal_args[5],
internal_args[6]);
goto done;
case 8:
val = (*XSUBR (fun)->function) (internal_args[0], internal_args[1],
internal_args[2], internal_args[3],
internal_args[4], internal_args[5],
internal_args[6], internal_args[7]);
val = (XSUBR (fun)->function.a8) (internal_args[0], internal_args[1],
internal_args[2], internal_args[3],
internal_args[4], internal_args[5],
internal_args[6], internal_args[7]);
goto done;
default:

View File

@ -965,7 +965,18 @@ struct Lisp_Bool_Vector
struct Lisp_Subr
{
EMACS_UINT size;
Lisp_Object (*function) ();
union {
Lisp_Object (*a0) (void);
Lisp_Object (*a1) (Lisp_Object);
Lisp_Object (*a2) (Lisp_Object, Lisp_Object);
Lisp_Object (*a3) (Lisp_Object, Lisp_Object, Lisp_Object);
Lisp_Object (*a4) (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object);
Lisp_Object (*a5) (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object);
Lisp_Object (*a6) (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object);
Lisp_Object (*a7) (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object);
Lisp_Object (*a8) (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object);
Lisp_Object (*am) (int, Lisp_Object *);
} function;
short min_args, max_args;
const char *symbol_name;
char *intspec;
@ -1768,7 +1779,7 @@ typedef struct {
Lisp_Object fnname DEFUN_ARGS_ ## maxargs ; \
DECL_ALIGN (struct Lisp_Subr, sname) = \
{ PVEC_SUBR | (sizeof (struct Lisp_Subr) / sizeof (EMACS_INT)), \
fnname, minargs, maxargs, lname, intspec, 0}; \
(Lisp_Object(*)(void)) fnname, minargs, maxargs, lname, intspec, 0}; \
Lisp_Object fnname
/* Note that the weird token-substitution semantics of ANSI C makes