strnlen, strict ansi, newlib vs glibc

Corinna Vinschen
Fri Aug 15 21:46:00 GMT 2014

On Aug 15 09:23, Joel Sherrill wrote:
> Attached is a new version of the patch. Comments interspersed.
> On 8/15/2014 6:52 AM, Corinna Vinschen wrote:
> > On Aug 14 17:53, Joel Sherrill wrote:
> >> This type of change is always tricky. FreeBSD's string.h only had
> >> __STRICT_ANSI__.  I read the glibc version and attempted to
> >> translate their feature flags into the BSD style ones we have
> >> from <sys/cdefs.h>.
> >>
> >> There are a few methods I have no idea how to guard:
> >>
> >> + The block of Windows strcmpi and friends at the bottom
> >> of the file.
> > Nuke them.  We don't have any Windows target, and Cygwin doesn't export
> > those.  They are likely a remnant from the time the Cygwin devs were
> > trying to make Cygwin a MSVCRT replacement (pre 1999).
> Done. :)
> >> + strlwr() and strupr(). No idea where those originated.
> > These ill-advised functions, which apparently predate any multibyte
> > concernes are actually in newlib.  They are ASCII only, non-standard,
> > and inherently broken by design.  So the question is, do we really want
> > to export them?  If so, maybe we should guard them with something like
> >
> >   #ifdef __USE_NONSTD
> That does not appear anywhere in the source. I hate to add a new guard.
> They are wrapped in !defined(__STRICT_ANSI__).

OTOH, this makes them visible in all circumstances but -ansi.
I think we would really like to make them only visible if somebody
really wants newlib extensions.

So what if we define _NEWLIB_SOURCE and __NEWLIB_VISIBLE for stuff
which is really newlib-only and not in any standard nor a Glibc


Corinna Vinschen
Cygwin Maintainer
Red Hat
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <>

More information about the Newlib mailing list