aboutsummaryrefslogtreecommitdiff
path: root/gcc/ggc-common.c
diff options
context:
space:
mode:
authorMartin Liska <mliska@suse.cz>2018-01-12 15:43:58 +0100
committerMartin Liska <marxin@gcc.gnu.org>2018-01-12 14:43:58 +0000
commitb27b31dc2d160453e7b05168f1dd195e73cb176b (patch)
treea6dbb2f5ef07d7accb9a8d71b0c192cb21e1b696 /gcc/ggc-common.c
parent4a0d0ed28fe9695b95e30b5aea4e45c78420d359 (diff)
downloadgcc-b27b31dc2d160453e7b05168f1dd195e73cb176b.zip
gcc-b27b31dc2d160453e7b05168f1dd195e73cb176b.tar.gz
gcc-b27b31dc2d160453e7b05168f1dd195e73cb176b.tar.bz2
Fix --enable-gather-detailed-mem-stats build.
2018-01-12 Martin Liska <mliska@suse.cz> * Makefile.in: As qsort_chk is implemented in vec.c, add vec.o to linkage of gencfn-macros. * tree.c (build_new_poly_int_cst): Add CXX_MEM_STAT_INFO as it's passing the info to record_node_allocation_statistics. (test_vector_cst_patterns): Add CXX_MEM_STAT_INFO to declaration and pass the info. * ggc-common.c (struct ggc_usage): Add operator== and use it in operator< and compare function. * mem-stats.h (struct mem_usage): Likewise. * vec.c (struct vec_usage): Remove operator< and compare function. Can be simply inherited. From-SVN: r256582
Diffstat (limited to 'gcc/ggc-common.c')
-rw-r--r--gcc/ggc-common.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/gcc/ggc-common.c b/gcc/ggc-common.c
index d435a4b0..f83fc13 100644
--- a/gcc/ggc-common.c
+++ b/gcc/ggc-common.c
@@ -836,10 +836,22 @@ struct ggc_usage: public mem_usage
: mem_usage (allocated, times, peak),
m_freed (freed), m_collected (collected), m_overhead (overhead) {}
+ /* Equality operator. */
+ inline bool
+ operator== (const ggc_usage &second) const
+ {
+ return (get_balance () == second.get_balance ()
+ && m_peak == second.m_peak
+ && m_times == second.m_times);
+ }
+
/* Comparison operator. */
inline bool
operator< (const ggc_usage &second) const
{
+ if (*this == second)
+ return false;
+
return (get_balance () == second.get_balance () ?
(m_peak == second.m_peak ? m_times < second.m_times
: m_peak < second.m_peak)
@@ -926,7 +938,10 @@ struct ggc_usage: public mem_usage
const mem_pair_t f = *(const mem_pair_t *)first;
const mem_pair_t s = *(const mem_pair_t *)second;
- return (*f.second) < (*s.second);
+ if (*f.second == *s.second)
+ return 0;
+
+ return *f.second < *s.second ? 1 : -1;
}
/* Compare rows in final GGC summary dump. */