From 8d88a92fe49a23a2d5b3b9230f62dd5ff2fd3d71 Mon Sep 17 00:00:00 2001 From: Dave Abrahams Date: Sun, 24 Mar 2002 21:31:21 +0000 Subject: [PATCH] instantiation hacks for tru64cxx6.5 [SVN r13265] --- include/boost/python/class.hpp | 1 + .../boost/python/object/class_converters.hpp | 6 ++++- .../boost/python/object/pointer_holder.hpp | 22 +++++++++---------- include/boost/python/object/value_holder.hpp | 22 +++++++++---------- test/member_function_cast.cpp | 2 +- 5 files changed, 29 insertions(+), 24 deletions(-) diff --git a/include/boost/python/class.hpp b/include/boost/python/class.hpp index 48fb4532..f040a789 100644 --- a/include/boost/python/class.hpp +++ b/include/boost/python/class.hpp @@ -169,6 +169,7 @@ class class_ : private objects::class_base std::size_t, size = mpl::size::value + 1); class_id ids[size]; }; + friend struct id_vector; }; diff --git a/include/boost/python/object/class_converters.hpp b/include/boost/python/object/class_converters.hpp index 8f2786f3..86fcd64b 100644 --- a/include/boost/python/object/class_converters.hpp +++ b/include/boost/python/object/class_converters.hpp @@ -75,7 +75,11 @@ struct register_base_of template inline void register_class_from_python(Derived* = 0, Bases* = 0) { - (void)instance_finder::registration; + // cause the static registration to be instantiated. Can't just + // cast it to void on all compilers; some will skip its + // initialization. + void const* ignored = &instance_finder::registration; + (void)ignored; // register all up/downcasts here register_dynamic_id(); diff --git a/include/boost/python/object/pointer_holder.hpp b/include/boost/python/object/pointer_holder.hpp index 8bce39bd..4ec46377 100644 --- a/include/boost/python/object/pointer_holder.hpp +++ b/include/boost/python/object/pointer_holder.hpp @@ -160,7 +160,7 @@ struct pointer_holder_back_reference : instance_holder // Forward construction to the held object pointer_holder_back_reference(PyObject* p) : m_p(new held_type(p)) { - (void)instance_finder::registration; + void const* x = &instance_finder::registration; (void)x; } template @@ -169,7 +169,7 @@ struct pointer_holder_back_reference : instance_holder , (typename unwrap_reference::type&)(a1) )) { - (void)instance_finder::registration; + void const* x = &instance_finder::registration; (void)x; } @@ -180,7 +180,7 @@ struct pointer_holder_back_reference : instance_holder , (typename unwrap_reference::type&)(a2) )) { - (void)instance_finder::registration; + void const* x = &instance_finder::registration; (void)x; } @@ -192,7 +192,7 @@ struct pointer_holder_back_reference : instance_holder , (typename unwrap_reference::type&)(a3) )) { - (void)instance_finder::registration; + void const* x = &instance_finder::registration; (void)x; } @@ -205,7 +205,7 @@ struct pointer_holder_back_reference : instance_holder , (typename unwrap_reference::type&)(a4) )) { - (void)instance_finder::registration; + void const* x = &instance_finder::registration; (void)x; } @@ -218,7 +218,7 @@ struct pointer_holder_back_reference : instance_holder , (typename unwrap_reference::type&)(a4) , (typename unwrap_reference::type&)(a5) )) { - (void)instance_finder::registration; + void const* x = &instance_finder::registration; (void)x; } @@ -232,7 +232,7 @@ struct pointer_holder_back_reference : instance_holder , (typename unwrap_reference::type&)(a5) , (typename unwrap_reference::type&)(a6) )) { - (void)instance_finder::registration; + void const* x = &instance_finder::registration; (void)x; } @@ -248,7 +248,7 @@ struct pointer_holder_back_reference : instance_holder , (typename unwrap_reference::type&)(a7) )) { - (void)instance_finder::registration; + void const* x = &instance_finder::registration; (void)x; } @@ -265,7 +265,7 @@ struct pointer_holder_back_reference : instance_holder , (typename unwrap_reference::type&)(a8) )) { - (void)instance_finder::registration; + void const* x = &instance_finder::registration; (void)x; } @@ -283,7 +283,7 @@ struct pointer_holder_back_reference : instance_holder , (typename unwrap_reference::type&)(a9) )) { - (void)instance_finder::registration; + void const* x = &instance_finder::registration; (void)x; } @@ -302,7 +302,7 @@ struct pointer_holder_back_reference : instance_holder , (typename unwrap_reference::type&)(a10) )) { - (void)instance_finder::registration; + void const* x = &instance_finder::registration; (void)x; } diff --git a/include/boost/python/object/value_holder.hpp b/include/boost/python/object/value_holder.hpp index 4154a7e8..e6d7f454 100644 --- a/include/boost/python/object/value_holder.hpp +++ b/include/boost/python/object/value_holder.hpp @@ -148,7 +148,7 @@ struct value_holder_back_reference : instance_holder // Forward construction to the held object value_holder_back_reference(PyObject* p) : m_held() { - (void)instance_finder::registration; + void const* x = &instance_finder::registration; (void)x; } @@ -158,7 +158,7 @@ struct value_holder_back_reference : instance_holder , (typename unwrap_reference::type&)(a1) ) { - (void)instance_finder::registration; + void const* x = &instance_finder::registration; (void)x; } @@ -169,7 +169,7 @@ struct value_holder_back_reference : instance_holder , (typename unwrap_reference::type&)(a2) ) { - (void)instance_finder::registration; + void const* x = &instance_finder::registration; (void)x; } @@ -181,7 +181,7 @@ struct value_holder_back_reference : instance_holder , (typename unwrap_reference::type&)(a3) ) { - (void)instance_finder::registration; + void const* x = &instance_finder::registration; (void)x; } @@ -194,7 +194,7 @@ struct value_holder_back_reference : instance_holder , (typename unwrap_reference::type&)(a4) ) { - (void)instance_finder::registration; + void const* x = &instance_finder::registration; (void)x; } @@ -207,7 +207,7 @@ struct value_holder_back_reference : instance_holder , (typename unwrap_reference::type&)(a4) , (typename unwrap_reference::type&)(a5) ) { - (void)instance_finder::registration; + void const* x = &instance_finder::registration; (void)x; } @@ -221,7 +221,7 @@ struct value_holder_back_reference : instance_holder , (typename unwrap_reference::type&)(a5) , (typename unwrap_reference::type&)(a6) ) { - (void)instance_finder::registration; + void const* x = &instance_finder::registration; (void)x; } @@ -237,7 +237,7 @@ struct value_holder_back_reference : instance_holder , (typename unwrap_reference::type&)(a7) ) { - (void)instance_finder::registration; + void const* x = &instance_finder::registration; (void)x; } @@ -254,7 +254,7 @@ struct value_holder_back_reference : instance_holder , (typename unwrap_reference::type&)(a8) ) { - (void)instance_finder::registration; + void const* x = &instance_finder::registration; (void)x; } @@ -272,7 +272,7 @@ struct value_holder_back_reference : instance_holder , (typename unwrap_reference::type&)(a9) ) { - (void)instance_finder::registration; + void const* x = &instance_finder::registration; (void)x; } @@ -291,7 +291,7 @@ struct value_holder_back_reference : instance_holder , (typename unwrap_reference::type&)(a10) ) { - (void)instance_finder::registration; + void const* x = &instance_finder::registration; (void)x; } private: // required holder implementation diff --git a/test/member_function_cast.cpp b/test/member_function_cast.cpp index 986d87b5..a754fd36 100644 --- a/test/member_function_cast.cpp +++ b/test/member_function_cast.cpp @@ -52,4 +52,4 @@ int main() assert_mf_cast(3); assert_mf_cast(X()); return 0; -}; +}