mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-03-31 15:31:11 +08:00
analyzer: fix build with gcc 4.4 (PR 93276)
This patch fixes various build failures seen with gcc 4.4 gcc prior to 4.6 complains about: error: #pragma GCC diagnostic not allowed inside functions for various uses of PUSH_IGNORE_WFORMAT and POP_IGNORE_WFORMAT. This patch makes them a no-op with such compilers. The patch also fixes various errors with template base initializers and redundant uses of "typename" that older g++ implementations can't cope with. gcc/analyzer/ChangeLog: PR analyzer/93276 * analyzer.h (PUSH_IGNORE_WFORMAT, POP_IGNORE_WFORMAT): Guard these macros with GCC_VERSION >= 4006, making them no-op otherwise. * engine.cc (exploded_edge::exploded_edge): Specify template for base class initializer. (exploded_graph::add_edge): Specify template when chaining up to base class add_edge implementation. (viz_callgraph_node::dump_dot): Drop redundant "typename". (viz_callgraph_edge::viz_callgraph_edge): Specify template for base class initializer. * program-state.cc (sm_state_map::clone_with_remapping): Drop redundant "typename". (sm_state_map::print): Likewise. (sm_state_map::hash): Likewise. (sm_state_map::operator==): Likewise. (sm_state_map::remap_svalue_ids): Likewise. (sm_state_map::on_svalue_purge): Likewise. (sm_state_map::validate): Likewise. * program-state.h (sm_state_map::iterator_t): Likewise. * supergraph.h (superedge::superedge): Specify template for base class initializer. gcc/ChangeLog: PR analyzer/93276 * digraph.cc (test_edge::test_edge): Specify template for base class initializer.
This commit is contained in:
parent
feaa1640b3
commit
26d949c8c7
@ -1,3 +1,9 @@
|
||||
2020-01-27 David Malcolm <dmalcolm@redhat.com>
|
||||
|
||||
PR analyzer/93276
|
||||
* digraph.cc (test_edge::test_edge): Specify template for base
|
||||
class initializer.
|
||||
|
||||
2020-01-27 Claudiu Zissulescu <claziss@synopsys.com>
|
||||
|
||||
* config/arc/arc.c (arc_rtx_costs): Update mul64 cost.
|
||||
|
@ -1,3 +1,27 @@
|
||||
2020-01-27 David Malcolm <dmalcolm@redhat.com>
|
||||
|
||||
PR analyzer/93276
|
||||
* analyzer.h (PUSH_IGNORE_WFORMAT, POP_IGNORE_WFORMAT): Guard these
|
||||
macros with GCC_VERSION >= 4006, making them no-op otherwise.
|
||||
* engine.cc (exploded_edge::exploded_edge): Specify template for
|
||||
base class initializer.
|
||||
(exploded_graph::add_edge): Specify template when chaining up to
|
||||
base class add_edge implementation.
|
||||
(viz_callgraph_node::dump_dot): Drop redundant "typename".
|
||||
(viz_callgraph_edge::viz_callgraph_edge): Specify template for
|
||||
base class initializer.
|
||||
* program-state.cc (sm_state_map::clone_with_remapping): Drop
|
||||
redundant "typename".
|
||||
(sm_state_map::print): Likewise.
|
||||
(sm_state_map::hash): Likewise.
|
||||
(sm_state_map::operator==): Likewise.
|
||||
(sm_state_map::remap_svalue_ids): Likewise.
|
||||
(sm_state_map::on_svalue_purge): Likewise.
|
||||
(sm_state_map::validate): Likewise.
|
||||
* program-state.h (sm_state_map::iterator_t): Likewise.
|
||||
* supergraph.h (superedge::superedge): Specify template for base
|
||||
class initializer.
|
||||
|
||||
2020-01-23 David Malcolm <dmalcolm@redhat.com>
|
||||
|
||||
PR analyzer/93375
|
||||
|
@ -98,17 +98,21 @@ public:
|
||||
~auto_cfun () { pop_cfun (); }
|
||||
};
|
||||
|
||||
/* Begin suppressing -Wformat and -Wformat-extra-args. */
|
||||
/* Macros for temporarily suppressing -Wformat and -Wformat-extra-args,
|
||||
for those versions of GCC that support pragmas within a function
|
||||
(4.6 onwards). */
|
||||
|
||||
#define PUSH_IGNORE_WFORMAT \
|
||||
#if GCC_VERSION >= 4006
|
||||
# define PUSH_IGNORE_WFORMAT \
|
||||
_Pragma("GCC diagnostic push") \
|
||||
_Pragma("GCC diagnostic ignored \"-Wformat\"") \
|
||||
_Pragma("GCC diagnostic ignored \"-Wformat-extra-args\"")
|
||||
|
||||
/* Finish suppressing -Wformat and -Wformat-extra-args. */
|
||||
|
||||
#define POP_IGNORE_WFORMAT \
|
||||
# define POP_IGNORE_WFORMAT \
|
||||
_Pragma("GCC diagnostic pop")
|
||||
#else
|
||||
# define PUSH_IGNORE_WFORMAT
|
||||
# define POP_IGNORE_WFORMAT
|
||||
#endif
|
||||
|
||||
/* A template for creating hash traits for a POD type. */
|
||||
|
||||
|
@ -1377,7 +1377,7 @@ rewind_info_t::add_events_to_path (checker_path *emission_path,
|
||||
dst_stack_depth, this));
|
||||
}
|
||||
|
||||
/* class exploded_edge : public dedge. */
|
||||
/* class exploded_edge : public dedge<eg_traits>. */
|
||||
|
||||
/* exploded_edge's ctor. */
|
||||
|
||||
@ -1385,7 +1385,7 @@ exploded_edge::exploded_edge (exploded_node *src, exploded_node *dest,
|
||||
const superedge *sedge,
|
||||
const state_change &change,
|
||||
custom_info_t *custom_info)
|
||||
: dedge (src, dest), m_sedge (sedge), m_change (change),
|
||||
: dedge<eg_traits> (src, dest), m_sedge (sedge), m_change (change),
|
||||
m_custom_info (custom_info)
|
||||
{
|
||||
change.validate (dest->get_state ());
|
||||
@ -1991,7 +1991,7 @@ exploded_graph::add_edge (exploded_node *src, exploded_node *dest,
|
||||
exploded_edge::custom_info_t *custom_info)
|
||||
{
|
||||
exploded_edge *e = new exploded_edge (src, dest, sedge, change, custom_info);
|
||||
digraph::add_edge (e);
|
||||
digraph<eg_traits>::add_edge (e);
|
||||
return e;
|
||||
}
|
||||
|
||||
@ -3332,7 +3332,7 @@ public:
|
||||
// TODO: also show the per-callstring breakdown
|
||||
const exploded_graph::call_string_data_map_t *per_cs_data
|
||||
= args.m_eg->get_per_call_string_data ();
|
||||
for (typename exploded_graph::call_string_data_map_t::iterator iter
|
||||
for (exploded_graph::call_string_data_map_t::iterator iter
|
||||
= per_cs_data->begin ();
|
||||
iter != per_cs_data->end ();
|
||||
++iter)
|
||||
@ -3391,7 +3391,7 @@ class viz_callgraph_edge : public dedge<viz_callgraph_traits>
|
||||
public:
|
||||
viz_callgraph_edge (viz_callgraph_node *src, viz_callgraph_node *dest,
|
||||
const call_superedge *call_sedge)
|
||||
: dedge (src, dest),
|
||||
: dedge<viz_callgraph_traits> (src, dest),
|
||||
m_call_sedge (call_sedge)
|
||||
{}
|
||||
|
||||
|
@ -87,7 +87,7 @@ sm_state_map::clone_with_remapping (const one_way_svalue_id_map &id_map) const
|
||||
{
|
||||
sm_state_map *result = new sm_state_map ();
|
||||
result->m_global_state = m_global_state;
|
||||
for (typename map_t::iterator iter = m_map.begin ();
|
||||
for (map_t::iterator iter = m_map.begin ();
|
||||
iter != m_map.end ();
|
||||
++iter)
|
||||
{
|
||||
@ -121,7 +121,7 @@ sm_state_map::print (const state_machine &sm, pretty_printer *pp) const
|
||||
pp_printf (pp, "global: %s", sm.get_state_name (m_global_state));
|
||||
first = false;
|
||||
}
|
||||
for (typename map_t::iterator iter = m_map.begin ();
|
||||
for (map_t::iterator iter = m_map.begin ();
|
||||
iter != m_map.end ();
|
||||
++iter)
|
||||
{
|
||||
@ -172,7 +172,7 @@ sm_state_map::hash () const
|
||||
/* Accumulate the result by xoring a hash for each slot, so that the
|
||||
result doesn't depend on the ordering of the slots in the map. */
|
||||
|
||||
for (typename map_t::iterator iter = m_map.begin ();
|
||||
for (map_t::iterator iter = m_map.begin ();
|
||||
iter != m_map.end ();
|
||||
++iter)
|
||||
{
|
||||
@ -199,7 +199,7 @@ sm_state_map::operator== (const sm_state_map &other) const
|
||||
if (m_map.elements () != other.m_map.elements ())
|
||||
return false;
|
||||
|
||||
for (typename map_t::iterator iter = m_map.begin ();
|
||||
for (map_t::iterator iter = m_map.begin ();
|
||||
iter != m_map.end ();
|
||||
++iter)
|
||||
{
|
||||
@ -395,7 +395,7 @@ sm_state_map::remap_svalue_ids (const svalue_id_map &map)
|
||||
map_t tmp_map;
|
||||
|
||||
/* Build an intermediate map, using the new sids. */
|
||||
for (typename map_t::iterator iter = m_map.begin ();
|
||||
for (map_t::iterator iter = m_map.begin ();
|
||||
iter != m_map.end ();
|
||||
++iter)
|
||||
{
|
||||
@ -411,7 +411,7 @@ sm_state_map::remap_svalue_ids (const svalue_id_map &map)
|
||||
m_map.empty ();
|
||||
|
||||
/* Copy over from intermediate map. */
|
||||
for (typename map_t::iterator iter = tmp_map.begin ();
|
||||
for (map_t::iterator iter = tmp_map.begin ();
|
||||
iter != tmp_map.end ();
|
||||
++iter)
|
||||
{
|
||||
@ -437,7 +437,7 @@ sm_state_map::on_svalue_purge (const state_machine &sm,
|
||||
/* TODO: ideally remove the slot directly; for now
|
||||
do it in two stages. */
|
||||
auto_vec<svalue_id> to_remove;
|
||||
for (typename map_t::iterator iter = m_map.begin ();
|
||||
for (map_t::iterator iter = m_map.begin ();
|
||||
iter != m_map.end ();
|
||||
++iter)
|
||||
{
|
||||
@ -507,7 +507,7 @@ sm_state_map::validate (const state_machine &sm,
|
||||
return;
|
||||
#endif
|
||||
|
||||
for (typename map_t::iterator iter = m_map.begin ();
|
||||
for (map_t::iterator iter = m_map.begin ();
|
||||
iter != m_map.end ();
|
||||
++iter)
|
||||
{
|
||||
|
@ -132,7 +132,7 @@ public:
|
||||
svalue_id m_origin;
|
||||
};
|
||||
typedef hash_map <svalue_id, entry_t> map_t;
|
||||
typedef typename map_t::iterator iterator_t;
|
||||
typedef map_t::iterator iterator_t;
|
||||
|
||||
sm_state_map ();
|
||||
|
||||
|
@ -304,7 +304,7 @@ class superedge : public dedge<supergraph_traits>
|
||||
|
||||
protected:
|
||||
superedge (supernode *src, supernode *dest, enum edge_kind kind)
|
||||
: dedge (src, dest),
|
||||
: dedge<supergraph_traits> (src, dest),
|
||||
m_kind (kind)
|
||||
{}
|
||||
|
||||
|
@ -62,7 +62,7 @@ struct test_node : public dnode<test_graph_traits>
|
||||
struct test_edge : public dedge<test_graph_traits>
|
||||
{
|
||||
test_edge (node_t *src, node_t *dest)
|
||||
: dedge (src, dest)
|
||||
: dedge<test_graph_traits> (src, dest)
|
||||
{}
|
||||
|
||||
void dump_dot (graphviz_out *gv, const dump_args_t &) const OVERRIDE
|
||||
|
Loading…
x
Reference in New Issue
Block a user