From 48018442d5eb29032aafd6e30f8cdb38164ba83c Mon Sep 17 00:00:00 2001 From: Petr Machata Date: Fri, 25 Feb 2011 15:19:54 +0100 Subject: [PATCH] Drop pri::tag, pri::attr - dwarf::tags::name, dwarf::attributes::name should be used instead --- dwarflint/check_debug_info.cc | 4 +++- dwarflint/check_expected_trees.cc | 16 +++++++++------- dwarflint/check_range_out_of_scope.cc | 5 +++-- dwarflint/dwarf_version.cc | 3 ++- dwarflint/locstats.cc | 4 ++-- dwarflint/pri.cc | 8 -------- dwarflint/pri.hh | 14 +------------- 7 files changed, 20 insertions(+), 34 deletions(-) diff --git a/dwarflint/check_debug_info.cc b/dwarflint/check_debug_info.cc index 69d8fdd3e..b46c7a15e 100644 --- a/dwarflint/check_debug_info.cc +++ b/dwarflint/check_debug_info.cc @@ -31,6 +31,7 @@ #include #include #include "../libdw/dwarf.h" +#include "../libdw/c++/dwarf" #include "messages.hh" #include "dwarf_version.hh" @@ -785,7 +786,8 @@ namespace // error the second time now. wr_error (where) << "can't read value of attribute " - << pri::attr (it->name) << '.' << std::endl; + << elfutils::dwarf::attributes::name (it->name) + << '.' << std::endl; return -1; } if (storclass == sc_block) diff --git a/dwarflint/check_expected_trees.cc b/dwarflint/check_expected_trees.cc index 955cf8d17..63b44752a 100644 --- a/dwarflint/check_expected_trees.cc +++ b/dwarflint/check_expected_trees.cc @@ -32,7 +32,6 @@ #include "expected.hh" #include "../src/dwarfstrings.h" #include "../libdw/c++/dwarf-knowledge.cc" -#include "pri.hh" #include "messages.hh" using elfutils::dwarf; @@ -127,19 +126,22 @@ check_expected_trees::check_expected_trees (checkstack &stack, dwarflint &lint) = expect.begin (); jt != expect.end (); ++jt) { std::set ::iterator kt = attributes.find (jt->first); + char const *what = NULL; if (kt == attributes.end ()) switch (jt->second) { case opt_required: - wr_message (where, cat (mc_impact_4, mc_info)) - << pri::tag (parent_tag) << " lacks required attribute " - << pri::attr (jt->first) << '.' << std::endl; - break; + what = " lacks required attribute "; + // FALL_THROUGH case opt_expected: + if (what == NULL) + what = " should contain attribute "; wr_message (where, cat (mc_impact_2, mc_info)) - << pri::tag (parent_tag) << " should contain attribute " - << pri::attr (jt->first) << '.' << std::endl; + << elfutils::dwarf::tags::name (parent_tag) << what + << elfutils::dwarf::attributes::name (jt->first) << '.' + << std::endl; + break; case opt_optional: break; diff --git a/dwarflint/check_range_out_of_scope.cc b/dwarflint/check_range_out_of_scope.cc index 0495d4051..05d914a9a 100644 --- a/dwarflint/check_range_out_of_scope.cc +++ b/dwarflint/check_range_out_of_scope.cc @@ -1,5 +1,5 @@ /* Check whether PC ranges reported at DIE fall into the containing scope. - Copyright (C) 2009,2010 Red Hat, Inc. + Copyright (C) 2009,2010,2011 Red Hat, Inc. This file is part of Red Hat elfutils. Red Hat elfutils is free software; you can redistribute it and/or modify @@ -224,7 +224,8 @@ check_range_out_of_scope::recursively_validate { runoff = true; wr_error (wh) - << "attribute `" << pri::attr ((*at).first) + << "attribute `" + << elfutils::dwarf::attributes::name ((*at).first) << "': PC range " << pri::range (start, end) << " outside containing scope." << std::endl; } diff --git a/dwarflint/dwarf_version.cc b/dwarflint/dwarf_version.cc index 819f8106b..10bfcbd28 100644 --- a/dwarflint/dwarf_version.cc +++ b/dwarflint/dwarf_version.cc @@ -39,6 +39,7 @@ #include "dwarf_mips.hh" #include "check_debug_info.hh" #include "pri.hh" +#include "c++/dwarf" #include "../libdw/dwarf.h" #include @@ -139,7 +140,7 @@ attribute::attribute (int a_name, dw_class_set const &a_classes) std::ostream & operator << (std::ostream &os, attribute const &obj) { - return os << pri::attr (obj.name ()); + return os << elfutils::dwarf::attributes::name (obj.name ()); } diff --git a/dwarflint/locstats.cc b/dwarflint/locstats.cc index 7f7571d29..7ef2423e5 100644 --- a/dwarflint/locstats.cc +++ b/dwarflint/locstats.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2010 Red Hat, Inc. + Copyright (C) 2010, 2011 Red Hat, Inc. This file is part of Red Hat elfutils. Red Hat elfutils is free software; you can redistribute it and/or modify @@ -572,7 +572,7 @@ locstats::locstats (checkstack &stack, dwarflint &lint) { auto const &d = *sit; std::cerr << pad << pri::ref (d) << " " - << pri::tag (d.tag ()) << std::endl; + << elfutils::dwarf::tags::name (d.tag ()) << std::endl; for (auto atit = d.attributes ().begin (); atit != d.attributes ().end (); ++atit) { diff --git a/dwarflint/pri.cc b/dwarflint/pri.cc index 09e30257a..3c20bc094 100644 --- a/dwarflint/pri.cc +++ b/dwarflint/pri.cc @@ -38,18 +38,10 @@ pri::operator << (std::ostream &os, pri::pribase const &obj) return os << obj.m_s; } -pri::attr::attr (int attr_name) - : pribase (elfutils::dwarf::attributes::name (attr_name)) -{} - pri::form::form (int attr_form) : pribase (dwarf_form_string (attr_form)) {} -pri::tag::tag (int die_tag) - : pribase (elfutils::dwarf::tags::name (die_tag)) -{} - pri::locexpr_opcode::locexpr_opcode (int opcode) : pribase (dwarf_locexpr_opcode_string (opcode)) {} diff --git a/dwarflint/pri.hh b/dwarflint/pri.hh index b9806dfa1..c5c6f6afd 100644 --- a/dwarflint/pri.hh +++ b/dwarflint/pri.hh @@ -1,5 +1,5 @@ /* Pedantic checking of DWARF files - Copyright (C) 2009,2010 Red Hat, Inc. + Copyright (C) 2009,2010,2011 Red Hat, Inc. This file is part of Red Hat elfutils. Red Hat elfutils is free software; you can redistribute it and/or modify @@ -66,24 +66,12 @@ namespace pri {} }; - struct attr - : public pribase - { - attr (int attr_name); - }; - struct form : public pribase { form (int attr_form); }; - struct tag - : public pribase - { - tag (int tag); - }; - struct locexpr_opcode : public pribase { -- 2.47.2