You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@stdcxx.apache.org by "Travis Vitek (JIRA)" <ji...@apache.org> on 2008/06/05 21:01:47 UTC

[jira] Commented: (STDCXX-670) [IBM XLC++/AIX] doesn't #define macro setjmp

    [ https://issues.apache.org/jira/browse/STDCXX-670?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12602751#action_12602751 ] 

Travis Vitek commented on STDCXX-670:
-------------------------------------

I'm not exactly sure of the expecation is correct here. The test includes <setjmp.h>. After looking at C99, I'm not convinced that {{setjmp}} is required to be a macro. Section 7.13 p1 says
{quote}
The header <setjmp.h> defines the macro setjmp, and declares one function and
one type, for bypassing the normal function call and return discipline.
{quote}
This pretty much says indicates that {{setjmp}} is supposed to be a macro because {{jmp_buf}} is the type, and {{longjmp}} is the function that are required to be provided by {{setjmp.h}}

A little later, in 7.13 p3 reads
{quote}
It is unspecified whether setjmp is a macro or an identifier declared with external
linkage. If a macro definition is suppressed in order to access an actual function, or a
program defines an external identifier with the name setjmp, the behavior is undefined.
{quote}
I read this as saying that {{setjmp}} can be implemented as a macro or a normal function.

Finally, Annex J [Unspecified behavior] section J.1 p1 bullet 32 comes right out and clearly states
{quote}
The following are unspecified:
  [...]
  -- Whether setjmp is a macro or an identifier with external linkage (7.13).
{quote}
So I think that the assertion is bogus if we are talking about {{setjmp.h}}.

If we are talking about the C++ header {{csetjmp}}, then the C++03 standard lib.headers p4/5 says

{quote}
Except as noted in clauses 18 through 27, the contents of each header cname shall be the same as that of the
corresponding header name.h, as specified in ISO/IEC 9899:1990 Programming Languages C (Clause 7),
or ISO/IEC:1990 Programming Languages—C AMENDMENT 1: C Integrity, (Clause 7), as appropriate,
as if by inclusion. In the C + + Standard Library, however, the declarations and definitions (except for names
which are defined as macros in C) are within namespace scope (3.3.5) of the namespace std.

Names which are defined as macros in C shall be defined as macros in the C + + Standard Library, even if C
grants license for implementation as functions. [Note: the names defined as macros in C include the following:
assert, errno, offsetof, setjmp, va_arg, va_end, and va_start. —end note]
{quote}

If I'm reading this correctly, it sounds like {{setjmp}} is supposed to be a macro in {{csetjmp}} if the C library defines the macro, regardless of how it is actually implemented. I also see that Table 20 in lib.support.runtime indicates that {{setjmp}} is expected to be a macro, but I'm not convinced that this isn't just an oversight.

Any input?

> [IBM XLC++/AIX] <setjmp.h> doesn't #define macro setjmp
> -------------------------------------------------------
>
>                 Key: STDCXX-670
>                 URL: https://issues.apache.org/jira/browse/STDCXX-670
>             Project: C++ Standard Library
>          Issue Type: Bug
>          Components: 18. Language Support
>    Affects Versions: 4.2.0
>            Reporter: Martin Sebor
>            Assignee: Travis Vitek
>            Priority: Minor
>             Fix For: 4.2.2
>
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> As noted in STDCXX-606, the header [{{<setjmp.h>}}|http://svn.apache.org/repos/asf/stdcxx/tags/4.2.0/include/ansi/setjmp.h] fails to {{#define}} the macro {{setjmp}} as required. As a result, the test for this functionality, [{{18.setjmp.cpp}}|http://svn.apache.org/repos/asf/stdcxx/tags/4.2.0/tests/support/18.setjmp.cpp], fails an assertion:
> {noformat}
> # INFO (S1) (10 lines):
> # TEXT: 
> # COMPILER: IBM VisualAge C++, __IBMCPP__ = 900
> # ENVIRONMENT: powerpc/LP64 running aix-5.3
> # FILE: 18.setjmp.cpp
> # COMPILED: Nov 21 2007, 16:53:28
> # COMMENT: header <setjmp.h>
> ############################################################
> # CLAUSE: support.runtime
> # ASSERTION (S7) (4 lines):
> # TEXT: macro setjmp not #defined
> # CLAUSE: support.runtime
> # LINE: 66
> # +-----------------------+----------+----------+----------+
> # | DIAGNOSTIC            |  ACTIVE  |   TOTAL  | INACTIVE |
> # +-----------------------+----------+----------+----------+
> # | (S1) INFO             |        1 |        1 |       0% |
> # | (S7) ASSERTION        |        1 |        4 |      75% |
> # +-----------------------+----------+----------+----------+
> {noformat}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.