unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: Oleh Krehel <ohwoeowho@gmail.com>, emacs-devel@gnu.org
Subject: Re: Is INLINE_HEADER_BEGIN still useful?
Date: Wed, 29 Apr 2015 07:00:02 -0700	[thread overview]
Message-ID: <5540E3E2.4030701@cs.ucla.edu> (raw)
In-Reply-To: <87h9rzb2nc.fsf@gmail.com>

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	other threads:[~2015-04-29 14:00 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 [this message]
2015-04-29 14:12   ` Oleh Krehel
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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5540E3E2.4030701@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=emacs-devel@gnu.org \
    --cc=ohwoeowho@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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).