Email List: Xaustin-review-lX
[All Lists]

Defect in XSH 2.2.2

To: yyyyyyyyyyyyyyy@xxxxxxxxxxxxx
Subject: Defect in XSH 2.2.2
From: Geoff Clare <yyy@xxxxxxxxxxxxx>
Date: Fri, 3 Mar 2006 10:51:57 +0000
@ page 14 line 564-578 section 2.2.2 objection [gwc posix namespace]

Problem:

Defect code :  3. Clarification required

With the merging of POSIX.1 and SUS into one document, a previous
clear distinction between the POSIX and UNIX (XSI) namespaces has
become less clear.

I believe the intention was for the previous distinction between the
namespaces that existed for POSIX.1-1996 and SUSv2 to be preserved.
That is, when _POSIX_C_SOURCE alone is defined, only non-XSI
symbols and symbols with a reserved prefix or suffix should be
made visible.  Non-reserved XSI symbols should only be visible when
_XOPEN_SOURCE is defined by the application.

In section 2.2.1.2 there is a reasonably clear indication of the
intention for (non-reserved) XSI symbols to be visible only when
_XOPEN_SOURCE is defined.  It states:

    "An XSI-conforming application should ensure that the feature test
    macro _XOPEN_SOURCE is defined with the value 600 before inclusion
    of any header. This is needed to enable the functionality
    described in Section 2.2.1.1 and in addition to enable the XSI
    extension."

It is saying that a definition of _XOPEN_SOURCE is /needed/ to enable
the XSI extension.  This implies that the XSI extension should not be
enabled when _XOPEN_SOURCE is not defined.

The paragraph that follows the above provides further evidence of
this intention:

    "Since this volume of IEEE Std 1003.1-2001 is aligned with the ISO
    C standard, and since all functionality enabled by _POSIX_C_SOURCE
    set equal to 200112L is enabled by _XOPEN_SOURCE set equal to 600,
    there should be no need to define _POSIX_C_SOURCE if _XOPEN_SOURCE
    is so defined. Therefore, if _XOPEN_SOURCE is set equal to 600 and
    _POSIX_C_SOURCE is set equal to 200112L, the behavior is the same
    as if only _XOPEN_SOURCE is defined and set equal to 600. However,
    should _POSIX_C_SOURCE be set to a value greater than 200112L, the
    behavior is unspecified."

This paragraph would have been written quite differently if the
intention was for the behaviour with only _POSIX_C_SOURCE equal to
200112L to be allowed to be equivalent to the behaviour with
_XOPEN_SOURCE equal to 600 and _POSIX_C_SOURCE equal to 200112L.

Unfortunately, although the intention is fairly clear from section
2.2.1.2, it is the section after it (2.2.2) which directly states
what symbols are allowed to be visible, and it is there that the
namespace distinction is no longer clear.

Action:

On lines 564-566 change:
    
    "The set of identifiers visible to the application consists of
    precisely those identifiers from the header pages of the included
    headers, as well as additional identifiers reserved for the
    implementation."

to:
    
    "The set of identifiers visible to the application consists of
    precisely the following:

        * the identifiers with no XSI marking from the header pages
        of the included headers,

        * [XSI] the identifiers with XSI marking from the header
        pages of the included headers (only when _XOPEN_SOURCE is
        defined) [/XSI], and

        * additional identifiers reserved for the implementation."

On lines 573-578 change:

  "1. Each identifier with external linkage described in the header
      section is reserved for use as an identifier with external
      linkage if the header is included.

   2. Each macro described in the header section is reserved for any
      use if the header is included.

   3. Each identifier with file scope described in the header section
      is reserved for use as an identifier with file scope in the same
      name space if the header is included."

to:

  "1. Each identifier with external linkage and no XSI marking
      described in the header section is reserved for use as an
      identifier with external linkage if the header is included.

   2. [XSI] Each identifier with external linkage and with XSI marking
      described in the header section is reserved for use as an
      identifier with external linkage if the header is included and
      _XOPEN_SOURCE is defined.[/XSI]

   3. Each macro with no XSI marking described in the header section
      is reserved for any use if the header is included.

   4. [XSI] Each macro with XSI marking described in the header
      section is reserved for any use if the header is included and
      _XOPEN_SOURCE is defined.[/XSI]

   5. Each identifier with file scope and no XSI marking described in
      the header section is reserved for use as an identifier with
      file scope in the same name space if the header is included.

   6. [XSI] Each identifier with file scope and with XSI marking
      described in the header section is reserved for use as an
      identifier with file scope in the same name space if the header
      is included and _XOPEN_SOURCE is defined.[/XSI]"

<Prev in Thread] Current Thread [Next in Thread>