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
This commit is contained in:
Jakub Jelinek 2019-03-26 14:40:43 +01:00 committed by Jakub Jelinek
parent a6f3616693
commit 465b8e7f4e
2 changed files with 23 additions and 5 deletions

View File

@ -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>

View File

@ -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;