summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authormarxin <marxin@138bc75d-0d04-0410-961f-82ee72b054a4>2015-06-03 14:49:13 +0000
committermarxin <marxin@138bc75d-0d04-0410-961f-82ee72b054a4>2015-06-03 14:49:13 +0000
commit94302dfa934c612eccbc19359cd825bd52c21aa6 (patch)
tree6099942cfb1d37ffb58443756cd0f685b1cfd9f8 /gcc
parentf29929b504428aa8bf6c476c67a98169b8985d60 (diff)
downloadgcc-94302dfa934c612eccbc19359cd825bd52c21aa6.tar.gz
Fix GNU coding style in memory statistics.
* 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@224082 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog9
-rw-r--r--gcc/alloc-pool.h21
-rw-r--r--gcc/bitmap.h9
-rw-r--r--gcc/ggc-common.c36
-rw-r--r--gcc/mem-stats.h87
-rw-r--r--gcc/vec.c18
6 files changed, 122 insertions, 58 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 044dc0105b6..5f695bd3fdc 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,12 @@
+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
diff --git a/gcc/alloc-pool.h b/gcc/alloc-pool.h
index b10cfa413b8..ed0cb6d3242 100644
--- a/gcc/alloc-pool.h
+++ b/gcc/alloc-pool.h
@@ -40,7 +40,8 @@ struct pool_usage: public mem_usage
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,
@@ -50,7 +51,8 @@ struct pool_usage: public mem_usage
}
/* 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 ();
@@ -65,7 +67,8 @@ struct pool_usage: public mem_usage
}
/* 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");
@@ -73,7 +76,8 @@ struct pool_usage: public mem_usage
}
/* Dump footer. */
- inline void dump_footer ()
+ inline void
+ dump_footer ()
{
print_dash_line ();
fprintf (stderr, "%s%82li%10li\n", "Total", (long)m_instances,
@@ -133,21 +137,24 @@ private:
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);
}
diff --git a/gcc/bitmap.h b/gcc/bitmap.h
index 4309f6db182..1d37bca43a0 100644
--- a/gcc/bitmap.h
+++ b/gcc/bitmap.h
@@ -144,7 +144,8 @@ struct bitmap_usage: public mem_usage
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,
@@ -154,7 +155,8 @@ struct bitmap_usage: public mem_usage
}
/* 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 ();
@@ -170,7 +172,8 @@ struct bitmap_usage: public mem_usage
}
/* 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");
diff --git a/gcc/ggc-common.c b/gcc/ggc-common.c
index 43ccc0b7402..cd81770bedf 100644
--- a/gcc/ggc-common.c
+++ b/gcc/ggc-common.c
@@ -843,7 +843,8 @@ struct ggc_usage: public mem_usage
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
@@ -852,7 +853,8 @@ struct ggc_usage: public mem_usage
}
/* 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;
@@ -860,13 +862,15 @@ struct ggc_usage: public mem_usage
}
/* 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,
@@ -877,7 +881,8 @@ struct ggc_usage: public mem_usage
}
/* 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,
@@ -892,7 +897,8 @@ struct ggc_usage: public mem_usage
}
/* 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 ();
@@ -902,7 +908,8 @@ struct ggc_usage: public mem_usage
}
/* Dump footer. */
- inline void dump_footer ()
+ inline void
+ dump_footer ()
{
print_dash_line ();
dump ("Total", *this);
@@ -910,7 +917,8 @@ struct ggc_usage: public mem_usage
}
/* 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;
}
@@ -918,7 +926,8 @@ struct ggc_usage: public mem_usage
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;
@@ -927,8 +936,10 @@ struct ggc_usage: public mem_usage
}
/* 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;
@@ -940,7 +951,8 @@ struct ggc_usage: public mem_usage
}
/* 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");
diff --git a/gcc/mem-stats.h b/gcc/mem-stats.h
index 641f7c1c787..7524ff7168a 100644
--- a/gcc/mem-stats.h
+++ b/gcc/mem-stats.h
@@ -18,17 +18,20 @@ class hash_map;
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) {}
@@ -36,7 +39,8 @@ struct mem_location
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;
@@ -48,14 +52,16 @@ struct mem_location
}
/* 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;
@@ -66,7 +72,8 @@ struct mem_location
return s1;
}
- inline char *to_string ()
+ inline char *
+ to_string ()
{
unsigned l = strlen (get_trimmed_filename ()) + strlen (m_function)
+ LOCATION_LINE_EXTRA_SPACE;
@@ -81,7 +88,8 @@ struct mem_location
}
/* 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];
}
@@ -110,7 +118,8 @@ struct mem_usage
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++;
@@ -120,7 +129,8 @@ struct mem_usage
}
/* Release overhead of SIZE bytes. */
- inline void release_overhead (size_t size)
+ inline void
+ release_overhead (size_t size)
{
gcc_assert (size <= m_allocated);
@@ -128,7 +138,8 @@ struct mem_usage
}
/* 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,
@@ -137,7 +148,8 @@ struct mem_usage
}
/* 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
@@ -145,7 +157,8 @@ struct mem_usage
}
/* 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;
@@ -156,7 +169,8 @@ struct mem_usage
}
/* 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 ();
@@ -170,7 +184,8 @@ struct mem_usage
}
/* 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,
@@ -179,19 +194,22 @@ struct mem_usage
}
/* 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");
@@ -262,50 +280,59 @@ public:
~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. */
diff --git a/gcc/vec.c b/gcc/vec.c
index d4a7a0229be..f1a4d657d3b 100644
--- a/gcc/vec.c
+++ b/gcc/vec.c
@@ -60,7 +60,8 @@ struct vec_usage: public mem_usage
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
@@ -68,7 +69,8 @@ struct vec_usage: public mem_usage
}
/* 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,
@@ -78,7 +80,8 @@ struct vec_usage: public mem_usage
}
/* 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 (),
@@ -93,7 +96,8 @@ struct vec_usage: public mem_usage
}
/* Dump footer. */
- inline void dump_footer ()
+ inline void
+ dump_footer ()
{
print_dash_line ();
fprintf (stderr, "%s%55li%25li%17li\n", "Total", (long)m_allocated,
@@ -102,7 +106,8 @@ struct vec_usage: public mem_usage
}
/* 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");
@@ -110,7 +115,8 @@ struct vec_usage: public mem_usage
}
/* 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;