X-Recipient: archive-cygwin AT delorie DOT com DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 43E6D3858295 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; s=default; t=1705938491; bh=Nf+2rrHmM5O0nkuY21uI3txieJpMvoroH4VUQO4YsHg=; h=Subject:To:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=YAW3CSYc/OhgQl4qlUwN+YHKIXZLmJrj2bjZY4I6omOoYwDB5lgOIYn5/f3+pn2Ku XVyMnxUpAsVIGKkHpG8lb/dWWZbTdQ1PLj6GsGvVXvFiYGHsuN5vZX22v4MAtqe0ya jKtlh3xUo4LfZxrsvEiZkeOqtRMVyCDV3jMdxum0= X-Original-To: cygwin AT cygwin DOT com Delivered-To: cygwin AT cygwin DOT com DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 751113858295 ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 751113858295 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705938424; cv=none; b=QzoFq5xyyHJsFK654gxRuc176jKSV8nu+ISylo0XYLbm0AnK4Lm8BLt2YB7al0odlgG/+ByBqU/i/0XWGt9SIb6UqamD8WuXS9jungvj96nG5okaj5aXW2o7N+AXCm6OWrtSpG9+VfqICfsQT/xlfBa2j1Z0bNy9kXI/0J2tn8M= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705938424; c=relaxed/simple; bh=m5EsvCErTwMr58pjfLdDdhj8VgIXWtoT6VUCYjM7/cw=; h=From:Subject:To:Message-ID:Date:MIME-Version; b=sOBgyAwKZnxtR1QLyNhyMrpdmWVCy9QjeWpl9Y8WUwK43Yd8rZzyXSLTEDt+NjML8wzvXB5pRUK6VkxwgCJbuNxvsmj80J3FF8Ph5nr8HCFU7dW8Ao8gXQPG3oFggGHbPH033wDFKWpOKcCFz2gh4lQ6A94avpg4/7CKosziLCo= ARC-Authentication-Results: i=1; server2.sourceware.org Subject: Add ability to hide non-standard itoa/utoa() in stdlib.h ? To: cygwin AT cygwin DOT com Message-ID: Date: Mon, 22 Jan 2024 16:47:00 +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 X-TOI-EXPURGATEID: 150726::1705938420-769C39CF-FB2E22B2/0/0 CLEAN NORMAL X-TOI-MSGID: 1f80bdd5-feaa-4dbd-a4d7-241f8432f16d X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00, BODY_8BITS, FREEMAIL_FROM, KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE, URI_TRY_3LD autolearn=no 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 List-Id: General Cygwin discussions and problem reports 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" Sender: "Cygwin" Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by delorie.com id 40MFmDtl025144 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. -- Regards, Christian -- 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