[RFA] strftime: Add POSIX flags, width, and handling for E and O modifier

Corinna Vinschen vinschen@redhat.com
Wed Feb 24 20:24:00 GMT 2010

On Feb 24 15:00, Howland Craig D (Craig) wrote:
> The E and O modifiers are C99, also (not just POSIX extensions).
> So if that were to be gated, it would want to be something like
> #if defined(USE_LOCALE)

We don't have that define at all.  If I was going to introduce it,
where else should it go?  That's a bit generic, isn't it?

> The '0' and '+' padding flags are POSIX CX extensions, and I think
> want _POSIX_C_SOURCE as the gate.  (Which is allowed to be not defined
> if _XOPEN_SOURCE is, which we'd want to cover in a header somewhere,
> as the code may define _POSIX_C_SOURCE if is is not defined yet
> _XOPEN_SOURCE has been).  So
> #if defined(_POSIX_C_SOURCE)
> for the '0' and '+' flags.  Although it might be better to say something
> like: 
> #if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200809L
> (Or another appropriate number.  See the
> http://sourceware.org/ml/newlib/2010/msg00159.html thread.)

IIUC the _POSIX_C_SOURCE macro is a feature test macro to be used by
*applications* to enable or disable certain interfaces and definitions
in the header files.  It is not supposed to be used in the C library
itself to switch features on and off.

Consider what that means for the library.  If all POSIX functionality is
switched on and off by a single macro, then all these features are
switched on and off for a target.  There's no way to define certain
functionality for inclusion into a build on a per-target base anymore.
I'm not so sure this would be feasible.


Corinna Vinschen
Cygwin Project Co-Leader
Red Hat

More information about the Newlib mailing list