mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Gregor Richards <gr@purdue.edu>
To: musl@lists.openwall.com
Subject: Re: Best bikeshed ever (feature test macros)
Date: Sun, 02 Sep 2012 13:18:54 -0400	[thread overview]
Message-ID: <504394FE.5020504@purdue.edu> (raw)
In-Reply-To: <20120902171312.GF27715@brightrain.aerifal.cx>

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




  reply	other threads:[~2012-09-02 17:18 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-24 21:41 Rich Felker
2012-08-24 22:24 ` Gregor Richards
2012-08-24 23:59 ` Szabolcs Nagy
2012-08-25  7:35 ` orc
2012-08-25 12:32   ` Rich Felker
2012-08-25 15:29     ` orc
2012-08-25  9:11 ` Luca Barbato
2012-08-27 18:08 ` Isaac Dunham
2012-08-29  5:34 ` philomath
2012-08-29 13:49   ` Rich Felker
2012-08-29 14:01     ` Gregor Richards
2012-08-29 14:43       ` Rich Felker
2012-08-29 15:08         ` Bobby Bingham
2012-08-29 15:23           ` Rich Felker
2012-08-29 17:17             ` Gregor Richards
2012-08-29 17:59       ` Isaac Dunham
2012-08-29 18:08         ` Rich Felker
2012-09-02  8:48 ` Arvid E. Picciani
2012-09-02 15:19   ` Rich Felker
2012-09-02 15:27     ` Arvid E. Picciani
2012-09-02 15:44       ` Rich Felker
2012-09-02 17:00 ` nwmcsween
2012-09-02 17:06   ` Gregor Richards
2012-09-02 17:13     ` Rich Felker
2012-09-02 17:18       ` Gregor Richards [this message]
2012-09-02 17:10   ` Rich Felker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=504394FE.5020504@purdue.edu \
    --to=gr@purdue.edu \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).