This is the mail archive of the libc-hacker@sourceware.cygnus.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: A patch for time/time.h


hjl@lucon.org (H.J. Lu) writes:

> -D_POSIX_C_SOURCE=199506L
> 
> But it doesn't want to see those POSIX.2 stuff nor POSIX.4.

But then it is wrong.

The ISO 9945-1 standard (= POSIX.1 + .1b + .1c + .1i) defines that if
_POSIX_C_SOURCE has a value greater or equal to 199506 then all
mandatory definitions from this standard have to be added, and all
extensions can be used.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ISO/IEC 9945-1:1996, 2.7.2 POSIX.1 Symbols

[...]
_POSIX_C_SOURCE   When an application includes a header described by this
                  part of ISO/IEC 9945, and when this feature test macro is
                  defined to have at least the value 199506L:

                  (1)  All symbols required by this part of ISO/IEC 9945
                       to appear when the header is included shall be
                       made visible.

                  (2)  Symbols that are explicitly permitted, but not
                       required, by this part of ISO/IEC 9945 to appear
                       in that header (including those in reserved name
                       space) may be made visible.

                  (3)  Additional symbols not required or explicitly per-
                       mitted by this part of ISO/IEC 9945 to be in that
                       header shall not be made visible, except when
                       enabled by another feature test macro or by hav-
                       ing defined _POSIX_C_SOURCE with a value larger
                       than 199506L.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

And it says:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
B.2.7.2 POSIX.1 Symbols

[...] In the C Standard case, each feature test macro simply adds to
the possible symbols.  In common usage, having _POSIX_C_SOURCE defined
with a value of 199309L is a special case in that it reduces the set
to the sum of the C Standard and POSIX.1.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Note POSIX.1 references to the IEEE documents from 1990 which predates
the ISO document.

The situation with POSIX.2 is more complex.  The standard is quite old
(1992) and predates the extensions of POSIX.1.  The POSIX.1 working
groups hijacked the _POSIX_C_SOURCE symbol and made it virtually
useless for POSIX.2.  The later requires that POSIX.2 extensions are
only made visible if this macro has the value 2.  But this would mean
that POSIX.2 symbols never can be made visible at the same time as
POSIX.1 symbols.  Therefore we have adopted for POSIX.2 the same rules
as for POSIX.1: a larger value for POSIX.2 means that the features
selected for smaller values are included.

-- 
---------------.      drepper at gnu.org  ,-.   1325 Chesapeake Terrace
Ulrich Drepper  \    ,-------------------'   \  Sunnyvale, CA 94089 USA
Cygnus Solutions `--' drepper at cygnus.com   `------------------------


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]