Fix FTBFS with Boost 1.49.0

The implementation of BOOST_PP_ITERATION_FLAGS() changed in Boost 1.49.0,
which causes Luabind to fail to build with GCC (reproduced with GCC 4.4
and GCC 4.6).

https://svn.boost.org/trac/boost/ticket/6631

http://thread.gmane.org/gmane.comp.lib.boost.devel/228802

http://article.gmane.org/gmane.comp.lib.boost.devel/228836

The work-around is to replace the pattern

 #if !defined(MACRO)
     // A
 #elif MACRO()
     // B
 #endif

with

 #if !defined(MACRO)
     // A
 #else
     #if MACRO()
         // B
     #endif
 #endif
Fix aliasing warnings with GCC >= 4.

Apply the same fix as used in boost::make_shared.

https://svn.boost.org/trac/boost/changeset/69251

gcc.compile.c++ test/bin/test_policies.test/gcc-4.7.0/release/link-static/test_policies.o
In file included from test/test_policies.cpp:25:0:
./luabind/out_value_policy.hpp: In instantiation of ‘void luabind::detail::pure_out_value_converter<Size, Policies>::converter_postcall(lua_State*, luabind::detail::by_pointer<T>, int) [with T = int; int Size = 4; Policies = luabind::detail::null_type; lua_State = lua_State]’:
/tmp/boost_1_49_0/boost/preprocessor/iteration/detail/local.hpp:40:1:   required from ‘int luabind::detail::invoke_member(lua_State*, const luabind::detail::function_object&, luabind::detail::invoke_context&, const F&, Signature, const Policies&, mpl_::long_<3l>, mpl_::true_) [with F = void (policies_test_class::*)(int, int*); Signature = boost::mpl::vector4<void, policies_test_class&, int, int*>; Policies = luabind::detail::policy_cons<luabind::detail::pure_out_value_policy<3, luabind::detail::null_type>, luabind::detail::null_type>; lua_State = lua_State; mpl_::true_ = mpl_::bool_<true>]’
./luabind/detail/call.hpp:78:5:   required from ‘int luabind::detail::invoke0(lua_State*, const luabind::detail::function_object&, luabind::detail::invoke_context&, const F&, Signature, const Policies&, IsVoid, mpl_::true_) [with F = void (policies_test_class::*)(int, int*); Signature = boost::mpl::vector4<void, policies_test_class&, int, int*>; Policies = luabind::detail::policy_cons<luabind::detail::pure_out_value_policy<3, luabind::detail::null_type>, luabind::detail::null_type>; IsVoid = boost::is_void<void>; lua_State = lua_State; mpl_::true_ = mpl_::bool_<true>]’
./luabind/detail/call.hpp:101:4:   required from ‘int luabind::detail::invoke(lua_State*, const luabind::detail::function_object&, luabind::detail::invoke_context&, const F&, Signature, const Policies&) [with F = void (policies_test_class::*)(int, int*); Signature = boost::mpl::vector4<void, policies_test_class&, int, int*>; Policies = luabind::detail::policy_cons<luabind::detail::pure_out_value_policy<3, luabind::detail::null_type>, luabind::detail::null_type>; lua_State = lua_State]’
./luabind/make_function.hpp:62:15:   required from ‘static int luabind::detail::function_object_impl<F, Signature, Policies>::entry_point(lua_State*) [with F = void (policies_test_class::*)(int, int*); Signature = boost::mpl::vector4<void, policies_test_class&, int, int*>; Policies = luabind::detail::policy_cons<luabind::detail::pure_out_value_policy<3, luabind::detail::null_type>, luabind::detail::null_type>; lua_State = lua_State]’
./luabind/make_function.hpp:35:28:   required from ‘luabind::detail::function_object_impl<F, Signature, Policies>::function_object_impl(F, const Policies&) [with F = void (policies_test_class::*)(int, int*); Signature = boost::mpl::vector4<void, policies_test_class&, int, int*>; Policies = luabind::detail::policy_cons<luabind::detail::pure_out_value_policy<3, luabind::detail::null_type>, luabind::detail::null_type>]’
./luabind/make_function.hpp:110:5:   required from ‘luabind::adl::object luabind::make_function(lua_State*, F, Signature, Policies) [with F = void (policies_test_class::*)(int, int*); Signature = boost::mpl::vector4<void, policies_test_class&, int, int*>; Policies = luabind::detail::policy_cons<luabind::detail::pure_out_value_policy<3, luabind::detail::null_type>, luabind::detail::null_type>; lua_State = lua_State]’
./luabind/class.hpp:311:52:   required from ‘void luabind::detail::memfun_registration<Class, F, Policies>::register_(lua_State*) const [with Class = policies_test_class; F = void (policies_test_class::*)(int, int*); Policies = luabind::detail::policy_cons<luabind::detail::pure_out_value_policy<3, luabind::detail::null_type>, luabind::detail::null_type>; lua_State = lua_State]’
test/test_policies.cpp:226:1:   required from here
./luabind/out_value_policy.hpp:219:4: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
./luabind/out_value_policy.hpp:220:4: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
./luabind/out_value_policy.hpp: In instantiation of ‘void luabind::detail::pure_out_value_converter<Size, Policies>::converter_postcall(lua_State*, luabind::detail::by_pointer<T>, int) [with T = float; int Size = 4; Policies = luabind::detail::null_type; lua_State = lua_State]’:
/tmp/boost_1_49_0/boost/preprocessor/iteration/detail/local.hpp:34:1:   required from ‘int luabind::detail::invoke_normal(lua_State*, const luabind::detail::function_object&, luabind::detail::invoke_context&, const F&, Signature, const Policies&, mpl_::long_<1l>, mpl_::true_) [with F = void (*)(float*); Signature = boost::mpl::vector2<void, float*>; Policies = luabind::detail::policy_cons<luabind::detail::pure_out_value_policy<1, luabind::detail::null_type>, luabind::detail::null_type>; lua_State = lua_State; mpl_::true_ = mpl_::bool_<true>]’
./luabind/detail/call.hpp:89:5:   required from ‘int luabind::detail::invoke0(lua_State*, const luabind::detail::function_object&, luabind::detail::invoke_context&, const F&, Signature, const Policies&, IsVoid, mpl_::false_) [with F = void (*)(float*); Signature = boost::mpl::vector2<void, float*>; Policies = luabind::detail::policy_cons<luabind::detail::pure_out_value_policy<1, luabind::detail::null_type>, luabind::detail::null_type>; IsVoid = boost::is_void<void>; lua_State = lua_State; mpl_::false_ = mpl_::bool_<false>]’
./luabind/detail/call.hpp:101:4:   required from ‘int luabind::detail::invoke(lua_State*, const luabind::detail::function_object&, luabind::detail::invoke_context&, const F&, Signature, const Policies&) [with F = void (*)(float*); Signature = boost::mpl::vector2<void, float*>; Policies = luabind::detail::policy_cons<luabind::detail::pure_out_value_policy<1, luabind::detail::null_type>, luabind::detail::null_type>; lua_State = lua_State]’
./luabind/make_function.hpp:62:15:   required from ‘static int luabind::detail::function_object_impl<F, Signature, Policies>::entry_point(lua_State*) [with F = void (*)(float*); Signature = boost::mpl::vector2<void, float*>; Policies = luabind::detail::policy_cons<luabind::detail::pure_out_value_policy<1, luabind::detail::null_type>, luabind::detail::null_type>; lua_State = lua_State]’
./luabind/make_function.hpp:35:28:   required from ‘luabind::detail::function_object_impl<F, Signature, Policies>::function_object_impl(F, const Policies&) [with F = void (*)(float*); Signature = boost::mpl::vector2<void, float*>; Policies = luabind::detail::policy_cons<luabind::detail::pure_out_value_policy<1, luabind::detail::null_type>, luabind::detail::null_type>]’
./luabind/make_function.hpp:110:5:   required from ‘luabind::adl::object luabind::make_function(lua_State*, F, Signature, Policies) [with F = void (*)(float*); Signature = boost::mpl::vector2<void, float*>; Policies = luabind::detail::policy_cons<luabind::detail::pure_out_value_policy<1, luabind::detail::null_type>, luabind::detail::null_type>; lua_State = lua_State]’
./luabind/function.hpp:28:72:   required from ‘void luabind::detail::function_registration<F, Policies>::register_(lua_State*) const [with F = void (*)(float*); Policies = luabind::detail::policy_cons<luabind::detail::pure_out_value_policy<1, luabind::detail::null_type>, luabind::detail::null_type>; lua_State = lua_State]’
test/test_policies.cpp:226:1:   required from here
./luabind/out_value_policy.hpp:219:4: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
./luabind/out_value_policy.hpp:220:4: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
Fix further aliasing warnings with GCC 4.4

