On Mon, 2023-10-09 at 12:09 +0200, Tobias Burnus wrote: > Hi David, > > your commit breaks compilation with GCC < 6, here with GCC 5.2: > > gcc/analyzer/access-diagram.cc: In member function 'void > ana::boundaries::add(const ana::access_range&, > ana::boundaries::kind)': > gcc/analyzer/access-diagram.cc:655:20: error: 'kind' is not a class, > namespace, or enumeration > (kind == kind::HARD) ? "HARD" : "soft"); > ^ > The problem is ... > > On 09.10.23 00:58, David Malcolm wrote: > > > Update out-of-bounds diagrams to show existing string values, > > diff --git a/gcc/analyzer/access-diagram.cc b/gcc/analyzer/access- > > diagram.cc > > index a51d594b5b2..2197ec63f53 100644 > > --- a/gcc/analyzer/access-diagram.cc > > +++ b/gcc/analyzer/access-diagram.cc > > @@ -630,8 +630,8 @@ class boundaries > > public: > > enum class kind { HARD, SOFT}; > > ... > > > @@ -646,6 +646,15 @@ public: > > Just above the following diff is the line: > > void add (const access_range &range, enum kind kind) > > > { > > add (range.m_start, kind); > > add (range.m_next, kind); > > + if (m_logger) > > + { > > + m_logger->start_log_line (); > > + m_logger->log_partial ("added access_range: "); > > + range.dump_to_pp (m_logger->get_printer (), true); > > + m_logger->log_partial (" (%s)", > > + (kind == kind::HARD) ? "HARD" : > > "soft"); > > + m_logger->end_log_line (); > > Actual problem: > > Playing around also with the compiler explorer shows that GCC 5.2 or > likewise 5.5 > do not like the variable (PARAM_DECL) name "kind" combined with > "kind::HARD". > > The following works: > (A) Using "kind == boundaries::kind::HARD" - i.e. adding > "boundaries::" > (B) Renaming the parameter name "kind" to something else - like "k" > as used > in the other functions. > > Can you fix it?
Sorry about the breakage, and thanks for the investigation. Does the following patch fix the build for you? Thanks gcc/analyzer/ChangeLog: * access-diagram.cc (boundaries::add): Explicitly state "boundaries::" scope for "kind" enum. --- gcc/analyzer/access-diagram.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gcc/analyzer/access-diagram.cc b/gcc/analyzer/access-diagram.cc index 2197ec63f53..c7d190e3188 100644 --- a/gcc/analyzer/access-diagram.cc +++ b/gcc/analyzer/access-diagram.cc @@ -652,7 +652,8 @@ public: m_logger->log_partial ("added access_range: "); range.dump_to_pp (m_logger->get_printer (), true); m_logger->log_partial (" (%s)", - (kind == kind::HARD) ? "HARD" : "soft"); + (kind == boundaries::kind::HARD) + ? "HARD" : "soft"); m_logger->end_log_line (); } } -- 2.26.3