From 20bbe52d9987908c40adc15dfd279a7266ddc1a2 Mon Sep 17 00:00:00 2001 From: Petr Machata Date: Mon, 9 Nov 2009 08:15:26 +0100 Subject: [PATCH] dwarflint: Add pri::tag --- src/dwarflint/check_expected_trees.cc | 16 ++++++++-------- src/dwarflint/pri.cc | 4 ++++ src/dwarflint/pri.hh | 6 ++++++ 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/src/dwarflint/check_expected_trees.cc b/src/dwarflint/check_expected_trees.cc index 1bcfe4a78..bfe1165d8 100644 --- a/src/dwarflint/check_expected_trees.cc +++ b/src/dwarflint/check_expected_trees.cc @@ -6,6 +6,7 @@ #include "expected.hh" #include "dwarfstrings.h" #include "../libdw/c++/dwarf-knowledge.cc" +#include "pri.hh" using elfutils::dwarf; @@ -93,17 +94,16 @@ check_expected_trees::check_expected_trees (dwarflint &lint) switch (jt->second) { case opt_required: - wr_message (cat (mc_impact_4, mc_info), &where, - ": %s lacks required attribute %s.\n", - dwarf_tag_string (parent_tag), - dwarf_attr_string (jt->first)); + wr_message (where, cat (mc_impact_4, mc_info)) + << pri::tag (parent_tag) << " lacks required attribute " + << pri::attr (jt->first) << '\n' << std::endl; break; case opt_expected: - wr_message (cat (mc_impact_2, mc_info), &where, - ": %s should contain attribute %s.\n", - dwarf_tag_string (parent_tag), - dwarf_attr_string (jt->first)); + wr_message (where, cat (mc_impact_2, mc_info)) + << pri::tag (parent_tag) << " should contain attribute " + << pri::attr (jt->first) << '\n' << std::endl; + case opt_optional: break; }; diff --git a/src/dwarflint/pri.cc b/src/dwarflint/pri.cc index f69307b9a..e0afa5791 100644 --- a/src/dwarflint/pri.cc +++ b/src/dwarflint/pri.cc @@ -10,6 +10,10 @@ pri::form::form (int attr_form) : pribase (dwarf_form_string (attr_form)) {} +pri::tag::tag (int die_tag) + : pribase (dwarf_tag_string (die_tag)) +{} + std::ostream & pri::operator << (std::ostream &os, pri::pribase const &obj) { diff --git a/src/dwarflint/pri.hh b/src/dwarflint/pri.hh index b4ef54df1..3998563fc 100644 --- a/src/dwarflint/pri.hh +++ b/src/dwarflint/pri.hh @@ -50,6 +50,12 @@ namespace pri form (int attr_form); }; + struct tag + : public pribase + { + tag (int tag); + }; + class ref { Dwarf_Off off; -- 2.47.3