From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dan Nicolaescu Newsgroups: gmane.emacs.devel Subject: Re: DEFU* macro name for a extern DEFUN: DEFUE? DEFUNEX? Date: Mon, 11 Apr 2011 02:27:35 -0400 Message-ID: References: <4DA295DB.20709@cs.ucla.edu> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1302503269 21293 80.91.229.12 (11 Apr 2011 06:27:49 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 11 Apr 2011 06:27:49 +0000 (UTC) Cc: Emacs-Devel devel To: Paul Eggert Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Apr 11 08:27:45 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Q9AbB-0002Lc-CN for ged-emacs-devel@m.gmane.org; Mon, 11 Apr 2011 08:27:45 +0200 Original-Received: from localhost ([127.0.0.1]:50157 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q9AbA-0008Vk-Dk for ged-emacs-devel@m.gmane.org; Mon, 11 Apr 2011 02:27:44 -0400 Original-Received: from [140.186.70.92] (port=55043 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q9Ab5-0008Vb-2D for emacs-devel@gnu.org; Mon, 11 Apr 2011 02:27:39 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q9Ab2-0007Oj-F5 for emacs-devel@gnu.org; Mon, 11 Apr 2011 02:27:38 -0400 Original-Received: from fencepost.gnu.org ([140.186.70.10]:40541) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q9Ab2-0007OV-D3 for emacs-devel@gnu.org; Mon, 11 Apr 2011 02:27:36 -0400 Original-Received: from dann by fencepost.gnu.org with local (Exim 4.71) (envelope-from ) id 1Q9Ab1-0001fX-A3; Mon, 11 Apr 2011 02:27:35 -0400 In-Reply-To: <4DA295DB.20709@cs.ucla.edu> (Paul Eggert's message of "Sun, 10 Apr 2011 22:47:07 -0700") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.10 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:138371 Archived-At: Paul Eggert 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]