From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/1812 Path: news.gmane.org!not-for-mail From: Gregor Richards Newsgroups: gmane.linux.lib.musl.general Subject: Re: Best bikeshed ever (feature test macros) Date: Sun, 02 Sep 2012 13:18:54 -0400 Message-ID: <504394FE.5020504@purdue.edu> References: <20120824214138.GA17792@brightrain.aerifal.cx> <50439211.6050504@purdue.edu> <20120902171312.GF27715@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1346606350 8280 80.91.229.3 (2 Sep 2012 17:19:10 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 2 Sep 2012 17:19:10 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-1813-gllmg-musl=m.gmane.org@lists.openwall.com Sun Sep 02 19:19: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 1T8DpH-0005jv-2h for gllmg-musl@plane.gmane.org; Sun, 02 Sep 2012 19:19:11 +0200 Original-Received: (qmail 21655 invoked by uid 550); 2 Sep 2012 17:19:08 -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 21644 invoked from network); 2 Sep 2012 17:19:08 -0000 User-Agent: Mozilla/5.0 (X11; Linux i686 on x86_64; rv:15.0) Gecko/20120824 Thunderbird/15.0 In-Reply-To: <20120902171312.GF27715@brightrain.aerifal.cx> X-PMX-Version: 5.5.9.388399 X-PerlMx-Virus-Scanned: Yes Xref: news.gmane.org gmane.linux.lib.musl.general:1812 Archived-At: On 09/02/2012 01:13 PM, Rich Felker wrote: > On Sun, Sep 02, 2012 at 01:06:25PM -0400, Gregor Richards wrote: >>> Leave it as is, this actually helps find bugs in software. A real >>> world example is accidentally utilizing gnu extensions in mruby >>> (see github mruby bug page for more info). >> The same can be accomplished on any modern libc by using -std=c89 or >> -std=c99. You shouldn't have to port to a new libc to find these > I'm a bit confused because I suspect the code in question actually > wanted POSIX, not just baseline C... > >> problems, nor should said new libc be designed in such a way that >> the majority of software doesn't work on it without additional >> complication. Especially when, as I will repeat over and over again, >> going through the additional complication to supposedly make your >> code more portable WILL INVARIABLY MAKE YOUR CODE LESS PORTABLE. > This only applies if you're using extensions. And actually, I'm not > sure it's the case. If you add -D_GNU_SOURCE (and no other feature > test macros), does that really _hide_ any interfaces on BSD, Darwin, > Solaris, or other relevant systems? > > Rich Yes, it only applies if you're using extensions. If you're not, you really, REALLY should have _POSIX_C_SOURCE or _XOPEN_SOURCE set. My point is about portably using extensions (this is not an oxymoron). Last I checked, -D_GNU_SOURCE exposes broken functions on certain BSDs. I remember having to make a very careful set of feature test macros to get one extension if available, but NOT make the BSDs give me a broken function otherwise. That was a while ago and I don't remember what function it was, I'm afraid. Ironically, the function wasn't even broken in glibc. More to the point, since they do recognize _GNU_SOURCE, it leads them through their entire feature macro song and dance; I'm not sure if it actually hides anything, but it wouldn't surprise me if it does. More importantly, that's just philosophically walking in circles. You'd use _GNU_SOURCE because it's what musl needs, but if somebody wrote their new fancy libc under the same principle and decided they didn't like _GNU_SOURCE, you'd need _BSD_SOURCE there, and that drags you through a different hell elsewhere. You're playing a game of who's-who with nonstandard macros. With valediction, - Gregor Richards