diff options
author | dnovillo <dnovillo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-09-04 18:33:29 +0000 |
---|---|---|
committer | dnovillo <dnovillo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-09-04 18:33:29 +0000 |
commit | b3c9def6350231a8e1c80616c2430e6b71037d63 (patch) | |
tree | ab7c738ac77989266c4eb6d97a4cfac854185de7 /gcc/vec.h | |
parent | eae726e9e188dae97f8baaed76a408e8f1567e85 (diff) | |
download | gcc-b3c9def6350231a8e1c80616c2430e6b71037d63.tar.gz |
This patch works around a parsing problem with g++ 4.3. The parser is
failing to lookup calls to the template function reserve when called
from other member functions:
vec_t<T>::reserve<A> (...)
The parser thinks that the '<' in reserve<A> is a less-than operation.
This problem does not happen after 4.3.
This code is going to change significantly, so this won't be needed
soon.
Tested on x86_64 with g++ 4.3 and g++ 4.6.
PR bootstrap/54478
* vec.h (vec_t::alloc): Remove explicit type specification
in call to reserve.
(vec_t::copy): Likewise.
(vec_t::reserve): Likewise.
(vec_t::reserve_exact): Likewise.
(vec_t::safe_splice): Likewise.
(vec_t::safe_push): Likewise.
(vec_t::safe_grow): Likewise.
(vec_t::safe_grow_cleared): Likewise.
(vec_t::safe_insert): Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@190943 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/vec.h')
-rw-r--r-- | gcc/vec.h | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/gcc/vec.h b/gcc/vec.h index ac426e9a417..c0f1bb2cd21 100644 --- a/gcc/vec.h +++ b/gcc/vec.h @@ -655,7 +655,7 @@ template<enum vec_allocation_t A> vec_t<T> * vec_t<T>::alloc (int nelems MEM_STAT_DECL) { - return vec_t<T>::reserve_exact<A> ((vec_t<T> *) NULL, nelems PASS_MEM_STAT); + return reserve_exact<A> ((vec_t<T> *) NULL, nelems PASS_MEM_STAT); } template<typename T> @@ -699,8 +699,8 @@ vec_t<T>::copy (ALONE_MEM_STAT_DECL) if (len) { - new_vec = vec_t<T>::reserve_exact<A> (static_cast<vec_t<T> *> (NULL), - len PASS_MEM_STAT); + new_vec = reserve_exact<A> (static_cast<vec_t<T> *> (NULL), + len PASS_MEM_STAT); new_vec->embedded_init (len, len); memcpy (new_vec->address (), vec_, sizeof (T) * len); } @@ -736,7 +736,7 @@ vec_t<T>::reserve (vec_t<T> **vec, int nelems VEC_CHECK_DECL MEM_STAT_DECL) bool extend = (*vec) ? !(*vec)->space (nelems VEC_CHECK_PASS) : nelems != 0; if (extend) - *vec = vec_t<T>::reserve<A> (*vec, nelems PASS_MEM_STAT); + *vec = reserve<A> (*vec, nelems PASS_MEM_STAT); return extend; } @@ -755,7 +755,7 @@ vec_t<T>::reserve_exact (vec_t<T> **vec, int nelems VEC_CHECK_DECL bool extend = (*vec) ? !(*vec)->space (nelems VEC_CHECK_PASS) : nelems != 0; if (extend) - *vec = vec_t<T>::reserve_exact<A> (*vec, nelems PASS_MEM_STAT); + *vec = reserve_exact<A> (*vec, nelems PASS_MEM_STAT); return extend; } @@ -796,8 +796,7 @@ vec_t<T>::safe_splice (vec_t<T> **dst, vec_t<T> *src VEC_CHECK_DECL { if (src) { - vec_t<T>::reserve_exact<A> (dst, VEC_length (T, src) VEC_CHECK_PASS - MEM_STAT_INFO); + reserve_exact<A> (dst, VEC_length (T, src) VEC_CHECK_PASS MEM_STAT_INFO); (*dst)->splice (src VEC_CHECK_PASS); } } @@ -843,7 +842,7 @@ template<enum vec_allocation_t A> T & vec_t<T>::safe_push (vec_t<T> **vec, T obj VEC_CHECK_DECL MEM_STAT_DECL) { - vec_t<T>::reserve<A> (vec, 1 VEC_CHECK_PASS PASS_MEM_STAT); + reserve<A> (vec, 1 VEC_CHECK_PASS PASS_MEM_STAT); return (*vec)->quick_push (obj VEC_CHECK_PASS); } @@ -858,7 +857,7 @@ template<enum vec_allocation_t A> T * vec_t<T>::safe_push (vec_t<T> **vec, const T *ptr VEC_CHECK_DECL MEM_STAT_DECL) { - vec_t<T>::reserve<A> (vec, 1 VEC_CHECK_PASS PASS_MEM_STAT); + reserve<A> (vec, 1 VEC_CHECK_PASS PASS_MEM_STAT); return (*vec)->quick_push (ptr VEC_CHECK_PASS); } @@ -898,8 +897,8 @@ vec_t<T>::safe_grow (vec_t<T> **vec, int size VEC_CHECK_DECL MEM_STAT_DECL) { VEC_ASSERT (size >= 0 && VEC_length (T, *vec) <= (unsigned)size, "grow", T, A); - vec_t<T>::reserve_exact<A> (vec, size - (int)VEC_length (T, *vec) - VEC_CHECK_PASS PASS_MEM_STAT); + reserve_exact<A> (vec, size - (int)VEC_length (T, *vec) + VEC_CHECK_PASS PASS_MEM_STAT); (*vec)->prefix_.num_ = size; } @@ -915,7 +914,7 @@ vec_t<T>::safe_grow_cleared (vec_t<T> **vec, int size VEC_CHECK_DECL MEM_STAT_DECL) { int oldsize = VEC_length (T, *vec); - vec_t<T>::safe_grow<A> (vec, size VEC_CHECK_PASS PASS_MEM_STAT); + safe_grow<A> (vec, size VEC_CHECK_PASS PASS_MEM_STAT); memset (&((*vec)->address ()[oldsize]), 0, sizeof (T) * (size - oldsize)); } @@ -972,7 +971,7 @@ void vec_t<T>::safe_insert (vec_t<T> **vec, unsigned ix, T obj VEC_CHECK_DECL MEM_STAT_DECL) { - vec_t<T>::reserve<A> (vec, 1 VEC_CHECK_PASS PASS_MEM_STAT); + reserve<A> (vec, 1 VEC_CHECK_PASS PASS_MEM_STAT); (*vec)->quick_insert (ix, obj VEC_CHECK_PASS); } @@ -988,7 +987,7 @@ void vec_t<T>::safe_insert (vec_t<T> **vec, unsigned ix, T *ptr VEC_CHECK_DECL MEM_STAT_DECL) { - vec_t<T>::reserve<A> (vec, 1 VEC_CHECK_PASS PASS_MEM_STAT); + reserve<A> (vec, 1 VEC_CHECK_PASS PASS_MEM_STAT); (*vec)->quick_insert (ix, ptr VEC_CHECK_PASS); } |