Commit 38f2ca32 by Diego Novillo Committed by Diego Novillo

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
parent 4a397c3e
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.
2012-11-20 Kai Tietz <ktietz@redhat.com> 2012-11-20 Kai Tietz <ktietz@redhat.com>
PR target/55268 PR target/55268
...@@ -121,8 +121,8 @@ vec_descriptor (const char *name, int line, const char *function) ...@@ -121,8 +121,8 @@ vec_descriptor (const char *name, int line, const char *function)
/* Account the overhead. */ /* Account the overhead. */
void void
vec_prefix::register_overhead (size_t size, const char *name, int line, vec_prefix::register_overhead_PRIVATE_ (size_t size, const char *name, int line,
const char *function) const char *function)
{ {
struct vec_descriptor *loc = vec_descriptor (name, line, function); struct vec_descriptor *loc = vec_descriptor (name, line, function);
struct ptr_hash_entry *p = XNEW (struct ptr_hash_entry); 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, ...@@ -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. */ /* Notice that the memory allocated for the vector has been freed. */
void void
vec_prefix::release_overhead (void) vec_prefix::release_overhead_PRIVATE_ (void)
{ {
PTR *slot = htab_find_slot_with_hash (ptr_hash, this, PTR *slot = htab_find_slot_with_hash (ptr_hash, this,
htab_hash_pointer (this), htab_hash_pointer (this),
...@@ -165,15 +165,16 @@ vec_prefix::release_overhead (void) ...@@ -165,15 +165,16 @@ vec_prefix::release_overhead (void)
exponentially. PFX is the control data for the vector. */ exponentially. PFX is the control data for the vector. */
unsigned 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 alloc = 0;
unsigned num = 0; unsigned num = 0;
if (pfx) if (pfx)
{ {
alloc = pfx->alloc_; alloc = pfx->alloc_PRIVATE_;
num = pfx->num_; num = pfx->num_PRIVATE_;
} }
else if (!reserve) else if (!reserve)
/* If there's no vector, and we've not requested anything, then we /* If there's no vector, and we've not requested anything, then we
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment