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: Paul Eggert
Subject: Re: Is INLINE_HEADER_BEGIN still useful?
Date: Wed, 29 Apr 2015 07:00:02 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0

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.)

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.)

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.

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.




reply via email to

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