X-Recipient: archive-cygwin AT delorie DOT com DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 19EFD385803E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; s=default; t=1705949383; bh=mvAXXJ4bKNE20H2dhNXDM6ENj0UeOxUuoTexPJwdalo=; h=Subject:To:References:Date:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=D/ByzC3vR/3a64hDB/fubfaui8198LANKJm1twSeDcPawB6WV/vVgA9a/D33FDMBY BqR8jgwt2OCyfdYXr1//YIbrh+M1NB/eyJ6U03ml2+8sBUIxsWQudo361a4pkkaxjV j/vd58wt3u6lEzDUhv9nSlpKxu7uCH4N/hXQkCtU= X-Original-To: cygwin AT cygwin DOT com Delivered-To: cygwin AT cygwin DOT com DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3B54C3858284 ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 3B54C3858284 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705949308; cv=none; b=TMoUEcT/F4vLooQpOis9y1pXS54ARixcPx0VJ3/xmpc+sE/rbInxqni2H/MnssPycimR94FLzbCXBh/jwYP5uqvT2ISYpWPHO1RDHNLUCv4QLthuFBeuPIpWP9R3N3Bb8JNDxr1MdfxXyFkA6OQIi+Rwa6pesvVnVn3cvSLf1KU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705949308; c=relaxed/simple; bh=u3xEeyqTegjGQZuqQ4PdVmWf8MM785yK0tvFybsbaJU=; h=Subject:To:From:Message-ID:Date:MIME-Version; b=DZFjvcn3EZhA01+S8wCFKfarYniBKj5OwJxl6v/fTXERwW7NFx1RTnwkRVnOWFav3YXB2y2M+M5WIOkiTwMot9lrXjgNU9GR1xt52ga0V1AQHWIpinJMwgKc1EK/lNSPAfOwViiz0WVr6mE8J+HR+65vtawAN0tAQGJ9cX9Q7jk= ARC-Authentication-Results: i=1; server2.sourceware.org Subject: Re: Add ability to hide non-standard itoa/utoa() in stdlib.h ? To: cygwin AT cygwin DOT com References: Message-ID: <812d5c41-3ece-c49a-bcfd-52b39192b21c@t-online.de> Date: Mon, 22 Jan 2024 19:48:23 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 SeaMonkey/2.53.16 MIME-Version: 1.0 In-Reply-To: X-TOI-EXPURGATEID: 150726::1705949302-B880499C-7F0767A0/0/0 CLEAN NORMAL X-TOI-MSGID: 0fca6a09-571a-473f-bd40-64fcab9443a9 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00, BODY_8BITS, FREEMAIL_FROM, KAM_DMARC_STATUS, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: cygwin AT cygwin DOT com X-Mailman-Version: 2.1.30 Precedence: list List-Id: General Cygwin discussions and problem reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Christian Franke via Cygwin Reply-To: Christian Franke Content-Type: text/plain; charset="utf-8"; Format="flowed" Errors-To: cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com Sender: "Cygwin" Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by delorie.com id 40MIniLM005063 Corinna Vinschen via Cygwin wrote: > On Jan 22 16:47, Christian Franke via Cygwin wrote: >> Busybox does not build OOTB on Cygwin due to the addition of itoa/utoa() to >> newlib in 2014: >> https://cygwin.com/git/?p=newlib-cygwin.git;a=commit;h=32c96dd >> >> This is because Busybox use local functions with same name but different >> signature. This does not affect build on FreeBSD, Linux (glibc, musl libc), >> ... because these functions simply do not exits there. For the busybox >> Cygwin package, I use an ugly local hack to fix this. >> >> itoa() is mentioned as a non-standard extension here: >> https://en.wikibooks.org/wiki/C_Programming/stdlib.h/itoa >> https://cplusplus.com/reference/cstdlib/itoa/ >> >> MSVC provides itoa() as a "POSIX version" of _itoa(): >> https://learn.microsoft.com/cpp/c-runtime-library/reference/itoa-itow >> >> But SUS-1997... POSIX-2018 do not mention these functions: >> https://pubs.opengroup.org/onlinepubs/7908799/ >> https://pubs.opengroup.org/onlinepubs/9699919799/ >> >> Newlib guards the prototypes with __MISC_VISIBLE in stdlib.h and >> sys/features.h says: >> >>  * __MISC_VISIBLE >>  *      Extensions found in both BSD and SVr4 (shorthand for >>  *      (__BSD_VISIBLE || __SVID_VISIBLE)), or newlib-specific >>  *      extensions; enabled by default. >> >> __MISC_VISIBLE is set if and only if _DEFAULT_SOURCE is set, so the comment >> below should also include "... or newlib-specific extensions": >> >>  * _DEFAULT_SOURCE (or none of the above) >>  *     POSIX-1.2008 with BSD and SVr4 extensions >> >> >> The above is not suitable to disable only the non-standard functions for >> such use cases. Using -D_GNU_SOURCE should IMO not enable functions >> unavailable on Linux. This is not the case because _GNU_SOURCE implies >> _DEFAULT_SOURCE. >> >> No patch provided for now, as I'm not yet sure how to handle this. Possibly: >> >> - Use __MISC_VISIBLE only for (__BSD_VISIBLE || __SVID_VISIBLE) - under the >> assumption that this is applicable for most cases. >> - Introduce __NONSTD_VISIBLE for non-standard functions like itoa(). >> - Introduce _NONSTD_SOURCE to set __NONSTD_VISIBLE independent from other >> _*_SOURCE defines. > Counter proposal: > > First of all, Cygwin does NOT export itoa/utoa! Only the prototypes > exist from the Cygwin POV. Thanks, I missed that. > As Cygwin is usually the only newlib project with backward compat > issues, we have two simple choices: > > - Drop itoa/utoa entirely, or > - just guard them with > > #if __MISC_VISIBLE && !defined (__CYGWIN__) > > You can make a proposal like that on the newlib list and then we can > discuss it there, ok? Done. -- Problem reports: https://cygwin.com/problems.html FAQ: https://cygwin.com/faq/ Documentation: https://cygwin.com/docs.html Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple