From: Dan Nicolaescu Date: Wed, 7 Jul 2010 02:49:37 +0000 (-0700) Subject: Make the function member of Lisp_Subr use standard C prototypes. X-Git-Tag: emacs-pretest-24.0.90~104^2~275^2~438^2~51^2~81^2~17 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=c0f2f16b6a0801ec30f518db6bcf7f27bb643122;p=emacs.git 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. --- diff --git a/src/ChangeLog b/src/ChangeLog index 4cc649eccc1..05b231fffa2 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,11 @@ +2010-07-07 Dan Nicolaescu + + 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 * fringe.c (draw_fringe_bitmap_1): Use lookup_named_face to get diff --git a/src/eval.c b/src/eval.c index 84f98c8b22c..d7e19139c6e 100644 --- a/src/eval.c +++ b/src/eval.c @@ -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: diff --git a/src/lisp.h b/src/lisp.h index 4874985abf4..3a3cde27897 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -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