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_INVALID,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 27806 invoked from network); 19 Apr 2022 23:10:41 -0000 Received: from mother.openwall.net (195.42.179.200) by inbox.vuxu.org with ESMTPUTF8; 19 Apr 2022 23:10:41 -0000 Received: (qmail 24547 invoked by uid 550); 19 Apr 2022 23:10:37 -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 24515 invoked from network); 19 Apr 2022 23:10:37 -0000 Message-ID: <9eef4922-b71b-e0cf-1a11-d014a0f024af@ludocode.com> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ludocode.com; s=key1; t=1650409825; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=L17pYCzatkIA6Fft31JrMoiZPzzHom7/+0oHkFBs1S8=; b=xbL04j1VQI3qIzRViwOI620cfGTni0WBc7lr4ebuDYEZF16FtzaUMbmlvkoQKXRg5H3HvS 9/0Ea1J+Divg8xZKUp9LJq2U6waHRz45rj+oSPhfO+pOCx9UEEjBPyGw9eCgQW0BDYPdMn QrbOzO/ldazekPArlwZ8UtFX1Oh8emO7jSKJ610X1IdohNIkTiDRzD5S+E5yh7UNnB9t4W uFEvYedp9VXKyqpjO1xX3Anszv5a+kREhf6eJa6dJuB2x5IBgWW48ckDbftFj+m5JmcQEt D/txCjXGxdHb6+2wHvaAhPY9zg7p7UjkkTjjoRjax74GKXfYM1vaR9P+rTgbig== Date: Tue, 19 Apr 2022 19:10:23 -0400 MIME-Version: 1.0 Content-Language: en-US To: musl@lists.openwall.com References: <87a84620-df28-7e62-23e4-57e52bd068af@ludocode.com> <20220416120154.GA2553@voyager> <20220416161626.55aadace.quinq@fifth.space> <94a82803-acf0-4fb7-158b-b13cae530f6c@ludocode.com> <20220417020403.GZ7074@brightrain.aerifal.cx> <823acf0f-461d-d599-feb7-e0e21cfeb51d@ludocode.com> <20220419065954.GA1933@voyager> X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Nicholas Fraser In-Reply-To: <20220419065954.GA1933@voyager> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: ludocode.com Subject: Re: [musl] Detect qsort_r() support with preprocessor Thanks for the replies. I'm a bit surprised to hear you agree that, given my requirements, I should ignore your features and re-implement them myself. Beyond that it looks like we won't find common ground. I'll just take the opportunity to clarify a few things: On 2022-04-19 02:59, Markus Wichmann wrote: > Since Windows/MSVC is on the list of platforms you wish to > support, that means C89. And ONLY C89. Good luck with that. You may be interested to learn that Microsoft has had full C99 support (minus those features made optional in C11) since VS 2015. This is the oldest version of the VS tools still supported. More recently, VS 2019 supports nearly all of C11 (including a conforming preprocessor.) Even before that, it was easy to make well-written C99 compile as C++ to work under Microsoft's compiler. Compiling as C++ is a virtual necessity for a header-only library anyway. > I'm pretty sure it won't work on OS-9. That would be a restriction. I think this is the main source of our disagreement. You seem very concerned that my strategy won't work on platforms I've never heard of, and that if it's not perfect, it's useless. I do provide my users the option to manually override whatever I detect in case it's wrong. I'm just trying to detect as much as I can to make it easier for them. It's okay if it only works 90% of the time, and the remaining 10% requires manual configuration. I believe it will be more like >99% though, and I had hoped musl would want to be part of that >99%. > So you > would need __MUSL_VERSION__ or something.  But then Alpine went ahead > and backported it to earlier versions. So there are versions of musl > 1.2.2 out there with qsort_r() and those without it. So again, the macro > you are begging for would not tell you what you want to know. For the record I didn't ask for __MUSL_VERSION__. I asked for __HAS_QSORT_R. I asked this for exactly this reason, because I've been testing on Alpine and noticed they backported it. I only brought up __MUSL__ in comparison to what works for me on other platforms. We all agree that a standard macro like __HAS_QSORT_R would be a better solution but it will take a decade for this to get standardized. In any case, even if a version macro doesn't detect backported features, that's not a big deal. It's a temporary problem that will solve itself. This is another case of perfect being the enemy of good. > So what you would want is __MUSL_HAS_QSORT_R__, which for a growing list > of standard extensions is obviously untennable. This isn't obvious at all. I can't imagine what is so untenable about putting a simple #define next to each extension function you support. From my perspective, I think what is obvious is that you want to hide the fact that the implementation is musl, and you are opposed to macros like this simply because they could be used to reveal that you're musl. On 2022-04-19 09:32, Rich Felker wrote: > You cannot #define _GNU_SOURCE or __STDC_WANT_LIB_EXT1__ after any > standard header has already been included. Yes, I know that of course (give me a little credit here.) Maybe I was unclear. I'm not defining _GNU_SOURCE or whatever. I'm declaring the actual libc function I want to link against within the scope of my wrapper function that calls it. That's what the snippet of code I showed does. Ultimately I'm targeting the ABI, not the headers, which is why I make it work regardless of _GNU_SOURCE and such. Nick