Thanks for pointing it out! I noticed it too when I tested the change
on Windows but I haven't decided how to deal with it yet. Compilers
often assume that functions with C linkage don't throw exceptions and
generate code that breaks when an exception does end up being thrown.
I think MSVC is one of them, and gcc another. We should probably add
a config test to determine whether a compiler allows exceptions to
pass through C code and only rethrow the exception only when it does.
In the opposite case we'll need to decide how to handle the exception.
Any suggestions?
Martin
Farid Zaripov wrote:
>> -----Original Message-----
>> From: sebor@apache.org [mailto:sebor@apache.org]
>> Sent: Wednesday, August 08, 2007 1:24 AM
>> To: stdcxx-commits@incubator.apache.org
>> Subject: svn commit: r563682 - in
>> /incubator/stdcxx/trunk/src: once.cpp once.h
>>
>> Author: sebor
>> Date: Tue Aug 7 15:24:10 2007
>> New Revision: 563682
>>
>> URL: http://svn.apache.org/viewvc?view=rev&rev=563682
>> Log:
>> 2007-08-07 Martin Sebor <sebor@roguewave.com>
>>
>> * once.h: New implementation-private header. Declares
>> __rw_once_t
>> and __rw_once() for portable, thread-safe one-time
>> initialization.
>> * once.cpp: New. Defines the above.
>
> [...]
>
>> + _TRY {
>> + func ();
>> + }
>> + _CATCH (...) {
>> + _RWSTD_ATOMIC_PREDECREMENT (init, false);
>> + _RETHROW;
>
> The MSVC issues warning on this line:
> once.cpp
> ..\..\..\src\once.cpp(74) : warning C4297: '__rw::__rw_once' : function
> assumed not to throw an exception but does
> The function is extern "C" and /EHc was specified
>
>> + }
>
> Farid.
|