In contrast to GCC 4.7, GCC 4.4 warns about placement new to type-punned pointer.

gcc.compile.c++ test/bin/test_policies.test/gcc-4.4.6/release/link-static/test_policies.o
In file included from ./luabind/function.hpp:8,
                 from ./luabind/class.hpp:94,
                 from ./luabind/luabind.hpp:28,
                 from test/test_policies.cpp:31:
./luabind/out_value_policy.hpp: In static member function ‘static int luabind::detail::function_object_impl<F, Signature, Policies>::entry_point(lua_State*) [with F = void (*)(float*), Signature = boost::mpl::vector2<void, float*>, Policies = luabind::detail::policy_cons<luabind::detail::pure_out_value_policy<1, luabind::detail::null_type>, luabind::detail::null_type>]’:
./luabind/out_value_policy.hpp:234: warning: dereferencing pointer ‘<anonymous>’ does break strict-aliasing rules
./luabind/out_value_policy.hpp:234: note: initialized from here
./luabind/out_value_policy.hpp: In member function ‘int luabind::detail::function_object_impl<F, Signature, Policies>::call(lua_State*, luabind::detail::invoke_context&) const [with F = void (*)(float*), Signature = boost::mpl::vector2<void, float*>, Policies = luabind::detail::policy_cons<luabind::detail::pure_out_value_policy<1, luabind::detail::null_type>, luabind::detail::null_type>]’:
./luabind/out_value_policy.hpp:234: warning: dereferencing pointer ‘<anonymous>’ does break strict-aliasing rules
./luabind/out_value_policy.hpp:234: note: initialized from here
./luabind/out_value_policy.hpp: In static member function ‘static int luabind::detail::function_object_impl<F, Signature, Policies>::entry_point(lua_State*) [with F = void (policies_test_class::*)(int, int*), Signature = boost::mpl::vector4<void, policies_test_class&, int, int*>, Policies = luabind::detail::policy_cons<luabind::detail::pure_out_value_policy<3, luabind::detail::null_type>, luabind::detail::null_type>]’:
./luabind/out_value_policy.hpp:234: warning: dereferencing pointer ‘<anonymous>’ does break strict-aliasing rules
./luabind/out_value_policy.hpp:234: note: initialized from here
./luabind/out_value_policy.hpp: In member function ‘int luabind::detail::function_object_impl<F, Signature, Policies>::call(lua_State*, luabind::detail::invoke_context&) const [with F = void (policies_test_class::*)(int, int*), Signature = boost::mpl::vector4<void, policies_test_class&, int, int*>, Policies = luabind::detail::policy_cons<luabind::detail::pure_out_value_policy<3, luabind::detail::null_type>, luabind::detail::null_type>]’:
./luabind/out_value_policy.hpp:234: warning: dereferencing pointer ‘<anonymous>’ does break strict-aliasing rules
Fix unused variable warnings for self and const_self with GCC.

This warnings may be suppressed by declaring variables as const.

./luabind/operator.hpp:347: warning: ‘luabind::<unnamed>::self’ defined but not used

The explicit initialisation with default constructor is needed for GCC 4.4.

./luabind/operator.hpp:347: error: uninitialized const ‘luabind::<unnamed>::self’
./luabind/operator.hpp:348: error: uninitialized const ‘luabind::<unnamed>::const_self’