all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: Juanma Barranquero <lekktu@gmail.com>
Cc: Dan Nicolaescu <dann@gnu.org>, Jason Rumney <jasonr@gnu.org>,
	Emacs-Devel devel <emacs-devel@gnu.org>
Subject: Re: DEFU* macro name for a extern DEFUN: DEFUE? DEFUNEX?
Date: Mon, 11 Apr 2011 09:49:58 -0700	[thread overview]
Message-ID: <4DA33136.40206@cs.ucla.edu> (raw)
In-Reply-To: <BANLkTimJEdEt+Ebh7DBRLDmpDzKSn_CQSQ@mail.gmail.com>

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.



  reply	other threads:[~2011-04-11 16:49 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
2011-04-11  6:37   ` Paul Eggert
2011-04-11 10:39   ` Juanma Barranquero
2011-04-11 16:49     ` Paul Eggert [this message]
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=4DA33136.40206@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=dann@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=jasonr@gnu.org \
    --cc=lekktu@gmail.com \
    /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.