mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Rich Felker <dalias@libc.org>
To: Nicholas Fraser <nick@ludocode.com>
Cc: musl@lists.openwall.com
Subject: Re: [musl] Detect qsort_r() support with preprocessor
Date: Sat, 16 Apr 2022 22:04:03 -0400	[thread overview]
Message-ID: <20220417020403.GZ7074@brightrain.aerifal.cx> (raw)
In-Reply-To: <94a82803-acf0-4fb7-158b-b13cae530f6c@ludocode.com>

On Sat, Apr 16, 2022 at 01:50:06PM -0400, Nicholas Fraser wrote:
> On 2022-04-16 08:01, Markus Wichmann wrote:
> 
> > Unless qsort_r() were part of a new release of POSIX (then you could
> > look at _POSIX_VERSION), or a member of an option group (then you could
> > look at the option group macro), not really. If musl had a bespoke
> > symbol, it would just diverge. Then musl would have its macro, glibc
> > another one, OpenBSD would do a totally different thing again, and in
> > the end you get a leaning tower of hostname (look it up).
> 
> All of those other platforms define symbols like __GLIBC__ and __OpenBSD__.

Those do not tell you what you want to know: whether a particular
interface is supported. They tell you a particular implementation name
and version, which then requires you to have massive amounts of
hard-coded knowledge about every platform you support, and to fail to
support any platform you don't know about. This practice belongs back
in the 1980s, not the 2020s.

> It's pointless to use a configure script to detect qsort_r() on any other
> platform because we can detect it just fine with the preprocessor by using
> these symbols.

No, it's not. If there were a standard or widely agreed upon macro
that indicated "qsort_r is present and has the signature and semantics
you expect it to have", that would make it possible to detect. But no
such macro exists. I've tried to push forward an effort for defining
an analog of the unistd.h macros POSIX defines, but for
non-standardized but moderately to widely cross-platform extensions,
but nothing has come of that so far. The existing proposal discussion
is in the libc-coord list.

Until that happens, *detecting* in a configure-style manner is the
only way to do this. musl absolutely will not support the practice of
hard-coding assumptions about the implementation.

> [long rant of wrong stuff I did not read]

...

Rich

  parent reply	other threads:[~2022-04-17  2:04 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-16  8:13 Nicholas Fraser
2022-04-16 12:01 ` Markus Wichmann
2022-04-16 14:16   ` Quentin Rameau
2022-04-16 17:50     ` Nicholas Fraser
2022-04-16 18:42       ` Quentin Rameau
2022-04-16 23:59         ` Nicholas Fraser
2022-04-17  2:04       ` Rich Felker [this message]
2022-04-19  3:38         ` Nicholas Fraser
2022-04-19  6:59           ` Markus Wichmann
2022-04-19 23:10             ` Nicholas Fraser
2022-04-19 13:32           ` 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=20220417020403.GZ7074@brightrain.aerifal.cx \
    --to=dalias@libc.org \
    --cc=musl@lists.openwall.com \
    --cc=nick@ludocode.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).