diff options
author | Jakub Jelinek <jakub@redhat.com> | 2019-03-26 14:40:43 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2019-03-26 14:40:43 +0100 |
commit | 465b8e7f4ecb9af118419dbf14a43cb95e1d12dd (patch) | |
tree | ecf04bca4e31cc4e9f203e1642b53ed25192b768 /gcc | |
parent | a6f361669312430748d51e6435da8f0d5c4b34c4 (diff) | |
download | gcc-465b8e7f4ecb9af118419dbf14a43cb95e1d12dd.zip gcc-465b8e7f4ecb9af118419dbf14a43cb95e1d12dd.tar.gz gcc-465b8e7f4ecb9af118419dbf14a43cb95e1d12dd.tar.bz2 |
hash-table.h (hash_table::m_gather_mem_stats): If GATHER_STATISTICS is constant 0...
* hash-table.h (hash_table::m_gather_mem_stats): If GATHER_STATISTICS
is constant 0, turn into static const data member initialized to false.
(hash_table::hash_table): Only initialize m_gather_mem_stats #if
GATHER_STATISTICS. Add ATTRIBUTE_UNUSED to gather_mem_stats param.
From-SVN: r269944
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/hash-table.h | 21 |
2 files changed, 23 insertions, 5 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 132a8f9..0efe8e6 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2019-03-26 Jakub Jelinek <jakub@redhat.com> + + * hash-table.h (hash_table::m_gather_mem_stats): If GATHER_STATISTICS + is constant 0, turn into static const data member initialized to false. + (hash_table::hash_table): Only initialize m_gather_mem_stats #if + GATHER_STATISTICS. Add ATTRIBUTE_UNUSED to gather_mem_stats param. + 2019-03-26 Jason Merrill <jason@redhat.com> Jakub Jelinek <jakub@redhat.com> diff --git a/gcc/hash-table.h b/gcc/hash-table.h index 37e4b83..7ba6356 100644 --- a/gcc/hash-table.h +++ b/gcc/hash-table.h @@ -562,7 +562,11 @@ private: bool m_ggc; /* If we should gather memory statistics for the table. */ +#if GATHER_STATISTICS bool m_gather_mem_stats; +#else + static const bool m_gather_mem_stats = false; +#endif }; /* As mem-stats.h heavily utilizes hash maps (hash tables), we have to include @@ -579,11 +583,15 @@ extern void dump_hash_table_loc_statistics (void); template<typename Descriptor, bool Lazy, template<typename Type> class Allocator> hash_table<Descriptor, Lazy, Allocator>::hash_table (size_t size, bool ggc, - bool gather_mem_stats, + bool gather_mem_stats + ATTRIBUTE_UNUSED, mem_alloc_origin origin MEM_STAT_DECL) : m_n_elements (0), m_n_deleted (0), m_searches (0), m_collisions (0), - m_ggc (ggc), m_gather_mem_stats (gather_mem_stats) + m_ggc (ggc) +#if GATHER_STATISTICS + , m_gather_mem_stats (gather_mem_stats) +#endif { unsigned int size_prime_index; @@ -606,12 +614,15 @@ template<typename Descriptor, bool Lazy, template<typename Type> class Allocator> hash_table<Descriptor, Lazy, Allocator>::hash_table (const hash_table &h, bool ggc, - bool gather_mem_stats, + bool gather_mem_stats + ATTRIBUTE_UNUSED, mem_alloc_origin origin MEM_STAT_DECL) : m_n_elements (h.m_n_elements), m_n_deleted (h.m_n_deleted), - m_searches (0), m_collisions (0), m_ggc (ggc), - m_gather_mem_stats (gather_mem_stats) + m_searches (0), m_collisions (0), m_ggc (ggc) +#if GATHER_STATISTICS + , m_gather_mem_stats (gather_mem_stats) +#endif { size_t size = h.m_size; |