mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Rich Felker <dalias@libc.org>
To: musl@lists.openwall.com
Subject: Re: the case for __MUSL__
Date: Mon, 29 Dec 2014 16:55:49 -0500	[thread overview]
Message-ID: <20141229215549.GO4574@brightrain.aerifal.cx> (raw)
In-Reply-To: <CAMAJcuB24w8pUKK66YiZUXQNeXxLTXajMvgcGgEYGz2UW1ihZg@mail.gmail.com>

On Mon, Dec 29, 2014 at 11:59:39AM -0600, Josiah Worcester wrote:
> On Dec 29, 2014 11:51 AM, "Richard Gorton" <
> rcgorton@cognitive-electronics.com> wrote:
> >
> >
> > That is a single example of some of the code in a library which is NOT
> musl.
> > There are other places in the example library which know about __APPLE__
> or __GLIBC__ or __sun__
> >
> > My thought is to use __MUSL__ in those libraries as appropriate in place
> of __<architecture>__ as the backing libc is musl.
> >
> > And said use of __MUSL__ is what I am interested in feedback about.
> >
> 
> The intent of not providing it is to force applications to use a portable
> interface rather then being libc specific. So, everyone's leaping to try
> and find ways to not need that.
> Sorry for the mismatched expectations.

Exactly. The intent is that musl should be supported by the #else case
with the portable code in it, or (even better) that all cases but the
#else should be removed as unnecessary so that the same code is used
everywhere.

In cases where musl is providing some non-standard interface from
glibc or BSD that you actually want to use, the right way to use it is
to test for its availability at compiletime with either some sort of
configure process (autoconf or similar) or via feature-specific macros
(like the ones POSIX defines for optional POSIX functionality in
unistd.h, although nothing like that exists yet for non-standard
extensions). Using a macro like __MUSL__ or __GLIBC__ to enable use of
such interfaces is not reasonable since it requires hard-coding
assumptions about which extensions are available in particular
versions rather than actually checking for the availability of the
interface you want.

Rich


      parent reply	other threads:[~2014-12-29 21:55 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-29 16:27 Richard Gorton
2014-12-29 17:15 ` Josiah Worcester
2014-12-29 17:17   ` Josiah Worcester
2014-12-29 17:37     ` Rich Felker
2014-12-29 17:51       ` Richard Gorton
2014-12-29 17:59         ` Josiah Worcester
2014-12-29 21:29           ` Justin Cormack
2014-12-29 21:55           ` Rich Felker [this message]

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=20141229215549.GO4574@brightrain.aerifal.cx \
    --to=dalias@libc.org \
    --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).