From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/1687 Path: news.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: [PATCH] Problem is static inline Date: Thu, 23 Aug 2012 08:18:24 -0400 Message-ID: <20120823121824.GK27715@brightrain.aerifal.cx> References: <12609.132.241.65.179.1345698455.squirrel@lavabit.com> <59250.132.241.65.179.1345702298.squirrel@lavabit.com> 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 1345724214 19210 80.91.229.3 (23 Aug 2012 12:16:54 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 23 Aug 2012 12:16:54 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-1688-gllmg-musl=m.gmane.org@lists.openwall.com Thu Aug 23 14:16:55 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 1T4WLG-0005Yf-T5 for gllmg-musl@plane.gmane.org; Thu, 23 Aug 2012 14:16:55 +0200 Original-Received: (qmail 9548 invoked by uid 550); 23 Aug 2012 12:16:52 -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 9540 invoked from network); 23 Aug 2012 12:16:52 -0000 Content-Disposition: inline In-Reply-To: <59250.132.241.65.179.1345702298.squirrel@lavabit.com> User-Agent: Mutt/1.5.21 (2010-09-15) Xref: news.gmane.org gmane.linux.lib.musl.general:1687 Archived-At: On Wed, Aug 22, 2012 at 11:11:38PM -0700, idunham@lavabit.com wrote: > > I've been trying to get musl compatability patches for libuv merged > > upstream, and I have it building, but there's one sticking point: > > Upstream insists on using --std=c89 (I guess for portability to other > > platforms). > > This makes GCC choke on "long" in . > I tried fixing it, and ended up finding that the issue was the "static > inline" in the header. > > For future reference: > sed -e 's/static inline/#if __STDC_VERSION__ >= > 199901L\ninline\n#endif\nstatic/g' -i > is what I used. I really dislike this type of fix because it potentially generates much worse code on compilers where c89 is the default but not strictly enforced (e.g. gnu89 is the default). (While inline is usually ignored for inlining purposes, lots of gcc versions seem to avoid eliminating dead static functions from the .o file unless they're also marked inline.) Is there an easy way to detect gcc's obnoxious strict c89 mode? By the way, I also wonder if it wouldn't be easier to do: #if [strict c89 mode] #define inline #endif or #if [strict c89 mode] #define inline __inline #endif in headers that will use it, rather than repeating the #if over and over for each use. We're going to need something like this for adding restrict at a later time, anyway... Perhaps (but I also find this really ugly...) it would be better to do it the other way around: use __inline in the headers, and do #if __STDC_VERSION__ >= 199901L #define __inline inline #endif This would support any C99 compiler that does not need __inline for its own purposes separate from inline, as well as any compiler in legacy mode that has __inline as an extension. Rich