[RFA] strftime: Add POSIX flags, width, and handling for E and O modifier
Jeff Johnston
jjohnstn@redhat.com
Wed Feb 24 20:52:00 GMT 2010
On 24/02/10 03:24 PM, Corinna Vinschen wrote:
> 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?
>
You could follow the lead of the _WANT_IO_C99_FORMATS flag used in
vfprintf.c and possibly introduce a _WANT_C99_STRFTIME_FORMATS. We
could also add a generic _USE_C99 or _WANT_C99 flag that turns on all
C99 optional features at once.
>> 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
>
More information about the Newlib
mailing list