From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Paul Eggert Newsgroups: gmane.emacs.devel Subject: Re: DEFU* macro name for a extern DEFUN: DEFUE? DEFUNEX? Date: Mon, 11 Apr 2011 09:49:58 -0700 Organization: UCLA Computer Science Department Message-ID: <4DA33136.40206@cs.ucla.edu> References: <4DA295DB.20709@cs.ucla.edu> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1302573280 820 80.91.229.12 (12 Apr 2011 01:54:40 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 12 Apr 2011 01:54:40 +0000 (UTC) Cc: Dan Nicolaescu , Jason Rumney , Emacs-Devel devel To: Juanma Barranquero Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Apr 12 03:54:36 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from [140.186.70.17] (helo=lists.gnu.org) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Q9SoO-0005D6-8j for ged-emacs-devel@m.gmane.org; Tue, 12 Apr 2011 03:54:36 +0200 Original-Received: from localhost ([::1]:57274 helo=lists2.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q9SoN-0005FG-WA for ged-emacs-devel@m.gmane.org; Mon, 11 Apr 2011 21:54:36 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:52931) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q9SmD-0001Xb-CH for emacs-devel@gnu.org; Mon, 11 Apr 2011 21:52:31 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q9KJZ-0007pv-4b for emacs-devel@gnu.org; Mon, 11 Apr 2011 12:50:13 -0400 Original-Received: from smtp.cs.ucla.edu ([131.179.128.62]:35351) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q9KJX-0007pK-5o; Mon, 11 Apr 2011 12:50:11 -0400 Original-Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp.cs.ucla.edu (Postfix) with ESMTP id 5BC3239E80F8; Mon, 11 Apr 2011 09:50:08 -0700 (PDT) X-Virus-Scanned: amavisd-new at smtp.cs.ucla.edu Original-Received: from smtp.cs.ucla.edu ([127.0.0.1]) by localhost (smtp.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id s4feN-mYL6vP; Mon, 11 Apr 2011 09:50:07 -0700 (PDT) Original-Received: from [131.179.64.200] (Penguin.CS.UCLA.EDU [131.179.64.200]) by smtp.cs.ucla.edu (Postfix) with ESMTPSA id 7448939E80DB; Mon, 11 Apr 2011 09:50:07 -0700 (PDT) User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.15) Gecko/20110307 Fedora/3.1.9-0.39.b3pre.fc14 Thunderbird/3.1.9 In-Reply-To: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 131.179.128.62 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org X-Broken-Reverse-DNS: no host name found for IP address 140.186.70.17 Xref: news.gmane.org gmane.emacs.devel:138408 Archived-At: On 04/11/2011 03:39 AM, Juanma Barranquero wrote: > If the common case is non-static, it would be better IMHO to have > DEFUN_INTERNAL and DEFUN, or somesuch. I agree, but the common case is static by far. There are 809 static and 360 extern functions in my copy. On 04/11/2011 07:34 AM, Jason Rumney wrote: > Marking them static sounds like a recipe for future maintainence > headaches due to users' optimisation settings. I can't imagine what that headache would be. Once a pointer to a function escapes (from the C point of view), a C compiler cannot optimize the function away. Do you have a specific scenario in mind? > If they are referenced outside of file scope, they are not static, > whether the referencing code is C or Lisp. It's quite true that the functions are not static from the Lisp point of view, and that C code in other modules can invoke the functions by looking them up in the relevant tables; but still, they are static from the C point of view and knowing this can help people read the C code and do further analysis. (Doing this let me find the bug with copy-font-spec, for example.) I plan to discuss this a bit in the documentation that it was suggested that I add. PS. I've been plowing ahead with more static analysis based on changing 'extern' to 'static', and have found a bit more stuff that's never used: encode_coding_gap, for example. Some of the stuff is used only on some platforms and can safely be removed on platforms where it cannot be called: mark_backtrace, for example.