From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 15985 invoked from network); 7 Jul 2023 11:45:54 -0000 Received: from second.openwall.net (193.110.157.125) by inbox.vuxu.org with ESMTPUTF8; 7 Jul 2023 11:45:54 -0000 Received: (qmail 18211 invoked by uid 550); 7 Jul 2023 11:45:52 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com Received: (qmail 18179 invoked from network); 7 Jul 2023 11:45:51 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1688730339; x=1691322339; h=content-transfer-encoding:to:subject:message-id:date:from:reply-to :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=emIgNOUI4kyJWFTGXDqszxandG23xbGxhuKEwCJHFeo=; b=Q483vDwKLDx8++W7jWIF2qOk7iaWALlVgVgoIP2k+C25nFwAGD1widnoDf1R3S1ije mZEbvP0sfdvlunuME4DbLCUxa1ufCAblHxIQ0vIq5W88KalOimhcPOmFprH0pKPxFpYM qjK+8HDzTULBaW/snPUbBtC25PraQBhLuiYt984LiB5qf0VIX6nBX55X639KqTlAon/N enGUIaiTPLhYPVuKq8s0m1f1caoOk72FcuCYqD1F4/A7i45P1JsVVmIlhxzOuEACSocV DrZJD2snmfxcmEo96ZVwWPly9lGZigpr5HizKe1MohixopLYuuk/2n/sW1OeOspy9Hva n7WA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688730339; x=1691322339; h=content-transfer-encoding:to:subject:message-id:date:from:reply-to :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=emIgNOUI4kyJWFTGXDqszxandG23xbGxhuKEwCJHFeo=; b=BjWxFEbnkC6hfczpht5ycmZzL2b6oVd2iZf8e0Mgr5rD2Zfsq+La9Jz4LgIPKIdrDb kWV/j4xFDxHK1HWdoXnZx1HR/zv1HrsWv6Lvv+zmeOxKdSYkAF3y0miE9E38Ct6HArcO wLA5mY5rpYJQit1W4qmivmUKCh5CEnzK3hX23cofLx7ylzHskGntHq+dDyKn3iFxm3fh 01LSWTo6XyUeWUOZpC73W8n9sZL61cJPo8AUnd/K+vO1DLHl6Oqc5/40qvM3Aibbhfxv 3tQMPZ3cn72LYHiBGMWtBfWNp6KEJr3yZfPp5PhKrdWAaoxEtXVYAKwefvF+lliiqdgn Ry1Q== X-Gm-Message-State: ABy/qLbdubqVaLC662SU8AlfeoWql1a7Jr2tOn+XE4TI1b2NMjhaOGJS Gn+kuhLKuFFSQoygQ+VzVhW2JDWSNA1M9I1XlObv+Vsf X-Google-Smtp-Source: APBJJlGN4DKd5dpbBUA5hkf3cGwhw575WMxQzNQww9T5FSbO0+jni3PrXp5zHi8JFS+JW5wh9cXTOLnR8My9UZrcZC4= X-Received: by 2002:a05:6870:428a:b0:1b0:67a9:3092 with SMTP id y10-20020a056870428a00b001b067a93092mr6196674oah.42.1688730339144; Fri, 07 Jul 2023 04:45:39 -0700 (PDT) MIME-Version: 1.0 References: <309EDCC9-2402-46B5-BDBD-B96677E470DD@apple.com> <168864586814.64499.13397704850676744237@alexps.local> In-Reply-To: From: Jeffrey Walton Date: Fri, 7 Jul 2023 07:45:28 -0400 Message-ID: To: musl@lists.openwall.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Subject: Re: [musl] __MUSL__ macro On Fri, Jul 7, 2023 at 3:14=E2=80=AFAM Alastair Houghton wrote: > > On 6 Jul 2023, at 13:17, Alex Xu wrote: > > [...] > > Configure-time checks for specific functionality are a standard part of > > writing portable C code. Preprocessor checks for specific platforms lea= d > > 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=E2=80=99t a sane workaround. > > 1. You=E2=80=99re cross compiling and the thing you=E2=80=99re interested= in is *runtime* behaviour, so configure-style checks simply aren=E2=80=99t= an option. In a cross-compilation situation the only thing they can test = is that a program will *build*; they can=E2=80=99t test its behaviour since= you don=E2=80=99t necessarily have anywhere to run it. > > 2. You=E2=80=99re in a header-only library, particularly one where the fi= nal environment you=E2=80=99re running in wasn=E2=80=99t available at whate= ver 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 a= lso 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 tim= e. (In fact, we do not wish Autotools on our worst enemies.) Jeff