Ticket #4476: function.patch

File function.patch, 3.4 KB (added by artyomtnk@…, 12 years ago)
  • boost/function/function_base.hpp

    diff -rupN boost_1_43_0/boost/function/function_base.hpp boost_vms_1_43_0/boost/function/function_base.hpp
    old new public:  
    711711      else return true;
    712712    }
    713713#endif
     714private:
     715  #if defined(__VMS) && __INITIAL_POINTER_SIZE==64
     716  typedef unsigned long long uintptr_type;
     717  #else
     718  typedef std::size_t uintptr_type;
     719  #endif
    714720
    715721public: // should be protected, but GCC 2.95.3 will fail to allow access
    716722  detail::function::vtable_base* get_vtable() const {
    717723    return reinterpret_cast<detail::function::vtable_base*>(
    718              reinterpret_cast<std::size_t>(vtable) & ~(std::size_t)0x01);
     724             reinterpret_cast<uintptr_type>(vtable) & ~(uintptr_type)0x01);
    719725  }
    720726
    721727  bool has_trivial_copy_and_destroy() const {
    722     return reinterpret_cast<std::size_t>(vtable) & 0x01;
     728    return (reinterpret_cast<uintptr_type>(vtable) & 0x01)!=0;
    723729  }
    724730
    725731  detail::function::vtable_base* vtable;
  • boost/function/function_template.hpp

    diff -rupN boost_1_43_0/boost/function/function_template.hpp boost_vms_1_43_0/boost/function/function_template.hpp
    old new namespace boost {  
    674674    typedef boost::detail::function::BOOST_FUNCTION_VTABLE<
    675675              R BOOST_FUNCTION_COMMA BOOST_FUNCTION_TEMPLATE_ARGS>
    676676      vtable_type;
     677    #if defined(__VMS) && __INITIAL_POINTER_SIZE == 64
     678    typedef unsigned long long uintptr_type;
     679    #else
     680    typedef std::size_t uintptr_type;
     681    #endif
    677682
    678683    vtable_type* get_vtable() const {
    679684      return reinterpret_cast<vtable_type*>(
    680                reinterpret_cast<std::size_t>(vtable) & ~(std::size_t)0x01);
     685               reinterpret_cast<uintptr_type>(vtable) & ~(uintptr_type)0x01);
    681686    }
    682687
    683688    struct clear_type {};
    namespace boost {  
    913918        { { &manager_type::manage }, &invoker_type::invoke };
    914919
    915920      if (stored_vtable.assign_to(f, functor)) {
    916         std::size_t value = reinterpret_cast<std::size_t>(&stored_vtable.base);
     921        uintptr_type value = reinterpret_cast<uintptr_type>(&stored_vtable.base);
    917922        if (boost::has_trivial_copy_constructor<Functor>::value &&
    918923            boost::has_trivial_destructor<Functor>::value &&
    919924            detail::function::function_allows_small_object_optimization<Functor>::value)
    920           value |= (std::size_t)0x01;
     925          value |= (uintptr_type)0x01;
    921926        vtable = reinterpret_cast<detail::function::vtable_base *>(value);
    922927      } else
    923928        vtable = 0;
    namespace boost {  
    947952        { { &manager_type::manage }, &invoker_type::invoke };
    948953
    949954      if (stored_vtable.assign_to_a(f, functor, a)) {
    950         std::size_t value = reinterpret_cast<std::size_t>(&stored_vtable.base);
     955        uintptr_type value = reinterpret_cast<uintptr_type>(&stored_vtable.base);
    951956        if (boost::has_trivial_copy_constructor<Functor>::value &&
    952957            boost::has_trivial_destructor<Functor>::value &&
    953958            detail::function::function_allows_small_object_optimization<Functor>::value)
    954           value |= (std::size_t)0x01;
     959          value |= (uintptr_type)0x01;
    955960        vtable = reinterpret_cast<detail::function::vtable_base *>(value);
    956961      } else
    957962        vtable = 0;