From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by sourceware.org (Postfix) with ESMTPS id 0622D3858420 for ; Tue, 23 Jan 2024 21:41:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0622D3858420 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=systematicsw.ab.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=systematicsw.ab.ca ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 0622D3858420 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=216.40.44.11 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706046074; cv=none; b=RtxPigYK00ktfScncag3kfFzCzdlPmtZI2UcbAh1WzTN52t5W+SWU93hnadDPTp6SJuPmNlYk3agHwFXcMdUgBvAibwJZ0c+n7EKOCFSAhFV76K3AVovfzPMSKkAA5Wj8mTW7mhaFVrN9oDC+1AWVzXXC4CpPQr7GGZCzYfJTGU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706046074; c=relaxed/simple; bh=Qye8fm6+IgjC6NA8+iZrocFHDQ9Q2X7WrGYmJQoyRfY=; h=Message-ID:Date:MIME-Version:From:Subject:To; b=D0mXn4vf+TT8gKZNzRk5fSIJZRUh/DR7qQ8SHv6j+rQWVcUSqxgr2RvnuOAPpnNvRBON7h3uLd6STPAMGN0MBL8Ast4zSdIzklb+y25aQSSQWZnMDb0VjctAxeziM21BzEn8mD4PB80ACj2ZvbyH8wgCIhb0CE226tUqrJj7GH0= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from omf08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id B7B821A074D for ; Tue, 23 Jan 2024 21:41:11 +0000 (UTC) Received: from [HIDDEN] (Authenticated sender: Brian.Inglis@SystematicSW.ab.ca) by omf08.hostedemail.com (Postfix) with ESMTPA id 3EC7F20026 for ; Tue, 23 Jan 2024 21:41:10 +0000 (UTC) Message-ID: Date: Tue, 23 Jan 2024 14:41:09 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird From: brian.inglis@systematicsw.ab.ca Reply-To: newlib@sourceware.org Subject: Re: Hide non-standard itoa/utoa() in stdlib.h or drop these functions? Content-Language: en-CA To: newlib@sourceware.org References: <83962310-aec8-a718-bafb-6e10703693b8@t-online.de> Autocrypt: addr=brian.inglis@systematicsw.ab.ca; keydata= xjMEXopx8xYJKwYBBAHaRw8BAQdAnCK0qv/xwUCCZQoA9BHRYpstERrspfT0NkUWQVuoePbN LkJyaWFuIEluZ2xpcyA8QnJpYW4uSW5nbGlzQFN5c3RlbWF0aWNTdy5hYi5jYT7ClgQTFggA PhYhBMM5/lbU970GBS2bZB62lxu92I8YBQJeinHzAhsDBQkJZgGABQsJCAcCBhUKCQgLAgQW AgMBAh4BAheAAAoJEB62lxu92I8Y0ioBAI8xrggNxziAVmr+Xm6nnyjoujMqWcq3oEhlYGAO WacZAQDFtdDx2koSVSoOmfaOyRTbIWSf9/Cjai29060fsmdsDM44BF6KcfMSCisGAQQBl1UB BQEBB0Awv8kHI2PaEgViDqzbnoe8B9KMHoBZLS92HdC7ZPh8HQMBCAfCfgQYFggAJhYhBMM5 /lbU970GBS2bZB62lxu92I8YBQJeinHzAhsMBQkJZgGAAAoJEB62lxu92I8YZwUBAJw/74rF IyaSsGI7ewCdCy88Lce/kdwX7zGwid+f8NZ3AQC/ezTFFi5obXnyMxZJN464nPXiggtT9gN5 RSyTY8X+AQ== Organization: Systematic Software In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 3EC7F20026 X-Spam-Status: No, score=-8.3 required=5.0 tests=BAYES_00,GIT_PATCH_0,KAM_DMARC_STATUS,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.6 X-Rspamd-Server: rspamout08 X-Stat-Signature: q67w8tdpwtnst445wzu6xn16hm4fnmus X-Session-Marker: 427269616E2E496E676C69734053797374656D6174696353572E61622E6361 X-Session-ID: U2FsdGVkX1+lyMxaI1s0ES7EaP0N2uv/I578sBU6Y/g= X-HE-Tag: 1706046070-423767 X-HE-Meta: U2FsdGVkX18L6lFhhfhTc565IQM+jjEffx9zhMu0NoeEW3RQ7mMc6tQCZE/12JgxU+a8BWcRjz4gdEDwfr3xtxO3iuUYASEe6qdoKeE2dfseA+FVMSWsxb2J/iS4gto0jlUUkeCnTnw+kRlbRB7hmE00kzziFidDm2xgGKjbfA7x+kudstUON/ytAA5QUGWXEBWh7RXKBUSKH+s3m1zCVmE6kaQVt2mkWDFv2HPa2Q5g5JhMc7SEHmMTSuHbNnJ3am8EoaUOu+v/mtYp86/aPEFW17d042s1NeisWrCE8JIpxueqyAjDMdbKOAyMaPrhywr5K6JtUdtXsmM29ZqWH6t1J3IZCRfXIXkCzxCIeLKHcqpZkq0BNb6M+8nPoC6erh5G6y3pvGM2kSv0ayV58pT/cMvFJ65L2RZTfHio+t/H7TFiW2f8tvJwtyvVjunci3/SqVa29yg= X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 2024-01-23 02:03, Corinna Vinschen wrote: > On Jan 22 19:46, Christian Franke wrote: >> The functions itoa() and utoa() are non-standard, not exported by Cygwin and >> also unavailable on FreeBSD and Linux (glibc and musl libc). Busybox for >> example could not be build OOTB using newlib's stdlib.h because there are >> conflicts with local functions with same names but different signatures. >> >> See the original posts on the Cygwin list for more details: >> https://sourceware.org/pipermail/cygwin/2024-January/255216.html >> https://sourceware.org/pipermail/cygwin/2024-January/255217.html >> >> Corinna proposed to either drop these functions entirely or hide the >> prototypes on Cygwin only. I attached a patch for the second alternative. >> From 5f1c43796c6a125f04c1f2436fc1048783ce3b7a Mon Sep 17 00:00:00 2001 >> From: Christian Franke >> Date: Mon, 22 Jan 2024 19:11:20 +0100 >> Subject: [PATCH] Hide itoa, utoa, __itoa and __utoa in stdlib.h on Cygwin only >> >> These functions are non-standard and not exported by Cygwin. >> >> Signed-off-by: Christian Franke >> --- >> newlib/libc/include/stdlib.h | 4 +++- >> 1 file changed, 3 insertions(+), 1 deletion(-) >> >> diff --git a/newlib/libc/include/stdlib.h b/newlib/libc/include/stdlib.h >> index 15b349440..fd89f5ba7 100644 >> --- a/newlib/libc/include/stdlib.h >> +++ b/newlib/libc/include/stdlib.h >> @@ -221,11 +221,13 @@ char * ecvtbuf (double, int, int*, int*, char *); >> char * fcvtbuf (double, int, int*, int*, char *); >> char * ecvtf (float,int,int *,int *); >> #endif >> +#ifndef __CYGWIN__ >> char * __itoa (int, char *, int); >> char * __utoa (unsigned, char *, int); >> -#if __MISC_VISIBLE >> +# if __MISC_VISIBLE >> char * itoa (int, char *, int); >> char * utoa (unsigned, char *, int); >> +# endif >> #endif >> #if __POSIX_VISIBLE >> int rand_r (unsigned *__seed); >> -- >> 2.43.0 > In fact, while this patch fixes the namespace pollution for Cygwin, I > wonder if we shouldn't remove itoa/utoa entirely. The underscored > functions __itoa/__utoa accomplish exactly the same thing. > > Does anybody actually *need* itoa/utoa as long as we have __itoa/__utoa? Unix 1st ed Manual defined itoa as did K&R on p60 (/p64 2ed); at least IBM and QNX and "some compilers" provide itoa and others: https://cplusplus.com/reference/cstdlib/itoa/ other libraries also provide {,u}{,l}ltoa. Newlib provided the function and man pages, which should be updated to reflect the changed situation, as they will have been used, and users will want to know what happened and what to do e.g. use prefixed functions, #define, sprintf(3), etc. Downstream systems should note the change in their lists of supported functions, and in their release notes. -- Take care. Thanks, Brian Inglis Calgary, Alberta, Canada La perfection est atteinte Perfection is achieved non pas lorsqu'il n'y a plus rien à ajouter not when there is no more to add mais lorsqu'il n'y a plus rien à retirer but when there is no more to cut -- Antoine de Saint-Exupéry