From: Dan Nicolaescu <dann@gnu.org>
To: Paul Eggert <eggert@cs.ucla.edu>
Cc: Emacs-Devel devel <emacs-devel@gnu.org>
Subject: Re: DEFU* macro name for a extern DEFUN: DEFUE? DEFUNEX?
Date: Mon, 11 Apr 2011 02:27:35 -0400 [thread overview]
Message-ID: <yxqaafx1ew8.fsf@fencepost.gnu.org> (raw)
In-Reply-To: <4DA295DB.20709@cs.ucla.edu> (Paul Eggert's message of "Sun, 10 Apr 2011 22:47:07 -0700")
Paul Eggert <eggert@cs.ucla.edu> 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]
next prev parent reply other threads:[~2011-04-11 6:27 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-11 5:47 DEFU* macro name for a extern DEFUN: DEFUE? DEFUNEX? Paul Eggert
2011-04-11 6:27 ` Dan Nicolaescu [this message]
2011-04-11 6:37 ` Paul Eggert
2011-04-11 10:39 ` Juanma Barranquero
2011-04-11 16:49 ` Paul Eggert
2011-04-11 14:34 ` Jason Rumney
2011-04-11 22:37 ` Chong Yidong
2011-04-12 1:35 ` Paul Eggert
2011-04-14 23:52 ` checking static vs extern symbols Paul Eggert
2011-04-15 8:23 ` Eli Zaretskii
2011-04-15 1:15 ` DEFU* macro name for a extern DEFUN: DEFUE? DEFUNEX? Stefan Monnier
2011-04-12 3:34 ` Stefan Monnier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=yxqaafx1ew8.fsf@fencepost.gnu.org \
--to=dann@gnu.org \
--cc=eggert@cs.ucla.edu \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.