From: Petr Machata Date: Fri, 27 Aug 2010 15:39:15 +0000 (+0200) Subject: dwarflint: Move checkdescriptor to module of its own X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=71a89f34b4473d3ccb315f36c1bfdd790a42acd2;p=thirdparty%2Felfutils.git dwarflint: Move checkdescriptor to module of its own --- diff --git a/dwarflint/Makefile.am b/dwarflint/Makefile.am index f9bbefb7a..a79b8cfb3 100644 --- a/dwarflint/Makefile.am +++ b/dwarflint/Makefile.am @@ -39,6 +39,7 @@ bin_PROGRAMS = dwarflint dwarflint_SOURCES = \ main.cc \ + checkdescriptor.cc checkdescriptor.hh checkdescriptor.ii \ dwarflint.cc dwarflint.hh misc.h \ low.c low.h \ expected-at.cc expected.hh \ diff --git a/dwarflint/checkdescriptor.cc b/dwarflint/checkdescriptor.cc new file mode 100644 index 000000000..0f1d514d6 --- /dev/null +++ b/dwarflint/checkdescriptor.cc @@ -0,0 +1,52 @@ +/* + Copyright (C) 2010 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by the + Free Software Foundation; version 2 of the License. + + Red Hat elfutils is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License along + with Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + . */ + +#include "checkdescriptor.hh" +#include + +namespace +{ + std::vector + split_groups (std::string const &str) + { + std::stringstream ss (str); + std::string item; + std::vector ret; + + while (ss >> item) + ret.push_back (item); + + return ret; + } +} + +checkdescriptor::checkdescriptor (std::string const &desc) + : groups (::split_groups (desc)) + , name (groups[0]) +{ + groups.erase (groups.begin ()); +} + + diff --git a/dwarflint/checkdescriptor.hh b/dwarflint/checkdescriptor.hh new file mode 100644 index 000000000..d04b9e3bf --- /dev/null +++ b/dwarflint/checkdescriptor.hh @@ -0,0 +1,40 @@ +/* + Copyright (C) 2010 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by the + Free Software Foundation; version 2 of the License. + + Red Hat elfutils is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License along + with Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + . */ + +#ifndef DWARFLINT_CHECKDESCRIPTOR_HH +#define DWARFLINT_CHECKDESCRIPTOR_HH + +#include +#include + +struct checkdescriptor +{ + std::vector groups; + std::string const name; + + checkdescriptor (std::string const &desc); +}; + +#endif//DWARFLINT_CHECKDESCRIPTOR_HH diff --git a/dwarflint/checkdescriptor.ii b/dwarflint/checkdescriptor.ii new file mode 100644 index 000000000..052fe1bd2 --- /dev/null +++ b/dwarflint/checkdescriptor.ii @@ -0,0 +1 @@ +struct checkdescriptor; diff --git a/dwarflint/checks.cc b/dwarflint/checks.cc index 10525383b..2337fb792 100644 --- a/dwarflint/checks.cc +++ b/dwarflint/checks.cc @@ -25,31 +25,6 @@ #include "checks.hh" #include "options.h" -#include - -namespace -{ - std::vector - split_groups (std::string const &str) - { - std::stringstream ss (str); - std::string item; - std::vector ret; - - while (ss >> item) - ret.push_back (item); - - return ret; - } -} - -checkdescriptor::checkdescriptor (std::string const &desc) - : groups (::split_groups (desc)) - , name (groups[0]) -{ - groups.erase (groups.begin ()); -} - reporter::reporter (checkstack const &s, checkdescriptor const &a_cd) : stack (s) diff --git a/dwarflint/checks.hh b/dwarflint/checks.hh index 8f9ea6d7d..146894c28 100644 --- a/dwarflint/checks.hh +++ b/dwarflint/checks.hh @@ -28,17 +28,10 @@ #include "where.h" #include "dwarflint.hh" +#include "checkdescriptor.hh" #include #include -struct checkdescriptor -{ - std::vector groups; - std::string const name; - - checkdescriptor (std::string const &desc); -}; - struct check_base { struct failed {}; diff --git a/dwarflint/checks.ii b/dwarflint/checks.ii index 9db9722b4..b9ca68df7 100644 --- a/dwarflint/checks.ii +++ b/dwarflint/checks.ii @@ -1,2 +1 @@ struct check_base; -struct checkdescriptor; diff --git a/dwarflint/dwarflint.hh b/dwarflint/dwarflint.hh index 968cfb66f..ccd0bdf96 100644 --- a/dwarflint/dwarflint.hh +++ b/dwarflint/dwarflint.hh @@ -31,6 +31,7 @@ #include #include "../libelf/libelf.h" #include "checks.ii" +#include "checkdescriptor.ii" class checkstack : public std::vector