From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/1821 Path: news.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: [PATCH/RFC] inline cleanup/C89 support Date: Tue, 4 Sep 2012 13:44:23 -0400 Message-ID: <20120904174423.GN27715@brightrain.aerifal.cx> References: <20120902165126.GC27715@brightrain.aerifal.cx> <20120904174912.5985657a@gmail.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 1346780530 21479 80.91.229.3 (4 Sep 2012 17:42:10 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 4 Sep 2012 17:42:10 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-1822-gllmg-musl=m.gmane.org@lists.openwall.com Tue Sep 04 19:42:12 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 1T8x8a-0005I1-Dp for gllmg-musl@plane.gmane.org; Tue, 04 Sep 2012 19:42:08 +0200 Original-Received: (qmail 16064 invoked by uid 550); 4 Sep 2012 17:42:05 -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 16053 invoked from network); 4 Sep 2012 17:42:05 -0000 Content-Disposition: inline In-Reply-To: <20120904174912.5985657a@gmail.com> User-Agent: Mutt/1.5.21 (2010-09-15) Xref: news.gmane.org gmane.linux.lib.musl.general:1821 Archived-At: On Tue, Sep 04, 2012 at 05:49:12PM +0200, philomath wrote: > On Sun, 2 Sep 2012 12:51:26 -0400 > Rich Felker wrote: > > > On Thu, Aug 30, 2012 at 03:45:34PM -0700, Isaac Dunham wrote: > > > On Fri, 24 Aug 2012 09:53:16 +0200 > > > Szabolcs Nagy wrote: > > > > > > > * Rich Felker [2012-08-23 22:34:25 -0400]: > > > ... > > > > > #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. > > > (As previously stated, it appears-per a grep of glibc-that restrict is > > > not needed in these headers.) > > > This patch is updated for C++: > > > > > > #if __STDC_VERSION__ >= 199901L || defined(__cplusplus) > > > #define __inline inline > > > #endif > > > [...] > > > > Committed, with minor changes. > > > > Rich > > > Sorry for asking after the fact, but why the whole code-duplication? why not > have an internal header (like glibc's cdefs.h) for these kind of things (inline, > restrict, noreturn, etc) and include it where needed? It's really a matter of weighing the costs against the benefits. The duplication is minimal and it's not code that should require maintenance; even if it did, maintenance would be simple pattern replacement. On the other hand, the cost is pretty high. For compiling small C files, the whole compile job is dominated O(# calls to open) and adding an extra junk header just to do this trivial definition of __inline would increase compile times measurably. Rich