From: Jakub Jelinek Date: Tue, 26 Mar 2019 13:40:43 +0000 (+0100) Subject: hash-table.h (hash_table::m_gather_mem_stats): If GATHER_STATISTICS is constant 0... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=465b8e7f4ecb9af118419dbf14a43cb95e1d12dd;p=gcc.git 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 132a8f926b9..0efe8e64936 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2019-03-26 Jakub Jelinek + + * 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 Jakub Jelinek diff --git a/gcc/hash-table.h b/gcc/hash-table.h index 37e4b83b876..7ba6356f3ae 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 class Allocator> hash_table::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 class Allocator> hash_table::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;