From: Oleh Krehel <ohwoeowho@gmail.com>
To: Paul Eggert <eggert@cs.ucla.edu>
Cc: emacs-devel@gnu.org
Subject: Re: Is INLINE_HEADER_BEGIN still useful?
Date: Wed, 29 Apr 2015 16:12:13 +0200 [thread overview]
Message-ID: <87r3r3nhvm.fsf@gmail.com> (raw)
In-Reply-To: <5540E3E2.4030701@cs.ucla.edu> (Paul Eggert's message of "Wed, 29 Apr 2015 07:00:02 -0700")
Paul Eggert <eggert@cs.ucla.edu> 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
next prev parent reply other threads:[~2015-04-29 14:12 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-29 11:21 Is INLINE_HEADER_BEGIN still useful? Oleh Krehel
2015-04-29 14:00 ` Paul Eggert
2015-04-29 14:12 ` Oleh Krehel [this message]
2015-04-29 15:07 ` Paul Eggert
2015-04-29 15:33 ` Oleh Krehel
2015-04-29 17:54 ` Paul Eggert
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=87r3r3nhvm.fsf@gmail.com \
--to=ohwoeowho@gmail.com \
--cc=eggert@cs.ucla.edu \
--cc=emacs-devel@gnu.org \
/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.