* alloc-pool.h (struct pool_usage): Correct GNU coding style.
* bitmap.h (struct bitmap_usage): Likewise.
* ggc-common.c (struct ggc_usage): Likewise.
* mem-stats.h (struct mem_location): Likewise.
(struct mem_usage): Likewise.
* vec.c (struct vec_usage): Likewise.
From-SVN: r224082
+2015-06-03 Martin Liska <mliska@suse.cz>
+
+ * alloc-pool.h (struct pool_usage): Correct GNU coding style.
+ * bitmap.h (struct bitmap_usage): Likewise.
+ * ggc-common.c (struct ggc_usage): Likewise.
+ * mem-stats.h (struct mem_location): Likewise.
+ (struct mem_usage): Likewise.
+ * vec.c (struct vec_usage): Likewise.
+
2015-06-03 Benigno B. Junior <bbj@gentoo.org>
* config/netbsd-elf.h (NETBSD_LINK_SPEC_ELF): Turn -symbolic into
m_pool_name (pool_name) {}
/* Sum the usage with SECOND usage. */
- pool_usage operator+ (const pool_usage &second)
+ pool_usage
+ operator+ (const pool_usage &second)
{
return pool_usage (m_allocated + second.m_allocated,
m_times + second.m_times,
}
/* Dump usage coupled to LOC location, where TOTAL is sum of all rows. */
- inline void dump (mem_location *loc, mem_usage &total) const
+ inline void
+ dump (mem_location *loc, mem_usage &total) const
{
char *location_string = loc->to_string ();
}
/* Dump header with NAME. */
- static inline void dump_header (const char *name)
+ static inline void
+ dump_header (const char *name)
{
fprintf (stderr, "%-32s%-48s %6s%11s%16s%17s%12s\n", "Pool name", name,
"Pools", "Leak", "Peak", "Times", "Elt size");
}
/* Dump footer. */
- inline void dump_footer ()
+ inline void
+ dump_footer ()
{
print_dash_line ();
fprintf (stderr, "%s%82li%10li\n", "Total", (long)m_instances,
int64_t align_i;
} u;
- static inline allocation_object<U> *get_instance (void *data_ptr)
+ static inline allocation_object<U> *
+ get_instance (void *data_ptr)
{
return (allocation_object<U> *)(((char *)(data_ptr))
- offsetof (allocation_object<U>,
u.data));
}
- static inline U *get_data (void *instance_ptr)
+ static inline U *
+ get_data (void *instance_ptr)
{
return (U*)(((allocation_object<U> *) instance_ptr)->u.data);
}
};
/* Align X to 8. */
- size_t align_eight (size_t x)
+ size_t
+ align_eight (size_t x)
{
return (((x+7) >> 3) << 3);
}
m_nsearches (nsearches), m_search_iter (search_iter) {}
/* Sum the usage with SECOND usage. */
- bitmap_usage operator+ (const bitmap_usage &second)
+ bitmap_usage
+ operator+ (const bitmap_usage &second)
{
return bitmap_usage (m_allocated + second.m_allocated,
m_times + second.m_times,
}
/* Dump usage coupled to LOC location, where TOTAL is sum of all rows. */
- inline void dump (mem_location *loc, mem_usage &total) const
+ inline void
+ dump (mem_location *loc, mem_usage &total) const
{
char *location_string = loc->to_string ();
}
/* Dump header with NAME. */
- static inline void dump_header (const char *name)
+ static inline void
+ dump_header (const char *name)
{
fprintf (stderr, "%-48s %11s%16s%17s%12s%12s%10s\n", name, "Leak", "Peak",
"Times", "N searches", "Search iter", "Type");
m_freed (freed), m_collected (collected), m_overhead (overhead) {}
/* Comparison operator. */
- inline bool operator< (const ggc_usage &second) const
+ inline bool
+ operator< (const ggc_usage &second) const
{
return (get_balance () == second.get_balance () ?
(m_peak == second.m_peak ? m_times < second.m_times
}
/* Register overhead of ALLOCATED and OVERHEAD bytes. */
- inline void register_overhead (size_t allocated, size_t overhead)
+ inline void
+ register_overhead (size_t allocated, size_t overhead)
{
m_allocated += allocated;
m_overhead += overhead;
}
/* Release overhead of SIZE bytes. */
- inline void release_overhead (size_t size)
+ inline void
+ release_overhead (size_t size)
{
m_freed += size;
}
/* Sum the usage with SECOND usage. */
- ggc_usage operator+ (const ggc_usage &second)
+ ggc_usage
+ operator+ (const ggc_usage &second)
{
return ggc_usage (m_allocated + second.m_allocated,
m_times + second.m_times,
}
/* Dump usage with PREFIX, where TOTAL is sum of all rows. */
- inline void dump (const char *prefix, ggc_usage &total) const
+ inline void
+ dump (const char *prefix, ggc_usage &total) const
{
long balance = get_balance ();
fprintf (stderr,
}
/* Dump usage coupled to LOC location, where TOTAL is sum of all rows. */
- inline void dump (mem_location *loc, ggc_usage &total) const
+ inline void
+ dump (mem_location *loc, ggc_usage &total) const
{
char *location_string = loc->to_string ();
}
/* Dump footer. */
- inline void dump_footer ()
+ inline void
+ dump_footer ()
{
print_dash_line ();
dump ("Total", *this);
}
/* Get balance which is GGC allocation leak. */
- inline long get_balance () const
+ inline long
+ get_balance () const
{
return m_allocated + m_overhead - m_collected - m_freed;
}
typedef std::pair<mem_location *, ggc_usage *> mem_pair_t;
/* Compare wrapper used by qsort method. */
- static int compare (const void *first, const void *second)
+ static int
+ compare (const void *first, const void *second)
{
const mem_pair_t f = *(const mem_pair_t *)first;
const mem_pair_t s = *(const mem_pair_t *)second;
}
/* Compare rows in final GGC summary dump. */
- static int compare_final (const void *first, const void *second)
- { typedef std::pair<mem_location *, ggc_usage *> mem_pair_t;
+ static int
+ compare_final (const void *first, const void *second)
+ {
+ typedef std::pair<mem_location *, ggc_usage *> mem_pair_t;
const ggc_usage *f = ((const mem_pair_t *)first)->second;
const ggc_usage *s = ((const mem_pair_t *)second)->second;
}
/* Dump header with NAME. */
- static inline void dump_header (const char *name)
+ static inline void
+ dump_header (const char *name)
{
fprintf (stderr, "%-48s %11s%17s%17s%16s%17s\n", name, "Garbage", "Freed",
"Leak", "Overhead", "Times");
struct mem_location
{
/* Default constructor. */
- inline mem_location () {}
+ inline
+ mem_location () {}
/* Constructor. */
- inline mem_location (mem_alloc_origin origin, bool ggc,
+ inline
+ mem_location (mem_alloc_origin origin, bool ggc,
const char *filename = NULL, int line = 0,
const char *function = NULL):
m_filename (filename), m_function (function), m_line (line), m_origin
(origin), m_ggc (ggc) {}
/* Copy constructor. */
- inline mem_location (mem_location &other): m_filename (other.m_filename),
+ inline
+ mem_location (mem_location &other): m_filename (other.m_filename),
m_function (other.m_function), m_line (other.m_line),
m_origin (other.m_origin), m_ggc (other.m_ggc) {}
source code. As there is just a single pointer registered for every
constant that points to e.g. the same file name, we can use hash
of the pointer. */
- hashval_t hash ()
+ hashval_t
+ hash ()
{
inchash::hash hash;
}
/* Return true if the memory location is equal to OTHER. */
- int equal (mem_location &other)
+ int
+ equal (mem_location &other)
{
return m_filename == other.m_filename && m_function == other.m_function
&& m_line == other.m_line;
}
/* Return trimmed filename for the location. */
- inline const char *get_trimmed_filename ()
+ inline const char *
+ get_trimmed_filename ()
{
const char *s1 = m_filename;
const char *s2;
return s1;
}
- inline char *to_string ()
+ inline char *
+ to_string ()
{
unsigned l = strlen (get_trimmed_filename ()) + strlen (m_function)
+ LOCATION_LINE_EXTRA_SPACE;
}
/* Return display name associated to ORIGIN type. */
- static const char *get_origin_name (mem_alloc_origin origin)
+ static const char *
+ get_origin_name (mem_alloc_origin origin)
{
return mem_alloc_origin_names[(unsigned) origin];
}
m_instances (instances) {}
/* Register overhead of SIZE bytes. */
- inline void register_overhead (size_t size)
+ inline void
+ register_overhead (size_t size)
{
m_allocated += size;
m_times++;
}
/* Release overhead of SIZE bytes. */
- inline void release_overhead (size_t size)
+ inline void
+ release_overhead (size_t size)
{
gcc_assert (size <= m_allocated);
}
/* Sum the usage with SECOND usage. */
- mem_usage operator+ (const mem_usage &second)
+ mem_usage
+ operator+ (const mem_usage &second)
{
return mem_usage (m_allocated + second.m_allocated,
m_times + second.m_times,
}
/* Comparison operator. */
- inline bool operator< (const mem_usage &second) const
+ inline bool
+ operator< (const mem_usage &second) const
{
return (m_allocated == second.m_allocated ?
(m_peak == second.m_peak ? m_times < second.m_times
}
/* Compare wrapper used by qsort method. */
- static int compare (const void *first, const void *second)
+ static int
+ compare (const void *first, const void *second)
{
typedef std::pair<mem_location *, mem_usage *> mem_pair_t;
}
/* Dump usage coupled to LOC location, where TOTAL is sum of all rows. */
- inline void dump (mem_location *loc, mem_usage &total) const
+ inline void
+ dump (mem_location *loc, mem_usage &total) const
{
char *location_string = loc->to_string ();
}
/* Dump footer. */
- inline void dump_footer () const
+ inline void
+ dump_footer () const
{
print_dash_line ();
fprintf (stderr, "%s%54li%27li\n", "Total", (long)m_allocated,
}
/* Return fraction of NOMINATOR and DENOMINATOR in percent. */
- static inline float get_percent (size_t nominator, size_t denominator)
+ static inline float
+ get_percent (size_t nominator, size_t denominator)
{
return denominator == 0 ? 0.0f : nominator * 100.0 / denominator;
}
/* Print line made of dashes. */
- static inline void print_dash_line (size_t count = 140)
+ static inline void
+ print_dash_line (size_t count = 140)
{
fprintf (stderr, "%s\n", std::string (count, '-').c_str ());
}
/* Dump header with NAME. */
- static inline void dump_header (const char *name)
+ static inline void
+ dump_header (const char *name)
{
fprintf (stderr, "%-48s %11s%16s%10s%17s\n", name, "Leak", "Peak",
"Times", "Type");
~mem_alloc_description ();
/* Returns true if instance PTR is registered by the memory description. */
- bool contains_descriptor_for_instance (const void *ptr);
+ bool
+ contains_descriptor_for_instance (const void *ptr);
/* Return descriptor for instance PTR. */
- T *get_descriptor_for_instance (const void *ptr);
+ T *
+ get_descriptor_for_instance (const void *ptr);
/* Register memory allocation descriptor for container PTR which is
described by a memory LOCATION. */
- T *register_descriptor (const void *ptr, mem_location *location);
+ T *
+ register_descriptor (const void *ptr, mem_location *location);
/* Register memory allocation descriptor for container PTR. ORIGIN identifies
type of container and GGC identifes if the allocation is handled in GGC
memory. Each location is identified by file NAME, LINE in source code and
FUNCTION name. */
- T *register_descriptor (const void *ptr, mem_alloc_origin origin,
+ T *
+ register_descriptor (const void *ptr, mem_alloc_origin origin,
bool ggc, const char *name, int line,
const char *function);
/* Register instance overhead identified by PTR pointer. Allocation takes
SIZE bytes. */
- T *register_instance_overhead (size_t size, const void *ptr);
+ T *
+ register_instance_overhead (size_t size, const void *ptr);
/* For containers (and GGC) where we want to track every instance object,
we register allocation of SIZE bytes, identified by PTR pointer, belonging
to USAGE descriptor. */
- void register_object_overhead (T *usage, size_t size, const void *ptr);
+ void
+ register_object_overhead (T *usage, size_t size, const void *ptr);
/* Release PTR pointer of SIZE bytes. If REMOVE_FROM_MAP is set to true,
remove the instance from reverse map. */
- void release_instance_overhead (void *ptr, size_t size,
+ void
+ release_instance_overhead (void *ptr, size_t size,
bool remove_from_map = false);
/* Release intance object identified by PTR pointer. */
- void release_object_overhead (void *ptr);
+ void
+ release_object_overhead (void *ptr);
/* Get sum value for ORIGIN type of allocation for the descriptor. */
- T get_sum (mem_alloc_origin origin);
+ T
+ get_sum (mem_alloc_origin origin);
/* Get all tracked instances registered by the description. Items
are filtered by ORIGIN type, LENGTH is return value where we register
the number of elements in the list. If we want to process custom order,
CMP comparator can be provided. */
- mem_list_t *get_list (mem_alloc_origin origin, unsigned *length,
- int (*cmp) (const void *first, const void *second)
- = NULL);
+ mem_list_t *
+ get_list (mem_alloc_origin origin, unsigned *length,
+ int (*cmp) (const void *first, const void *second) = NULL);
/* Dump all tracked instances of type ORIGIN. If we want to process custom
order, CMP comparator can be provided. */
m_items (items), m_items_peak (items_peak) {}
/* Comparison operator. */
- inline bool operator< (const vec_usage &second) const
+ inline bool
+ operator< (const vec_usage &second) const
{
return (m_allocated == second.m_allocated ?
(m_peak == second.m_peak ? m_times < second.m_times
}
/* Sum the usage with SECOND usage. */
- vec_usage operator+ (const vec_usage &second)
+ vec_usage
+ operator+ (const vec_usage &second)
{
return vec_usage (m_allocated + second.m_allocated,
m_times + second.m_times,
}
/* Dump usage coupled to LOC location, where TOTAL is sum of all rows. */
- inline void dump (mem_location *loc, mem_usage &total) const
+ inline void
+ dump (mem_location *loc, mem_usage &total) const
{
char s[4096];
sprintf (s, "%s:%i (%s)", loc->get_trimmed_filename (),
}
/* Dump footer. */
- inline void dump_footer ()
+ inline void
+ dump_footer ()
{
print_dash_line ();
fprintf (stderr, "%s%55li%25li%17li\n", "Total", (long)m_allocated,
}
/* Dump header with NAME. */
- static inline void dump_header (const char *name)
+ static inline void
+ dump_header (const char *name)
{
fprintf (stderr, "%-48s %11s%15s%10s%17s%11s\n", name, "Leak", "Peak",
"Times", "Leak items", "Peak items");
}
/* Compare wrapper used by qsort method. */
- static int compare (const void *first, const void *second)
+ static int
+ compare (const void *first, const void *second)
{
typedef std::pair<mem_location *, vec_usage *> mem_pair_t;