mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Jeffrey Walton <noloader@gmail.com>
To: musl@lists.openwall.com
Subject: Re: [musl] __MUSL__ macro
Date: Fri, 7 Jul 2023 07:45:28 -0400	[thread overview]
Message-ID: <CAH8yC8nf-2kABc+RmWQukx2f+LmQ7_mRsYuhx4tH_ZCUU2sy8A@mail.gmail.com> (raw)
In-Reply-To: <ADA97FB8-5654-4DBB-AE27-0055885439F3@apple.com>

On Fri, Jul 7, 2023 at 3:14 AM Alastair Houghton <ahoughton@apple.com> wrote:
>
> On 6 Jul 2023, at 13:17, Alex Xu <alex_y_xu@yahoo.ca> wrote:
> > [...]
> > Configure-time checks for specific functionality are a standard part of
> > writing portable C code. Preprocessor checks for specific platforms lead
> > to ifdef swamps that are still not portable to any platforms not
> > initially considered.
>
> There are two situations where the lack of macros is absolutely a problem and there isn’t a sane workaround.
>
> 1. You’re cross compiling and the thing you’re interested in is *runtime* behaviour, so configure-style checks simply aren’t an option.  In a cross-compilation situation the only thing they can test is that a program will *build*; they can’t test its behaviour since you don’t necessarily have anywhere to run it.
>
> 2. You’re in a header-only library, particularly one where the final environment you’re running in wasn’t available at whatever configuration time you had, assuming you had one at all.  A really good example of this is the built-in headers in Clang or GCC, but the problem also applies to things like STL or Boost.

A third problem is, Musl assumes a project is using Autotools or
similar. That's not always the case.

We use preprocessor signalling to enable or disable code paths at build time.

(In fact, we do not wish Autotools on our worst enemies.)

Jeff

  parent reply	other threads:[~2023-07-07 11:45 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-06 10:48 Alastair Houghton
2023-07-06 12:17 ` Alex Xu
2023-07-06 16:26   ` Szabolcs Nagy
2023-07-07  7:14   ` Alastair Houghton
2023-07-07  7:30     ` A. Wilcox
2023-07-07  8:24       ` Alastair Houghton
2023-07-07 11:20     ` Laurent Bercot
2023-07-07 11:45     ` Jeffrey Walton [this message]
2023-07-07 13:53     ` Rich Felker
2023-07-07 14:18       ` Alastair Houghton
2023-07-07 12:47 ` Rich Felker
2023-07-07 13:14   ` Alastair Houghton
2023-07-07 14:19     ` Markus Wichmann
2023-07-07 14:26       ` Markus Wichmann
2023-07-07 14:46       ` Alastair Houghton
2023-07-07 15:02       ` Andrew Bell
2023-07-07 15:19         ` Markus Wichmann
2023-07-07 15:24           ` Andrew Bell
2023-07-07 15:34           ` Alastair Houghton
2023-07-07 15:45             ` Rich Felker
2023-07-07 15:58               ` Alastair Houghton
2023-07-07 15:05     ` i262jq

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=CAH8yC8nf-2kABc+RmWQukx2f+LmQ7_mRsYuhx4tH_ZCUU2sy8A@mail.gmail.com \
    --to=noloader@gmail.com \
    --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).