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 22:07:49 -0400
From: Rich Felker <dalias@...ifal.cx>
To: musl@...ts.openwall.com
Subject: Re: compatability: bits/syscall.h requires C99

On Thu, Aug 23, 2012 at 05:25:19PM -0700, Isaac Dunham wrote:
> On Thu, 23 Aug 2012 08:34:53 -0400
> Rich Felker <dalias@...ifal.cx> wrote:
> 
> > On Thu, Aug 23, 2012 at 02:31:48PM +0200, John Spencer wrote:
> > > On 08/23/2012 07:07 AM, idunham@...abit.com 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.

I still think this is really bad policy, akin to the bad policy in GNU
binutils of putting -Werror in their CFLAGS. You never know when
strict/pedantic/Werror/etc. type options will raise an issue on end
user systems that causes the build to break. Strict options should
only be turned on in their test environment, not in the default
configuration shipped to users.

> macros available in different modes 
> (courtesy of gcc -E -dM - < /dev/null ):

Thanks!

> 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 */
> #endif

This won't work for restrict. Unlike inline, restrict is not
recognized even in non-strict mode unless __STDC_VERSION__ is >=C99.

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

No, that reduces musl's public interface from portable C99 to
compiler-specific crap.

Rich

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.