From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/1708 Path: news.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: compatability: bits/syscall.h requires C99 Date: Thu, 23 Aug 2012 22:34:25 -0400 Message-ID: <20120824023425.GV27715@brightrain.aerifal.cx> References: <12609.132.241.65.179.1345698455.squirrel@lavabit.com> <503622B4.8020506@barfooze.de> <20120823123453.GO27715@brightrain.aerifal.cx> <20120823172519.39f899b6@newbook> <20120824020749.GU27715@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1345775575 7217 80.91.229.3 (24 Aug 2012 02:32:55 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 24 Aug 2012 02:32:55 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-1709-gllmg-musl=m.gmane.org@lists.openwall.com Fri Aug 24 04:32:56 2012 Return-path: Envelope-to: gllmg-musl@plane.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1T4jhb-0000Bw-Mv for gllmg-musl@plane.gmane.org; Fri, 24 Aug 2012 04:32:51 +0200 Original-Received: (qmail 32293 invoked by uid 550); 24 Aug 2012 02:32:49 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 32285 invoked from network); 24 Aug 2012 02:32:49 -0000 Content-Disposition: inline In-Reply-To: <20120824020749.GU27715@brightrain.aerifal.cx> User-Agent: Mutt/1.5.21 (2010-09-15) Xref: news.gmane.org gmane.linux.lib.musl.general:1708 Archived-At: On Thu, Aug 23, 2012 at 10:07:49PM -0400, Rich Felker wrote: > > 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. OK, after discussion on IRC, the 2 options under consideration are: #if __STDC_VERSION__ < 199901L && defined(__GNUC__) #define inline __inline #define restrict __restrict #elif __STDC_VERSION__ < 199901L #define inline #define restrict #endif and #if __STDC_VERSION__ >= 199901L #define __inline inline #define __restrict restrict #endif added near the top of headers that need to use inline and/or restrict. The former version has the benefit that the "inline" and "restrict" keywords can be used as-is later in the header, without any __ uglification. The latter version has the benefit that it's fewer lines of spam, does not explicitly refer to "GNU C", and that it does not break the gratuitously-C99-incompatible C89 programs like int main(int inline, char **restrict) { } I'm not sure if this last issue really matters; certainly there are plenty unfixable ways C89 programs can fail on a C99 implementation, like: assert(strtod("0x1",0)==0); I'm kind of leaning towards the latter but I'd like to hear some opinions before a final change is made. Whichever way we decide, I think it'll make it possible to go and retrofit "restrict" everwhere it belongs in the headers, which will in turn lead to better code in some parts of musl. Rich