emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Is INLINE_HEADER_BEGIN still useful?


From: Oleh Krehel
Subject: Re: Is INLINE_HEADER_BEGIN still useful?
Date: Wed, 29 Apr 2015 16:12:13 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

Paul Eggert <address@hidden> writes:

> Oleh Krehel wrote:
>> This macro, encountered in most headers, seems to work around some
>> compilers not supporting C99.  A quick internet search shows that no
>> other software except Emacs uses this (any more, I assume some did in
>> the past).
>
> INLINE_HEADER_BEGIN is defined in src/conf_post.h.  The command "git
> blame src/conf_post.h" shows it was added in 2012, so it's not that
> old.  (For software archaeology questions like this, "git blame" Is
> Your Friend.)

Thanks for the tip.

>> Is it still useful?
>
> It's defined in terms of _GL_INLINE_HEADER_BEGIN.  The comment for the
> definition of _GL_INLINE_HEADER_BEGIN says it's a workaround for GCC
> bugs 54133 (fixed in December 2013 on the GCC trunk) and 63877 (fixed
> November 2014).  So I guess these macros are useful until we can
> assume that everybody is building Emacs with GCC 5.1.0 or later.
> (Though someone should test this guess.)

I don't see how 54133 can be related to anything with the "inline"
declaration.  And 63877 is just a bogus warning for a specific case, not
a big deal. I got no warnings when I tested my buffer.h patch.

> If my guess is right, then given the slow pace at which GCC gets out
> into the field, we'll need this macro for another decade or two.

I'm getting no problems so far with my default 4.8.2.  I can try to
patch the whole thing, not just buffer.h. Unless it's useless, because
4.8.2 is considered too new.

>> Is C11 encouraged / allowed / discouraged / disallowed?
>>
>> I assume that C99 is at least allowed since #17487. Is it encouraged?
>
> It depends on what C99 features you're talking about.  Emacs can use
> ordinary C99 features such as declaration after statements and
> variadic macros.  The Emacs source does not assume conformance to C99
> in every detail, as not every implementation supports every C99
> feature (even GCC doesn't do that).
>
> Although C11 features can be used on systems where they're known to
> work, Emacs needs to be portable to pre-C11 systems, as people still
> regularly build Emacs with GCC 3.x.  For example, the Emacs source
> uses the 'alignof' syntax of C11, but Emacs supplies its own
> implementation of 'alignof' on pre-C11 systems that lack it.
>
> There are also some style issues.  The Emacs comment style prefers
> commenting /* like this */, not // like this (introduced in C99).  The
> Emacs source code does not ever use trigraphs, even though C99 allows
> them.  That sort of thing.

Thanks for the comments, they're very helpful. Maybe someone on the list
could respond if they use a compiler that doesn't support the C99
"inline" declaration?

Oleh





reply via email to

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