[2/7,applied] default-reporter,reporter-priv: Do not report names of anonymous enums
Commit Message
Hello,
When reporting changes of anonymous enums, do not try to report their
qualified name as that doesn't make any sense -- they are anonymous.
Similarly, in report_name_size_and_alignment_changes do not try to
report about changes in the name of an anonymous enum.
* src/abg-default-reporter.cc (default_reporter::report): In the
overload for enum_diff, do not get the qualified name of anonymous
enums.
* src/abg-reporter-priv.cc
(report_name_size_and_alignment_changes): Do not report about name
changes for anonymous enums.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Applied to master.
---
src/abg-default-reporter.cc | 12 +++++++++---
src/abg-reporter-priv.cc | 3 ++-
2 files changed, 11 insertions(+), 4 deletions(-)
@@ -162,7 +162,9 @@ default_reporter::report(const enum_diff& d, ostream& out,
{
out << indent
<< " '"
- << i->get_qualified_name()
+ << (first->get_is_anonymous()
+ ? i->get_name()
+ : i->get_qualified_name())
<< "' value '"
<< i->get_value()
<< "'";
@@ -181,7 +183,9 @@ default_reporter::report(const enum_diff& d, ostream& out,
{
out << indent
<< " '"
- << i->get_qualified_name()
+ << (second->get_is_anonymous()
+ ? i->get_name()
+ :i->get_qualified_name())
<< "' value '"
<< i->get_value()
<< "'";
@@ -201,7 +205,9 @@ default_reporter::report(const enum_diff& d, ostream& out,
{
out << indent
<< " '"
- << i->first.get_qualified_name()
+ << (first->get_is_anonymous()
+ ? i->first.get_name()
+ : i->first.get_qualified_name())
<< "' from value '"
<< i->first.get_value() << "' to '"
<< i->second.get_value() << "'";
@@ -965,7 +965,8 @@ report_name_size_and_alignment_changes(decl_base_sptr first,
string fn = first->get_qualified_name(),
sn = second->get_qualified_name();
- if (fn != sn)
+ if (!(first->get_is_anonymous() && second->get_is_anonymous())
+ && fn != sn)
{
if (!(ctxt->get_allowed_category() & HARMLESS_DECL_NAME_CHANGE_CATEGORY)
&& filtering::has_harmless_name_change(first, second))