You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@stdcxx.apache.org by Farid Zaripov <Fa...@epam.com> on 2007/07/30 20:07:59 UTC

18.exception.cpp test on Cygwin

  The 18.exception.cpp test fails to compile on gcc 3.4.4/Cygwin.

-----------
18.exception.cpp: In function `void test_runtime()':
18.exception.cpp:929: error: `setjmp' is not a member of `std'
18.exception.cpp: In function `int run_test(int, char**)':
18.exception.cpp:1023: error: `setjmp' is not a member of `std'
-----------

  The reason is that setjmp macro is not #defined in
/usr/include/setjmp.h and
setjmp() function not introduced in namespace std:: in
include/ansi/csetjmp.

  18.exception.cpp file (line 66):
---------
#  ifdef setjmp
#    define RW_SETJMP(env)       setjmp (env)
#  else
#    define RW_SETJMP(env)       std::setjmp (env)
#  endif
---------

Farid.

Re: 18.exception.cpp test on Cygwin

Posted by Martin Sebor <se...@roguewave.com>.
Farid Zaripov wrote:
>> -----Original Message-----
>> From: Martin Sebor [mailto:sebor@roguewave.com] 
>> Sent: Wednesday, August 08, 2007 9:27 PM
>> To: stdcxx-dev@incubator.apache.org
>> Subject: Re: 18.exception.cpp test on Cygwin
>>
>> Farid Zaripov wrote:
>>>   The 18.exception.cpp test fails to compile on gcc 3.4.4/Cygwin.
>> Do you have a suggestion for a fix?
> 
>   I see 3 possible ways:
> 
> 1) fix only 18.exception.cpp test to use ::setjmp() instead of
> std::setjmp() (#including <setjmp.h> instead of <csetjmp>)
> 
> 2) in our ansi/csetjmp header file add checking and #defining setjmp
> macro:
> 
> #ifndef setjmp
> #define setjmp(env) setjmp (env)
> #endif

This seems like the best solution to me. C++ requires that setjmp
be a macro, so if we detect that it's not define we should define
it ourselves. The only question is what to #define the macro to.
I suppose we could just make the assumption that when the macro
is not #defined there is a function with the same name in file
scope and #define it exactly as you've done above. Alternatively,
we could try to detect where the function is declared in a config
test and use that in the definition of the macro, but that seems
like too much effort for little gain. The function could reasonably
only be declared in two namespaces: the global one or std. I think
assuming it's the former is probably safe.

Martin

> 
> 3) check for presence of setjmp() function using new /etc/src/SETJMP.cpp
> file and introduce it in std namespace
> in our ansi/csetjmp header file:
> 
> #ifndef _RWSTD_NO_SETJMP
> namespace std {
> using ::setjmp;
> } // namespace std
> #endif
> 
> Farid.


RE: 18.exception.cpp test on Cygwin

Posted by Farid Zaripov <Fa...@epam.com>.
> -----Original Message-----
> From: Martin Sebor [mailto:sebor@roguewave.com] 
> Sent: Wednesday, August 08, 2007 9:27 PM
> To: stdcxx-dev@incubator.apache.org
> Subject: Re: 18.exception.cpp test on Cygwin
> 
> Farid Zaripov wrote:
> >   The 18.exception.cpp test fails to compile on gcc 3.4.4/Cygwin.
> 
> Do you have a suggestion for a fix?

  I see 3 possible ways:

1) fix only 18.exception.cpp test to use ::setjmp() instead of
std::setjmp() (#including <setjmp.h> instead of <csetjmp>)

2) in our ansi/csetjmp header file add checking and #defining setjmp
macro:

#ifndef setjmp
#define setjmp(env) setjmp (env)
#endif

3) check for presence of setjmp() function using new /etc/src/SETJMP.cpp
file and introduce it in std namespace
in our ansi/csetjmp header file:

#ifndef _RWSTD_NO_SETJMP
namespace std {
using ::setjmp;
} // namespace std
#endif

Farid.

Re: 18.exception.cpp test on Cygwin

Posted by Martin Sebor <se...@roguewave.com>.
Farid Zaripov wrote:
>   The 18.exception.cpp test fails to compile on gcc 3.4.4/Cygwin.

Do you have a suggestion for a fix? If not, can you please open
an issue for the problem in Jira?

Martin

> 
> -----------
> 18.exception.cpp: In function `void test_runtime()':
> 18.exception.cpp:929: error: `setjmp' is not a member of `std'
> 18.exception.cpp: In function `int run_test(int, char**)':
> 18.exception.cpp:1023: error: `setjmp' is not a member of `std'
> -----------
> 
>   The reason is that setjmp macro is not #defined in
> /usr/include/setjmp.h and
> setjmp() function not introduced in namespace std:: in
> include/ansi/csetjmp.
> 
>   18.exception.cpp file (line 66):
> ---------
> #  ifdef setjmp
> #    define RW_SETJMP(env)       setjmp (env)
> #  else
> #    define RW_SETJMP(env)       std::setjmp (env)
> #  endif
> ---------
> 
> Farid.