[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: Paul Eggert
Subject: Re: DEFU* macro name for a extern DEFUN: DEFUE? DEFUNEX?
Date: Mon, 11 Apr 2011 09:49:58 -0700
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv: Gecko/20110307 Fedora/3.1.9-0.39.b3pre.fc14 Thunderbird/3.1.9

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 via email to

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