Ticket #4297: boost_interprocess_2.patch

File boost_interprocess_2.patch, 12.6 KB (added by Lénaïc Huard <lhuard@…>, 12 years ago)

Patch fixing the warnings: enumeral and non-enumeral type in conditional expression

  • boost/interprocess/mem_algo/detail/multi_simple_seq_fit_impl.hpp

     
    218218   /*!Makes a new memory portion available for allocation*/
    219219   void priv_add_segment(void *addr, std::size_t size);
    220220
    221    enum { Alignment      = boost::alignment_of<boost::detail::max_align>::value  };
    222    enum { BlockCtrlBytes = detail::ct_rounded_size<sizeof(block_ctrl), Alignment>::value  };
    223    enum { BlockCtrlSize  = BlockCtrlBytes/Alignment   };
    224    enum { MinBlockSize   = BlockCtrlSize + Alignment  };
     221   BOOST_STATIC_CONSTANT(std::size_t, Alignment      = boost::alignment_of<boost::detail::max_align>::value);
     222   BOOST_STATIC_CONSTANT(std::size_t, BlockCtrlBytes = detail::ct_rounded_size<sizeof(block_ctrl), Alignment>::value);
     223   BOOST_STATIC_CONSTANT(std::size_t, BlockCtrlSize  = BlockCtrlBytes/Alignment);
     224   BOOST_STATIC_CONSTANT(std::size_t, MinBlockSize   = BlockCtrlSize + Alignment);
    225225
    226226   public:
    227    enum {   PayloadPerAllocation = BlockCtrlBytes  };
     227   BOOST_STATIC_CONSTANT(std::size_t, PayloadPerAllocation = BlockCtrlBytes);
    228228};
    229229
    230230template<class MutexFamily, class VoidPointer>
  • boost/interprocess/indexes/iset_index.hpp

     
    138138struct is_intrusive_index
    139139   <boost::interprocess::iset_index<MapConfig> >
    140140{
    141    enum{ value = true };
     141   BOOST_STATIC_CONSTANT(bool, value = true);
    142142};
    143143/// @endcond
    144144
  • boost/interprocess/indexes/unordered_map_index.hpp

     
    102102struct is_node_index
    103103   <boost::interprocess::unordered_map_index<MapConfig> >
    104104{
    105    enum {   value = true };
     105   BOOST_STATIC_CONSTANT(bool, value = true);
    106106};
    107107/// @endcond
    108108
  • boost/interprocess/indexes/iunordered_set_index.hpp

     
    155155   typedef typename index_aux::
    156156      segment_manager_base             segment_manager_base;
    157157
    158    enum {   InitBufferSize = 64};
    159 
    160158   static bucket_ptr create_buckets(allocator_type &alloc, std::size_t num)
    161159   {
    162160      num = index_type::suggested_upper_bucket_count(num);
     
    356354struct is_intrusive_index
    357355   <boost::interprocess::iunordered_set_index<MapConfig> >
    358356{
    359    enum{ value = true };
     357   BOOST_STATIC_CONSTANT(bool, value = true);
    360358};
    361359/// @endcond
    362360
  • boost/interprocess/indexes/map_index.hpp

     
    8989struct is_node_index
    9090   <boost::interprocess::map_index<MapConfig> >
    9191{
    92    enum {   value = true };
     92   BOOST_STATIC_CONSTANT(bool, value = true);
    9393};
    9494/// @endcond
    9595
  • boost/interprocess/offset_ptr.hpp

     
    371371template <class T>
    372372struct has_trivial_constructor< boost::interprocess::offset_ptr<T> >
    373373{
    374    enum { value = true };
     374   BOOST_STATIC_CONSTANT(bool, value = true);
    375375};
    376376
    377377///has_trivial_destructor<> == true_type specialization for optimizations
    378378template <class T>
    379379struct has_trivial_destructor< boost::interprocess::offset_ptr<T> >
    380380{
    381    enum { value = true };
     381   BOOST_STATIC_CONSTANT(bool, value = true);
    382382};
    383383
    384384//#if !defined(_MSC_VER) || (_MSC_VER >= 1400)
  • boost/interprocess/detail/segment_manager_helper.hpp

     
    271271
    272272   intrusive_value_type_impl(){}
    273273
    274    enum  {  BlockHdrAlignment = detail::alignment_of<block_header>::value  };
     274   BOOST_STATIC_CONSTANT(std::size_t, BlockHdrAlignment = detail::alignment_of<block_header>::value);
    275275
    276276   block_header *get_block_header() const
    277277   {
  • boost/interprocess/detail/move.hpp

     
    6969   static false_t dispatch(...);
    7070   static T trigger();
    7171   public:
    72    enum { value = sizeof(dispatch(trigger())) == sizeof(true_t) };
     72   BOOST_STATIC_CONSTANT(bool, value = sizeof(dispatch(trigger())) == sizeof(true_t));
    7373};
    7474
    7575}  //namespace move_detail {
  • boost/interprocess/detail/type_traits.hpp

     
    4242template <unsigned A, unsigned S>
    4343struct alignment_logic
    4444{
    45     enum{   value = A < S ? A : S  };
     45    BOOST_STATIC_CONSTANT(std::size_t, value = A < S ? A : S);
    4646};
    4747
    4848template< typename T >
    4949struct alignment_of
    5050{
    51    enum{ value = alignment_logic
     51   BOOST_STATIC_CONSTANT(std::size_t, value = (alignment_logic
    5252            < sizeof(alignment_of_hack<T>) - sizeof(T)
    53             , sizeof(T)>::value   };
     53            , sizeof(T)>::value));
    5454};
    5555
    5656//This is not standard, but should work with all compilers
     
    8484template<class T>
    8585struct is_reference
    8686{
    87    enum {  value = false   };
     87   BOOST_STATIC_CONSTANT(bool, value = false);
    8888};
    8989
    9090template<class T>
    9191struct is_reference<T&>
    9292{
    93    enum {  value = true   };
     93   BOOST_STATIC_CONSTANT(bool, value = true);
    9494};
    9595
    9696template<class T>
    9797struct is_pointer
    9898{
    99    enum {  value = false   };
     99   BOOST_STATIC_CONSTANT(bool, value = false);
    100100};
    101101
    102102template<class T>
    103103struct is_pointer<T*>
    104104{
    105    enum {  value = true   };
     105   BOOST_STATIC_CONSTANT(bool, value = true);
    106106};
    107107
    108108template <typename T>
  • boost/interprocess/detail/utilities.hpp

     
    9696template <std::size_t OrigSize, std::size_t RoundTo>
    9797struct ct_rounded_size
    9898{
    99    enum { value = ((OrigSize-1)/RoundTo+1)*RoundTo };
     99   BOOST_STATIC_CONSTANT(std::size_t, value = ((OrigSize-1)/RoundTo+1)*RoundTo);
    100100};
    101101
    102102// Gennaro Prota wrote this. Thanks!
    103103template <int p, int n = 4>
    104104struct ct_max_pow2_less
    105105{
    106    enum { c = 2*n < p };
     106   BOOST_STATIC_CONSTANT(bool, c = 2*n < p);
    107107
    108    static const std::size_t value =
    109          c ? (ct_max_pow2_less< c*p, 2*c*n>::value) : n;
     108   BOOST_STATIC_CONSTANT(std::size_t, value =
     109         c ? (ct_max_pow2_less< c*p, 2*c*n>::value) : n);
    110110};
    111111
    112112template <>
    113113struct ct_max_pow2_less<0, 0>
    114114{
    115    static const std::size_t value = 0;
     115   BOOST_STATIC_CONSTANT(std::size_t, value = 0);
    116116};
    117117
    118118}  //namespace detail {
     
    123123template <class Index>
    124124struct is_node_index
    125125{
    126    enum {   value = false };
     126   BOOST_STATIC_CONSTANT(bool, value = false);
    127127};
    128128
    129129//!Trait class to detect if an index is an intrusive
     
    133133template <class Index>
    134134struct is_intrusive_index
    135135{
    136    enum {   value = false };
     136   BOOST_STATIC_CONSTANT(bool, value = false);
    137137};
    138138
    139139template <typename T> T*
  • boost/interprocess/detail/mpl.hpp

     
    7171   static false_t dispatch(...);
    7272   static T trigger();
    7373   public:
    74    enum { value = sizeof(dispatch(trigger())) == sizeof(true_t) };
     74   BOOST_STATIC_CONSTANT(bool, value = sizeof(dispatch(trigger())) == sizeof(true_t));
    7575};
    7676
    7777template<
  • boost/interprocess/allocators/detail/allocator_common.hpp

     
    546546   typedef typename base_t::value_type                   value_type;
    547547
    548548   public:
    549    enum { DEFAULT_MAX_CACHED_NODES = 64 };
     549   BOOST_STATIC_CONSTANT(std::size_t, DEFAULT_MAX_CACHED_NODES = 64);
    550550
    551551   cached_allocator_impl(segment_manager *segment_mngr, std::size_t max_cached_nodes)
    552552      : m_cache(segment_mngr, max_cached_nodes)
  • boost/interprocess/allocators/allocator.hpp

     
    293293struct has_trivial_destructor
    294294   <boost::interprocess::allocator <T, SegmentManager> >
    295295{
    296    enum { value = true };
     296   BOOST_STATIC_CONSTANT(bool, value = true);
    297297};
    298298/// @endcond
    299299
  • boost/interprocess/containers/container/detail/type_traits.hpp

     
    4242template <unsigned A, unsigned S>
    4343struct alignment_logic
    4444{
    45     enum{   value = A < S ? A : S  };
     45    BOOST_STATIC_CONSTANT(std::size_t, value = A < S ? A : S);
    4646};
    4747
    4848template< typename T >
    4949struct alignment_of
    5050{
    51    enum{ value = alignment_logic
     51   BOOST_STATIC_CONSTANT(std::size_t, value = (alignment_logic
    5252            < sizeof(alignment_of_hack<T>) - sizeof(T)
    53             , sizeof(T)>::value   };
     53            , sizeof(T)>::value));
    5454};
    5555
    5656//This is not standard, but should work with all compilers
     
    8484template<class T>
    8585struct is_reference
    8686{
    87    enum {  value = false   };
     87   BOOST_STATIC_CONSTANT(bool, value = false);
    8888};
    8989
    9090template<class T>
    9191struct is_reference<T&>
    9292{
    93    enum {  value = true   };
     93   BOOST_STATIC_CONSTANT(bool, value = true);
    9494};
    9595
    9696template<class T>
    9797struct is_pointer
    9898{
    99    enum {  value = false   };
     99   BOOST_STATIC_CONSTANT(bool, value = false);
    100100};
    101101
    102102template<class T>
    103103struct is_pointer<T*>
    104104{
    105    enum {  value = true   };
     105   BOOST_STATIC_CONSTANT(bool, value = true);
    106106};
    107107
    108108template <typename T>
  • boost/interprocess/containers/container/detail/utilities.hpp

     
    9393template <std::size_t OrigSize, std::size_t RoundTo>
    9494struct ct_rounded_size
    9595{
    96    enum { value = ((OrigSize-1)/RoundTo+1)*RoundTo };
     96   BOOST_STATIC_CONSTANT(std::size_t, value = ((OrigSize-1)/RoundTo+1)*RoundTo);
    9797};
    9898
    9999template<class T>
  • boost/interprocess/containers/container/detail/mpl.hpp

     
    7171   static false_t dispatch(...);
    7272   static T trigger();
    7373   public:
    74    enum { value = sizeof(dispatch(trigger())) == sizeof(true_t) };
     74   BOOST_STATIC_CONSTANT(bool, value = sizeof(dispatch(trigger())) == sizeof(true_t));
    7575};
    7676
    7777template<
  • boost/interprocess/containers/container/deque.hpp

     
    455455         this->priv_deallocate_node(*n);
    456456   }
    457457
    458    enum { InitialMapSize = 8 };
     458   BOOST_STATIC_CONSTANT(std::size_t, InitialMapSize = 8);
    459459
    460460   protected:
    461461   struct members_holder
     
    15091509template <class T, class A>
    15101510struct has_trivial_destructor_after_move<boost::container::deque<T, A> >
    15111511{
    1512    enum {   value = has_trivial_destructor<A>::value  };
     1512   BOOST_STATIC_CONSTANT(bool, value = has_trivial_destructor<A>::value);
    15131513};
    15141514*/
    15151515}