]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
dwarflint: Move some code around
authorPetr Machata <pmachata@redhat.com>
Mon, 26 Oct 2009 13:29:22 +0000 (14:29 +0100)
committerPetr Machata <pmachata@redhat.com>
Wed, 18 Aug 2010 12:55:12 +0000 (14:55 +0200)
src/Makefile.am
src/dwarflint/check_debug_line.cc
src/dwarflint/checks-low.cc
src/dwarflint/checks.hh
src/dwarflint/dwarflint.cc [new file with mode: 0644]
src/dwarflint/dwarflint.hh
src/dwarflint/main.cc

index d0aa6c32a39be9efde55da6c436b70f128ccd01b..87fbf4a01bb0fe662be23fbe27382d9fbd91fd2c 100644 (file)
@@ -79,7 +79,8 @@ dwarfcmp_test_SOURCES = $(dwarfcmp_SOURCES)
 dwarfcmp_test_LDADD = $(dwarfcmp_LDADD)
 
 dwarflint_SOURCES = dwarfstrings.c \
-                   dwarflint/main.cc dwarflint/dwarflint.hh dwarflint/misc.h \
+                   dwarflint/main.cc \
+                   dwarflint/dwarflint.cc dwarflint/dwarflint.hh dwarflint/misc.h \
                    dwarflint/low.c dwarflint/low.h \
                    dwarflint/expected-at.cc dwarflint/expected.hh \
                    dwarflint/coverage.cc dwarflint/coverage.h \
index a0b6233f286d252e267d6a706c7aefed679d4a79..06b4c4f78071e8ec2eef620fcccc5969d861dfdf 100644 (file)
@@ -42,7 +42,7 @@ namespace
        throw check_base::failed (""); //xxx
 
       check_debug_info *info = NULL;
-      info = toplev_check (lint, info);
+      info = lint.toplev_check (info);
       if (info != NULL)
        for (std::vector<cu>::iterator it = info->cus.begin ();
             it != info->cus.end (); ++it)
@@ -66,11 +66,13 @@ namespace
       if (!checked_read_uleb128 (ctx, ptr,
                                 where, "directory index"))
        return false;
+
       if (*name == '/' && *ptr != 0)
        wr_message (*where, cat (mc_impact_2, mc_line, mc_header))
          << ": file #" << nfile
          << " has absolute pathname, but refers to directory != 0."
          << std::endl;
+
       if (*ptr > _m_include_directories.size ())
        /* Not >=, dirs are indexed from 1.  */
        {
index fbcfaa609c8b86018d0bb579c4ef5e1e0447dd27..a9d7ee7c4609bd83b52505e2f2c0f289d32af359 100644 (file)
@@ -338,7 +338,7 @@ check_debug_ranges::check_debug_ranges (dwarflint &lint)
 check_debug_aranges::check_debug_aranges (dwarflint &lint)
   : _m_sec_aranges (lint.check (_m_sec_aranges))
 {
-  check_debug_info *info = toplev_check<check_debug_info> (lint);
+  check_debug_info *info = lint.toplev_check<check_debug_info> ();
   coverage *cov = NULL;
   if (info != NULL)
     {
@@ -347,7 +347,7 @@ check_debug_aranges::check_debug_aranges (dwarflint &lint)
       // stored in check_ranges, and that should have been requested
       // explicitly.  But for the time being...
       if (info->cu_cov.need_ranges)
-       toplev_check<check_debug_ranges> (lint);
+       lint.toplev_check<check_debug_ranges> ();
       if (!info->cu_cov.need_ranges)
        cov = &info->cu_cov.cov;
     }
index be8437af34b553fa682cecaf750a0b92e85af1ed..b41b7459daf7656b41a3286d14f797f98bb648a4 100644 (file)
@@ -32,13 +32,12 @@ public:
 };
 
 template <class T>
-T *
-toplev_check (dwarflint &lint,
-             __attribute__ ((unused)) T *tag = NULL)
+inline T *
+dwarflint::toplev_check (__attribute__ ((unused)) T *tag)
 {
   try
     {
-      return lint.check<T> ();
+      return check<T> ();
     }
   catch (check_base::failed const &f)
     {
@@ -58,7 +57,7 @@ struct reg
 
   virtual void run (dwarflint &lint)
   {
-    toplev_check <T> (lint);
+    lint.toplev_check <T> ();
   }
 };
 
diff --git a/src/dwarflint/dwarflint.cc b/src/dwarflint/dwarflint.cc
new file mode 100644 (file)
index 0000000..72f23c8
--- /dev/null
@@ -0,0 +1,7 @@
+#include "dwarflint.hh"
+
+dwarflint::dwarflint (Elf *a_elf)
+  : _m_elf (a_elf)
+{
+  check_registrar::inst ()->enroll (*this);
+}
index d5a80744c1c35632d82ce252aa07541e65deeae0..d292888da79c5cd99d5efe187e91f387224788f7 100644 (file)
@@ -70,6 +70,8 @@ public:
   {
     return check<T> ();
   }
+
+  template <class T> T * toplev_check (T *tag = NULL);
 };
 
 #endif//DWARFLINT_HH
index b3aaafae38185c53291c60d9c5abe05860c00c13..38fd1b2c7b660e82d5688dba26c1c6300d50e6c5 100644 (file)
@@ -258,12 +258,6 @@ layout_rel_file (Elf *elf)
   return 0;
 }
 
-dwarflint::dwarflint (Elf *a_elf)
-  : _m_elf (a_elf)
-{
-  check_registrar::inst ()->enroll (*this);
-}
-
 int
 main (int argc, char *argv[])
 {