]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
dwarflint: Add pri::tag
authorPetr Machata <pmachata@redhat.com>
Mon, 9 Nov 2009 07:15:26 +0000 (08:15 +0100)
committerPetr Machata <pmachata@redhat.com>
Wed, 18 Aug 2010 12:55:13 +0000 (14:55 +0200)
src/dwarflint/check_expected_trees.cc
src/dwarflint/pri.cc
src/dwarflint/pri.hh

index 1bcfe4a78884a047448313059f5eabf8a9513f79..bfe1165d87c7067b64a16ae4492c2f3dcc5dabc4 100644 (file)
@@ -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;
                  };
index f69307b9a655de2529d9ad4720e215cf9485265a..e0afa5791a10ffaabfa502b321caf63cff64a4ce 100644 (file)
@@ -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)
 {
index b4ef54df1e7fda7277648dc9b3a93c38521b5ac2..3998563fc6e4e4343949807c4647619a640e36ed 100644 (file)
@@ -50,6 +50,12 @@ namespace pri
     form (int attr_form);
   };
 
+  struct tag
+    : public pribase
+  {
+    tag (int tag);
+  };
+
   class ref
   {
     Dwarf_Off off;