Ticket #9886: 0002-multi_array-fix-GCC-Wshadow-warnings.patch

File 0002-multi_array-fix-GCC-Wshadow-warnings.patch, 19.5 KB (added by mstahl@…, 9 years ago)
  • include/boost/multi_array.hpp

    From 0309a36305f68e0d793280f4461844293d5da5e9 Mon Sep 17 00:00:00 2001
    From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
    Date: Mon, 14 Apr 2014 11:40:26 +0200
    Subject: [PATCH 2/4] multi_array: fix GCC -Wshadow warnings
    
    Signed-off-by: Michael Stahl <mstahl@redhat.com>
    ---
     include/boost/multi_array.hpp                 | 24 ++++-----
     include/boost/multi_array/concept_checks.hpp  | 38 ++++++-------
     include/boost/multi_array/extent_range.hpp    |  8 +--
     include/boost/multi_array/index_range.hpp     | 12 ++---
     include/boost/multi_array/multi_array_ref.hpp | 78 +++++++++++++--------------
     include/boost/multi_array/storage_order.hpp   |  8 +--
     include/boost/multi_array/subarray.hpp        |  8 +--
     include/boost/multi_array/view.hpp            |  8 +--
     8 files changed, 92 insertions(+), 92 deletions(-)
    
    diff --git a/include/boost/multi_array.hpp b/include/boost/multi_array.hpp
    index f459ce9..8193699 100644
    a b public:  
    139139
    140140  explicit multi_array() :
    141141    super_type((T*)initial_base_,c_storage_order(),
    142                /*index_bases=*/0, /*extents=*/0) {
     142               /*index_bases=*/0, /*extents_=*/0) {
    143143    allocate_space();
    144144  }
    145145
    146146  template <class ExtentList>
    147147  explicit multi_array(
    148       ExtentList const& extents
     148      ExtentList const& extents_
    149149#ifdef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
    150150      , typename mpl::if_<
    151151      detail::multi_array::is_multi_array_impl<ExtentList>,
    152152      int&,int>::type* = 0
    153153#endif
    154154      ) :
    155     super_type((T*)initial_base_,extents) {
     155    super_type((T*)initial_base_,extents_) {
    156156    boost::function_requires<
    157157      detail::multi_array::CollectionConcept<ExtentList> >();
    158158    allocate_space();
    public:  
    160160
    161161   
    162162  template <class ExtentList>
    163   explicit multi_array(ExtentList const& extents,
     163  explicit multi_array(ExtentList const& extents_,
    164164                       const general_storage_order<NumDims>& so) :
    165     super_type((T*)initial_base_,extents,so) {
     165    super_type((T*)initial_base_,extents_,so) {
    166166    boost::function_requires<
    167167      detail::multi_array::CollectionConcept<ExtentList> >();
    168168    allocate_space();
    169169  }
    170170
    171171  template <class ExtentList>
    172   explicit multi_array(ExtentList const& extents,
     172  explicit multi_array(ExtentList const& extents_,
    173173                       const general_storage_order<NumDims>& so,
    174174                       Allocator const& alloc) :
    175     super_type((T*)initial_base_,extents,so), allocator_(alloc) {
     175    super_type((T*)initial_base_,extents_,so), allocator_(alloc) {
    176176    boost::function_requires<
    177177      detail::multi_array::CollectionConcept<ExtentList> >();
    178178    allocate_space();
    public:  
    381381
    382382
    383383  template <typename ExtentList>
    384   multi_array& resize(const ExtentList& extents) {
     384  multi_array& resize(const ExtentList& extents_) {
    385385    boost::function_requires<
    386386      detail::multi_array::CollectionConcept<ExtentList> >();
    387387
    public:  
    390390
    391391    for (int i=0; i != NumDims; ++i) {
    392392      typedef typename gen_type::range range_type;
    393       ranges.ranges_[i] = range_type(0,extents[i]);
     393      ranges.ranges_[i] = range_type(0,extents_[i]);
    394394    }
    395395   
    396396    return this->resize(ranges);
    public:  
    423423    // Build index_gen objects to create views with the same shape
    424424
    425425    // these need to be separate to handle non-zero index bases
    426     typedef detail::multi_array::index_gen<NumDims,NumDims> index_gen;
    427     index_gen old_idxes;
    428     index_gen new_idxes;
     426    typedef detail::multi_array::index_gen<NumDims,NumDims> lcl_index_gen;
     427    lcl_index_gen old_idxes;
     428    lcl_index_gen new_idxes;
    429429
    430430    std::transform(new_array.index_base_list_.begin(),
    431431                   new_array.index_base_list_.end(),
  • include/boost/multi_array/concept_checks.hpp

    diff --git a/include/boost/multi_array/concept_checks.hpp b/include/boost/multi_array/concept_checks.hpp
    index ea0c1aa..7e5ba5d 100644
    a b namespace detail {  
    3939
    4040    template <typename Array, typename IdxGen, typename Call_Type>
    4141    static void call(Array& a, const IdxGen& idgen, Call_Type c) {
    42       typedef typename Array::index_range index_range;
    43       typedef typename Array::index index;
     42      typedef typename Array::index_range index_range_;
     43      typedef typename Array::index index_;
    4444      idgen_helper<N-1>::call(a,idgen[c],c);
    4545    }
    4646  };
    namespace detail {  
    5050
    5151    template <typename Array, typename IdxGen, typename Call_Type>
    5252    static void call(Array& a, const IdxGen& idgen, Call_Type) {
    53       typedef typename Array::index_range index_range;
    54       typedef typename Array::index index;
     53      typedef typename Array::index_range index_range_;
     54      typedef typename Array::index index_;
    5555      a[ idgen ];
    5656    }
    5757  };
    namespace detail {  
    166166      const_constraints(a);
    167167    }
    168168
    169     void const_constraints(const Array& a) {
     169    void const_constraints(const Array& a_) {
    170170
    171171      //      value_type vt = a[ id ];
    172172
    173173      // Test slicing, keeping only the first dimension, losing the rest
    174       detail::idgen_helper<NumDims-1>::call(a,idgen[range],id);
     174      detail::idgen_helper<NumDims-1>::call(a_,idgen[range],id);
    175175
    176176      // Test slicing, keeping all dimensions.
    177       detail::idgen_helper<NumDims-1>::call(a,idgen[range],range);
    178 
    179       st = a.size();
    180       st = a.num_dimensions();
    181       st = a.num_elements();
    182       stp = a.shape();
    183       idp = a.strides();
    184       idp = a.index_bases();
    185       cit = a.begin();
    186       cit = a.end();
    187       crit = a.rbegin();
    188       crit = a.rend();
    189       eltp = a.origin();
     177      detail::idgen_helper<NumDims-1>::call(a_,idgen[range],range);
     178
     179      st = a_.size();
     180      st = a_.num_dimensions();
     181      st = a_.num_elements();
     182      stp = a_.shape();
     183      idp = a_.strides();
     184      idp = a_.index_bases();
     185      cit = a_.begin();
     186      cit = a_.end();
     187      crit = a_.rbegin();
     188      crit = a_.rend();
     189      eltp = a_.origin();
    190190    }
    191191
    192192    typedef typename Array::value_type value_type;
  • include/boost/multi_array/extent_range.hpp

    diff --git a/include/boost/multi_array/extent_range.hpp b/include/boost/multi_array/extent_range.hpp
    index d7a2eaf..b6d7706 100644
    a b public:  
    2626  typedef Extent index;
    2727  typedef SizeType size_type;
    2828
    29   extent_range(index start, index finish) :
    30     super_type(start,finish) { }
     29  extent_range(index start_, index finish_) :
     30    super_type(start_,finish_) { }
    3131
    32   extent_range(index finish) :
    33     super_type(0,finish) { }
     32  extent_range(index finish_) :
     33    super_type(0,finish_) { }
    3434
    3535  extent_range() : super_type(0,0) { }
    3636
  • include/boost/multi_array/index_range.hpp

    diff --git a/include/boost/multi_array/index_range.hpp b/include/boost/multi_array/index_range.hpp
    index 3d6035e..42cd351 100644
    a b namespace multi_array {  
    6060      degenerate_ = true;
    6161    }
    6262
    63     explicit index_range(index start, index finish, index stride=1)
    64       : start_(start), finish_(finish), stride_(stride),
     63    explicit index_range(index i_start, index i_finish, index i_stride=1)
     64      : start_(i_start), finish_(i_finish), stride_(i_stride),
    6565        degenerate_(false)
    6666    { }
    6767
    namespace multi_array {  
    107107
    108108    index stride() const { return stride_; }
    109109
    110     void set_index_range(index start, index finish, index stride=1)
     110    void set_index_range(index i_start, index i_finish, index i_stride=1)
    111111    {
    112       start_ = start;
    113       finish_ = finish;
    114       stride_ = stride;
     112      start_ = i_start;
     113      finish_ = i_finish;
     114      stride_ = i_stride;
    115115    }
    116116
    117117    static index_range all()
  • include/boost/multi_array/multi_array_ref.hpp

    diff --git a/include/boost/multi_array/multi_array_ref.hpp b/include/boost/multi_array/multi_array_ref.hpp
    index 92e8fb4..511c816 100644
    a b public:  
    8787      num_elements_(other.num_elements_)  {  }
    8888
    8989  template <typename ExtentList>
    90   explicit const_multi_array_ref(TPtr base, const ExtentList& extents) :
     90  explicit const_multi_array_ref(TPtr base, const ExtentList& extents_) :
    9191    base_(base), storage_(c_storage_order()) {
    9292    boost::function_requires<
    9393      CollectionConcept<ExtentList> >();
    9494
    9595    index_base_list_.assign(0);
    96     init_multi_array_ref(extents.begin());
     96    init_multi_array_ref(extents_.begin());
    9797  }
    9898 
    9999  template <typename ExtentList>
    100   explicit const_multi_array_ref(TPtr base, const ExtentList& extents,
     100  explicit const_multi_array_ref(TPtr base, const ExtentList& extents_,
    101101                       const general_storage_order<NumDims>& so) :
    102102    base_(base), storage_(so) {
    103103    boost::function_requires<
    104104      CollectionConcept<ExtentList> >();
    105105
    106106    index_base_list_.assign(0);
    107     init_multi_array_ref(extents.begin());
     107    init_multi_array_ref(extents_.begin());
    108108  }
    109109 
    110110  explicit const_multi_array_ref(TPtr base,
    public:  
    125125  }
    126126 
    127127  template <class InputIterator>
    128   void assign(InputIterator begin, InputIterator end) {
     128  void assign(InputIterator begin_, InputIterator end_) {
    129129    boost::function_requires<InputIteratorConcept<InputIterator> >();
    130130
    131     InputIterator in_iter = begin;
     131    InputIterator in_iter = begin_;
    132132    T* out_iter = base_;
    133133    std::size_t copy_count=0;
    134     while (in_iter != end && copy_count < num_elements_) {
     134    while (in_iter != end_ && copy_count < num_elements_) {
    135135      *out_iter++ = *in_iter++;
    136136      copy_count++;     
    137137    }
    public:  
    162162  }
    163163
    164164  template <typename SizeList>
    165   void reshape(const SizeList& extents) {
     165  void reshape(const SizeList& extents_) {
    166166    boost::function_requires<
    167167      CollectionConcept<SizeList> >();
    168168    BOOST_ASSERT(num_elements_ ==
    169                  std::accumulate(extents.begin(),extents.end(),
     169                 std::accumulate(extents_.begin(),extents_.end(),
    170170                                 size_type(1),std::multiplies<size_type>()));
    171171
    172     std::copy(extents.begin(),extents.end(),extent_list_.begin());
     172    std::copy(extents_.begin(),extents_.end(),extent_list_.begin());
    173173    this->compute_strides(stride_list_,extent_list_,storage_);
    174174
    175175    origin_offset_ =
    public:  
    209209  }
    210210
    211211  template <typename IndexList>
    212   const element& operator()(IndexList indices) const {
     212  const element& operator()(IndexList indices_) const {
    213213    boost::function_requires<
    214214      CollectionConcept<IndexList> >();
    215215    return super_type::access_element(boost::type<const element&>(),
    216                                       indices,origin(),
     216                                      indices_,origin(),
    217217                                      shape(),strides(),index_bases());
    218218  }
    219219
    public:  
    232232#endif // BOOST_MSVC
    233233  typename const_array_view<NDims>::type
    234234  operator[](const detail::multi_array::
    235              index_gen<NumDims,NDims>& indices)
     235             index_gen<NumDims,NDims>& indices_)
    236236    const {
    237237    typedef typename const_array_view<NDims>::type return_type;
    238238    return
    239239      super_type::generate_array_view(boost::type<return_type>(),
    240                                       indices,
     240                                      indices_,
    241241                                      shape(),
    242242                                      strides(),
    243243                                      index_bases(),
    public:  
    328328  explicit
    329329  const_multi_array_ref(TPtr base,
    330330                        const storage_order_type& so,
    331                         const index * index_bases,
    332                         const size_type* extents) :
     331                        const index * index_bases_,
     332                        const size_type* extents_) :
    333333    base_(base), storage_(so), origin_offset_(0), directional_offset_(0)
    334334 {
    335    // If index_bases or extents is null, then initialize the corresponding
     335   // If index_bases_ or extents_ is null, then initialize the corresponding
    336336   // private data to zeroed lists.
    337    if(index_bases) {
     337   if(index_bases_) {
    338338     boost::detail::multi_array::
    339        copy_n(index_bases,NumDims,index_base_list_.begin());
     339       copy_n(index_bases_,NumDims,index_base_list_.begin());
    340340   } else {
    341341     std::fill_n(index_base_list_.begin(),NumDims,0);
    342342   }
    343    if(extents) {
    344      init_multi_array_ref(extents);
     343   if(extents_) {
     344     init_multi_array_ref(extents_);
    345345   } else {
    346346     boost::array<index,NumDims> extent_list;
    347347     extent_list.assign(0);
    private:  
    375375              boost::mem_fun_ref(&extent_range::start));
    376376
    377377    // calculate the extents
    378     extent_list extents;
     378    extent_list extents_;
    379379    std::transform(ranges.ranges_.begin(),ranges.ranges_.end(),
    380               extents.begin(),
     380              extents_.begin(),
    381381              boost::mem_fun_ref(&extent_range::size));
    382382
    383     init_multi_array_ref(extents.begin());
     383    init_multi_array_ref(extents_.begin());
    384384  }
    385385
    386386
    public:  
    446446  };
    447447
    448448  template <class ExtentList>
    449   explicit multi_array_ref(T* base, const ExtentList& extents) :
    450     super_type(base,extents) {
     449  explicit multi_array_ref(T* base, const ExtentList& extents_) :
     450    super_type(base,extents_) {
    451451    boost::function_requires<
    452452      CollectionConcept<ExtentList> >();
    453453  }
    454454
    455455  template <class ExtentList>
    456   explicit multi_array_ref(T* base, const ExtentList& extents,
     456  explicit multi_array_ref(T* base, const ExtentList& extents_,
    457457                           const general_storage_order<NumDims>& so) :
    458     super_type(base,extents,so) {
     458    super_type(base,extents_,so) {
    459459    boost::function_requires<
    460460      CollectionConcept<ExtentList> >();
    461461  }
    public:  
    510510  element* data() { return super_type::base_; }
    511511
    512512  template <class IndexList>
    513   element& operator()(const IndexList& indices) {
     513  element& operator()(const IndexList& indices_) {
    514514    boost::function_requires<
    515515      CollectionConcept<IndexList> >();
    516516    return super_type::access_element(boost::type<element&>(),
    517                                       indices,origin(),
     517                                      indices_,origin(),
    518518                                      this->shape(),this->strides(),
    519519                                      this->index_bases());
    520520  }
    public:  
    536536#endif // BOOST_MSVC
    537537  typename array_view<NDims>::type
    538538  operator[](const detail::multi_array::
    539              index_gen<NumDims,NDims>& indices) {
     539             index_gen<NumDims,NDims>& indices_) {
    540540    typedef typename array_view<NDims>::type return_type;
    541541    return
    542542      super_type::generate_array_view(boost::type<return_type>(),
    543                                       indices,
     543                                      indices_,
    544544                                      this->shape(),
    545545                                      this->strides(),
    546546                                      this->index_bases(),
    public:  
    577577  const element* data() const { return super_type::data(); }
    578578
    579579  template <class IndexList>
    580   const element& operator()(const IndexList& indices) const {
     580  const element& operator()(const IndexList& indices_) const {
    581581    boost::function_requires<
    582582      CollectionConcept<IndexList> >();
    583     return super_type::operator()(indices);
     583    return super_type::operator()(indices_);
    584584  }
    585585
    586586  const_reference operator[](index idx) const {
    public:  
    598598#endif // BOOST_MSVC
    599599  typename const_array_view<NDims>::type
    600600  operator[](const detail::multi_array::
    601              index_gen<NumDims,NDims>& indices)
     601             index_gen<NumDims,NDims>& indices_)
    602602    const {
    603     return super_type::operator[](indices);
     603    return super_type::operator[](indices_);
    604604  }
    605605 
    606606  const_iterator begin() const {
    protected:  
    623623  // This is only supplied to support multi_array's default constructor
    624624  explicit multi_array_ref(T* base,
    625625                           const storage_order_type& so,
    626                            const index* index_bases,
    627                            const size_type* extents) :
    628     super_type(base,so,index_bases,extents) { }
     626                           const index* index_bases_,
     627                           const size_type* extents_) :
     628    super_type(base,so,index_bases_,extents_) { }
    629629
    630630};
    631631
  • include/boost/multi_array/storage_order.hpp

    diff --git a/include/boost/multi_array/storage_order.hpp b/include/boost/multi_array/storage_order.hpp
    index 3eb7136..219f24d 100644
    a b namespace boost {  
    3434  public:
    3535    typedef detail::multi_array::size_type size_type;
    3636    template <typename OrderingIter, typename AscendingIter>
    37     general_storage_order(OrderingIter ordering,
    38                           AscendingIter ascending) {
    39       boost::detail::multi_array::copy_n(ordering,NumDims,ordering_.begin());
    40       boost::detail::multi_array::copy_n(ascending,NumDims,ascending_.begin());
     37    general_storage_order(OrderingIter i_ordering,
     38                          AscendingIter i_ascending) {
     39      boost::detail::multi_array::copy_n(i_ordering,NumDims,ordering_.begin());
     40      boost::detail::multi_array::copy_n(i_ascending,NumDims,ascending_.begin());
    4141    }
    4242
    4343    // RG - ideally these would not be necessary, but some compilers
  • include/boost/multi_array/subarray.hpp

    diff --git a/include/boost/multi_array/subarray.hpp b/include/boost/multi_array/subarray.hpp
    index a498916..cc8b7f4 100644
    a b public: // Should be protected  
    181181
    182182  const_sub_array (TPtr base,
    183183                 const size_type* extents,
    184                  const index* strides,
     184                 const index* i_strides,
    185185                 const index* index_base) :
    186     base_(base), extents_(extents), strides_(strides),
     186    base_(base), extents_(extents), strides_(i_strides),
    187187    index_base_(index_base) {
    188188  }
    189189
    public: // should be private  
    369369
    370370  sub_array (T* base,
    371371            const size_type* extents,
    372             const index* strides,
     372            const index* _strides,
    373373            const index* index_base) :
    374     super_type(base,extents,strides,index_base) {
     374    super_type(base,extents,_strides,index_base) {
    375375  }
    376376
    377377};
  • include/boost/multi_array/view.hpp

    diff --git a/include/boost/multi_array/view.hpp b/include/boost/multi_array/view.hpp
    index d11e260..2f692a8 100644
    a b public: // should be protected  
    232232  template <typename ExtentList, typename Index>
    233233  explicit const_multi_array_view(TPtr base,
    234234                           const ExtentList& extents,
    235                            const boost::array<Index,NumDims>& strides):
     235                           const boost::array<Index,NumDims>& strides_):
    236236    base_(base), origin_offset_(0) {
    237237
    238238    index_base_list_.assign(0);
    public: // should be protected  
    241241    boost::detail::multi_array::
    242242      copy_n(extents.begin(),NumDims,extent_list_.begin());
    243243    boost::detail::multi_array::
    244       copy_n(strides.begin(),NumDims,stride_list_.begin());
     244      copy_n(strides_.begin(),NumDims,stride_list_.begin());
    245245
    246246    // Calculate the array size
    247247    num_elements_ = std::accumulate(extent_list_.begin(),extent_list_.end(),
    public: // should be private  
    442442  template <typename ExtentList, typename Index>
    443443  explicit multi_array_view(T* base,
    444444                            const ExtentList& extents,
    445                             const boost::array<Index,NumDims>& strides) :
    446     super_type(base,extents,strides) { }
     445                            const boost::array<Index,NumDims>& _strides) :
     446    super_type(base,extents,_strides) { }
    447447
    448448};
    449449