[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: DEFU* macro name for a extern DEFUN: DEFUE? DEFUNEX?

From: Dan Nicolaescu
Subject: Re: DEFU* macro name for a extern DEFUN: DEFUE? DEFUNEX?
Date: Mon, 11 Apr 2011 02:27:35 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux)

Paul Eggert <address@hidden> writes:

> I've been looking into trimming down the sets of symbols exported and
> imported by each C source file in Emacs, down to the list of symbols
> that are actually needed.  This should make it easier to read the
> code, and to do better static analysis, and shrink Emacs a bit by

Are you using gcc ?  If yes, and you are cleaning up the code to not
generate warnings with some -W flags, how about adding those flags to
the default set so that we do not regress?  (configure only sets very few -W
flags now, it could set more...)

> There is a bit of technology needed to get this working, namely, we
> need a way to mark Lisp-visible functions either static or external at
> the C level.  Usually they're static, but often they need to be
> external because other C modules call them directly.  To do this, I
> changed DEFUN so that it generates static functions, and added a new
> macro DEFUE that generates external functions (i.e., DEFUE acts like
> the old DEFUN).  I chose the name DEFUE because the "E" stands for
> "external", "DEFUE" is the same length as "DEFUN" (so that indenting
> need not change), and "DEFUE" starts with "DEFU" (so that the
> make-docfile need not change).  But if people would prefer another
> identifier (DEFUNEX, say?) it'd be easy to change.

How about the more explicit DEFUN_EXTERN and document DEFUN as
generating a static function?
The indentation changes should be minor, they would be one or two lines.

> --- src/lisp.h        2011-04-09 18:42:31 +0000
> +++ src/lisp.h        2011-04-11 00:46:54 +0000
> @@ -1804,8 +1804,12 @@
>   `doc' is documentation for the user.  */

>  #define EXFUN(fnname, maxargs) \
>    extern Lisp_Object fnname DEFUN_ARGS_ ## maxargs
> +#define INFUN(fnname, maxargs) \
> +  static Lisp_Object fnname DEFUN_ARGS_ ## maxargs

How about nothing instead of INFUN?
Explicit prototypes are much easier to read, and easier to figure out
the calling convention.
[IMHO we should also remove EXFUN, it might have been necessary before
using standard C, but it looks like just obfuscation now]

reply via email to

[Prev in Thread] Current Thread [Next in Thread]