aboutsummaryrefslogtreecommitdiff
path: root/gcc/vec.c
diff options
context:
space:
mode:
authorDiego Novillo <dnovillo@google.com>2012-11-20 11:26:09 -0500
committerDiego Novillo <dnovillo@gcc.gnu.org>2012-11-20 11:26:09 -0500
commit38f2ca3298e1f8b85b29c67ba8a5667fe257464b (patch)
treec6eacf875d89904de020dba161a8e1c743b4f46f /gcc/vec.c
parent4a397c3e09d7909f4585b864da9660544d8349f3 (diff)
downloadgcc-38f2ca3298e1f8b85b29c67ba8a5667fe257464b.zip
gcc-38f2ca3298e1f8b85b29c67ba8a5667fe257464b.tar.gz
gcc-38f2ca3298e1f8b85b29c67ba8a5667fe257464b.tar.bz2
Convert vec<> into a POD.
This fixes PR 55398 by making vec<> a true POD. I thought we could get away with having private fields, but we can't. We fail to pass vec<> instances through varargs. The patch makes every field public and mangles the field names in the hope that no future patch will try to make use of them directly. It's horrible, but I could not think of anything better. Tested with clang++ as the host compiler. 2012-11-20 Diego Novillo <dnovillo@google.com> PR middle-end/55398 * vec.h (class vec_prefix): Make every field public. Rename field alloc_ to alloc_PRIVATE_. Rename field num_ to num_PRIVATE_. Update all users. (class vec<T, A, vl_embed>): Make every field public. Rename field pfx_ to pfx_PRIVATE_. Rename field data_ to data_PRIVATE_. Update all users. (class vec<T, A, vl_ptr>): Make every field public. Rename field vec_ to vec_PRIVATE_. Update all users. From-SVN: r193667
Diffstat (limited to 'gcc/vec.c')
-rw-r--r--gcc/vec.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/gcc/vec.c b/gcc/vec.c
index b213aba..3f8f550 100644
--- a/gcc/vec.c
+++ b/gcc/vec.c
@@ -121,8 +121,8 @@ vec_descriptor (const char *name, int line, const char *function)
/* Account the overhead. */
void
-vec_prefix::register_overhead (size_t size, const char *name, int line,
- const char *function)
+vec_prefix::register_overhead_PRIVATE_ (size_t size, const char *name, int line,
+ const char *function)
{
struct vec_descriptor *loc = vec_descriptor (name, line, function);
struct ptr_hash_entry *p = XNEW (struct ptr_hash_entry);
@@ -148,7 +148,7 @@ vec_prefix::register_overhead (size_t size, const char *name, int line,
/* Notice that the memory allocated for the vector has been freed. */
void
-vec_prefix::release_overhead (void)
+vec_prefix::release_overhead_PRIVATE_ (void)
{
PTR *slot = htab_find_slot_with_hash (ptr_hash, this,
htab_hash_pointer (this),
@@ -165,15 +165,16 @@ vec_prefix::release_overhead (void)
exponentially. PFX is the control data for the vector. */
unsigned
-vec_prefix::calculate_allocation (vec_prefix *pfx, unsigned reserve, bool exact)
+vec_prefix::calculate_allocation_PRIVATE_ (vec_prefix *pfx, unsigned reserve,
+ bool exact)
{
unsigned alloc = 0;
unsigned num = 0;
if (pfx)
{
- alloc = pfx->alloc_;
- num = pfx->num_;
+ alloc = pfx->alloc_PRIVATE_;
+ num = pfx->num_PRIVATE_;
}
else if (!reserve)
/* If there's no vector, and we've not requested anything, then we