www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2024/01/22/11:13:28

X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C40FF3858427
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1705940007;
bh=CMth9qU8ZAfRscaS8nMev0EjWj3H5aRQTBRM09pWlqs=;
h=Date:To:Subject:References:In-Reply-To:List-Id:List-Unsubscribe:
List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:
From;
b=XfzoCE4KBWzOspzQPnsMpOpiK9O8/GaqyttOIIwZMktOXk6NvuvY1/t2J3btG54Lh
vocqFT959aQysiSOYCuI03flt5rO0am2Xrqx4pRNTITL8LJVgpIyv2jnMUNZF0hlvB
FpMM3VOUo5t9LanuUkmiQb8lGCrLsVEz2+U6ZCu0=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6DECC3858D32
Date: Mon, 22 Jan 2024 17:12:59 +0100
To: cygwin AT cygwin DOT com
Subject: Re: Add ability to hide non-standard itoa/utoa() in stdlib.h ?
Message-ID: <Za6UC3WP3Ns7MzVD@calimero.vinschen.de>
Mail-Followup-To: cygwin AT cygwin DOT com
References: <a1913155-5740-4334-e465-a3a2cbaa7d85 AT t-online DOT de>
MIME-Version: 1.0
In-Reply-To: <a1913155-5740-4334-e465-a3a2cbaa7d85@t-online.de>
X-BeenThere: cygwin AT cygwin DOT com
X-Mailman-Version: 2.1.30
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Unsubscribe: <https://cygwin.com/mailman/options/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=unsubscribe>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-request AT cygwin DOT com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe>
From: Corinna Vinschen via Cygwin <cygwin AT cygwin DOT com>
Reply-To: cygwin AT cygwin DOT com
Cc: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
Errors-To: cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com
Sender: "Cygwin" <cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com>
X-MIME-Autoconverted: from base64 to 8bit by delorie.com id 40MGDSW7031336

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.

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?


Corinna

-- 
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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019