Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Thu, 23 Aug 2012 17:25:19 -0700
From: Isaac Dunham <>
Subject: Re: compatability: bits/syscall.h requires C99

On Thu, 23 Aug 2012 08:34:53 -0400
Rich Felker <> wrote:

> On Thu, Aug 23, 2012 at 02:31:48PM +0200, John Spencer wrote:
> > On 08/23/2012 07:07 AM, wrote:
> > >Upstream insists on using --std=c89
> > insisting on c89 sounds really stupid.
> Agreed. This does not improve compatibility; it breaks compatibility,
> especially if they happen to #include any third-party library header
> which is not _documented_ as being c89 compatible. (Even if it happens
> to work with -std=c89 now, unless it's documented that it does and
> always will, this might change in a future version.)

1- Per grep, they don't use third-party headers.

2- I believe the point is prevent breaking C89 platforms, by making
non-C89 code FTBFS anywhere. Since they build-test every pull request
automatically, there's little chance of non-C89 code getting merged.

This will work unless a libc breaks C89 compatability in its headers,
and musl is the only libc yet that does this.
(If you're providing the only case where C89 is broken, it's rather
hard to argue that a musl-specific workaround is inappropriate...
time to get a flamesuit on)

> > (and your musl patch is very ugly, if not entirely pointless)
just following the advice I was given on IRC re: <bits/io.h> !
> I had some potential ideas for other ways to do this. Anyway the
> discussion is not entirely pointless since we need to address
> "restrict" at some point too, and the mechanisms for doing so will be
> similar (but worse, since "restrict" is not a keyword by default in
> most compilers without -std=c99, unlike "inline" which works unless
> you intentionally enable strict-mode)...

macros available in different modes 
(courtesy of gcc -E -dM - < /dev/null ):
std=c89, gnu89
__STDC_VERSION__ 199901L

So putting ~ this at the top of the header should work
(not verbatim, just the general concept!):
#if !(__STDC_VERSION__ >= 199901L) && __STRICT_ANSI__
#define inline __inline
#define restrict /* fallback for C89 compilers */

OTOH, s/inline/__inline/g is probably better/more universal, since
__inline is supported on some alternate compilers.

Here's a patch that will make the latter change to
arch/*/bits/syscall.h; I've left arch/*/*.h alone.

Isaac Dunham

View attachment "inline.diff" of type "text/x-patch" (10005 bytes)

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.