From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/4809 Path: news.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: build with clang-3.4 warnings report Date: Sat, 5 Apr 2014 12:35:12 -0400 Message-ID: <20140405163512.GW26358@brightrain.aerifal.cx> References: <533F0F1A.6040707@embtoolkit.org> <20140404204701.GO26358@brightrain.aerifal.cx> <533F56FB.8060509@embtoolkit.org> <20140405015443.GU26358@brightrain.aerifal.cx> <1396688698.11744.258.camel@eris.loria.fr> <20140405130700.GV26358@brightrain.aerifal.cx> <1396708669.11744.314.camel@eris.loria.fr> 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 1396715731 6277 80.91.229.3 (5 Apr 2014 16:35:31 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 5 Apr 2014 16:35:31 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-4813-gllmg-musl=m.gmane.org@lists.openwall.com Sat Apr 05 18:35:26 2014 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 1WWTYz-0006mM-Tg for gllmg-musl@plane.gmane.org; Sat, 05 Apr 2014 18:35:26 +0200 Original-Received: (qmail 3959 invoked by uid 550); 5 Apr 2014 16:35:24 -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 3946 invoked from network); 5 Apr 2014 16:35:24 -0000 Content-Disposition: inline In-Reply-To: <1396708669.11744.314.camel@eris.loria.fr> User-Agent: Mutt/1.5.21 (2010-09-15) Xref: news.gmane.org gmane.linux.lib.musl.general:4809 Archived-At: On Sat, Apr 05, 2014 at 04:37:49PM +0200, Jens Gustedt wrote: > Am Samstag, den 05.04.2014, 09:07 -0400 schrieb Rich Felker: > > On Sat, Apr 05, 2014 at 11:04:58AM +0200, Jens Gustedt wrote: > > > The whole thing could be avoided by using designated initializers and > > > eliminating the whole errid array right away. Designated initializers > > > should be present in all decent versions of gcc. Do you want me to > > > prepare a patch? > > > > No, this is not about avoiding features but rather not adding a whole > > page (or two pages, on 64-bit machines) of non-sharable pseudo-data to > > libc.so, or the same amount of text to nearly every static-linked > > program. > > I experimented a bit, and I get > > - +20 bytes more for the simplest version, replacing the positon > array by an array with sizes of the strings and a good reduction in > complexity of the function > > - +40 to +60 bytes extra code size for some trivial error and bounds > checking (which only can do good, here) The current code already has full bounds/error checking. Any value except a valid error code will result in "No error information". > - +100 bytes when replacing the "unsigned char" array with the sizes > by an "unsigned short" array that holds all the offsets of the > strings and reduces the function itself mainly to a table lookup. > > (all that on x86_64 and only compile tested for them moment) I'd be interested in seeing what you mean by some of these, but note that these are all +'s and don't seem to have any concrete advantages over the current code. > So this is largely below the one page threshold (increasing code size > from 3200 byte to 3360 at the worst), and the generated assembler > looks quite clean. I was talking about the approach with designated initializers, which I assumed would look something like: { [EBADF] = "Bad file descriptor", [EILSEQ] = "Illegal sequence", ... } Rich