[
https://issues.apache.org/jira/browse/STDCXX-643?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12582532#action_12582532
]
Travis Vitek commented on STDCXX-643:
-------------------------------------
I have already suggested that we determine the size and layout of the exception
classes, and that we emulate them in our implementation. If we don't do that,
then at the very least we should do a configuration test and a compile assert.
That way the library won't build if our implementation doesn't match the
runtime library. I would hope that something like this would work.
{noformat}
// looking for runtime library exceptions
#include <exception>
#include <typeinfo>
#include <stdio.h>
template <class T>
void run_test (const char* s)
{
printf ("#define %-18s %u\n", s, sizeof (T));
}
int main ()
{
#define TEST(s,t) run_test<t>(s)
TEST ("_RWSTD_EXCEPTION_SIZE" , std::exception);
TEST ("_RWSTD_BAD_ALLOC_SIZE" , std::bad_alloc);
TEST ("_RWSTD_BAD_CAST_SIZE" , std::bad_cast);
TEST ("_RWSTD_BAD_EXCDEPTION_SIZE", std::bad_exception);
TEST ("_RWSTD_BAD_TYPEID_SIZE" , std::bad_typeid);
return 0;
}
{noformat}
And then, near the bottom of <exception>, we would write
{noformat}
_RWSTD_NAMESPACE (__rw) {
// used only to guarantee that we are binary compatible with the runtime library
inline void
__rw_exception_compile_asserts ()
{
_RWSTD_COMPILE_ASSERT (_RWSTD_EXCEPTION_SIZE == sizeof (_STD::exception));
_RWSTD_COMPILE_ASSERT (_RWSTD_BAD_ALLOC_SIZE == sizeof (_STD::bad_alloc));
_RWSTD_COMPILE_ASSERT (_RWSTD_BAD_CAST_SIZE == sizeof (_STD::bad_cast));
_RWSTD_COMPILE_ASSERT (_RWSTD_BAD_EXCEPTION_SIZE == sizeof
(_STD::bad_exception));
_RWSTD_COMPILE_ASSERT (_RWSTD_BAD_TYPEID_SIZE == sizeof
(_STD::bad_typeid));
}
} // namespace rw
{noformat}
> std::exception declaration incompatible with implementation provided by
> runtime library on AIX
> ----------------------------------------------------------------------------------------------
>
> Key: STDCXX-643
> URL: https://issues.apache.org/jira/browse/STDCXX-643
> Project: C++ Standard Library
> Issue Type: Bug
> Components: 19. Diagnostics
> Affects Versions: 4.2.0
> Environment: AIX
> Reporter: Travis Vitek
> Fix For: 5.0
>
>
> A description of the problem is available here.
> http://www.nabble.com/19.exceptions.mt.cpp-fails-on-AIX-tf4738595.html
> Essentially we need to add a const char* member to std::exception for AIX.
> Unfortunately the fix is a binary incompatible with previous versions of
> stdcxx.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.