[C++-sig] Re: Boost.Python in SUSE 9.0 or SUSE 9.1?

Chris Hoeppler hoeppler at diener.iap.physik.uni-tuebingen.de
Wed Jul 7 20:19:14 CEST 2004


On Wed, 7 Jul 2004, David Abrahams wrote:

> Here's what you do.  You use that nasty preprocessor condition to
> switch in this code:
>
>   template <class ExceptionType, class Translate>
>   struct translate_exception
>   {
>       typedef typename remove_reference<
>                        ^^^^^^^
>           typename add_const<ExceptionType>::type
>       >::type exception_non_ref;
>
>       inline bool operator()(
>           exception_handler const& handler
>         , function0<void> const& f
>         , typename call_traits<Translate>::param_type translate) const
>       {
>           try
>           {
>               return handler(f);
>           }
>           catch(exception_non_ref& e)
>                 ^^^^^^^^^^^^^^^^^^
>           {
>               translate(e);
>               return true;
>           }
>       }
>   };
>
> Then you test it thoroughly.

Thanks for the help. I applied your workaround using BOOST_WORKAROUND as
suggested by Ralf (see enclosed patch how) and successfully ran all the
test in libs/python/test by invoking bjam with no arguments in that
directory on the following two systems:

* SuSE Linux 9.1 with gcc 3.3.3 as shipped by SuSE

* SuSE Linux 9.0 with gcc 3.3.1 as shipped by SuSE

On both systems I used boost_1_31_0 from the boost web-site.

Could somebody with easy access to the official versions of gcc please
test the enclosed patch, as well?

Are there any other tests I could/should run?

Chris.
-------------- next part --------------
Index: translate_exception.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/python/detail/translate_exception.hpp,v
retrieving revision 1.3
diff -d -u -r1.3 translate_exception.hpp
--- translate_exception.hpp	23 Nov 2002 22:18:23 -0000	1.3
+++ translate_exception.hpp	7 Jul 2004 17:14:32 -0000
@@ -22,9 +22,19 @@
 template <class ExceptionType, class Translate>
 struct translate_exception
 {
+# if defined(__linux__) && defined(__GNUC__) \
+    && BOOST_WORKAROUND(__GNUC__, == 3) \
+    && BOOST_WORKAROUND(__GNUC_MINOR__, == 3) \
+    && (BOOST_WORKAROUND(__GNUC_PATCHLEVEL__, == 1) \
+        || BOOST_WORKAROUND(__GNUC_PATCHLEVEL__, == 3))
+    typedef typename remove_reference<
+        typename add_const<ExceptionType>::type
+    >::type exception_non_ref;
+# else
     typedef typename add_reference<
         typename add_const<ExceptionType>::type
     >::type exception_cref;
+# endif
     
     inline bool operator()(
         exception_handler const& handler
@@ -35,7 +45,15 @@
         {
             return handler(f);
         }
+# if defined(__linux__) && defined(__GNUC__) \
+    && BOOST_WORKAROUND(__GNUC__, == 3) \
+    && BOOST_WORKAROUND(__GNUC_MINOR__, == 3) \
+    && (BOOST_WORKAROUND(__GNUC_PATCHLEVEL__, == 1) \
+        || BOOST_WORKAROUND(__GNUC_PATCHLEVEL__, == 3))
+        catch(exception_non_ref& e)
+# else
         catch(exception_cref e)
+# endif
         {
             translate(e);
             return true;


More information about the Cplusplus-sig mailing list