aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-01-21 06:35:28 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-01-21 06:35:28 +0000
commit5afcf5c43994dcce339f17a049cb516794043cff (patch)
tree99f5ad8f27b01e343a00f974362c324bf289da67
parent268b0c0d806516481023edb3ea60420b68a6e517 (diff)
downloadpaludis-5afcf5c43994dcce339f17a049cb516794043cff.tar.gz
paludis-5afcf5c43994dcce339f17a049cb516794043cff.tar.xz
Coding cleanups, improved -W* goodness
-rw-r--r--configure.ac6
-rw-r--r--paludis/args/args_TEST.cc37
-rw-r--r--paludis/args/args_group.cc4
-rw-r--r--paludis/args/args_group.hh5
-rw-r--r--paludis/args/args_option.cc18
-rw-r--r--paludis/args/args_option.hh19
-rw-r--r--paludis/args/switch_arg.cc4
-rw-r--r--paludis/args/switch_arg.hh2
-rw-r--r--paludis/default_config.cc3
-rw-r--r--paludis/default_config.hh2
-rw-r--r--paludis/dep_list_TEST.cc315
-rw-r--r--paludis/filter_insert_iterator.hh10
-rw-r--r--paludis/fs_entry.cc6
-rw-r--r--paludis/fs_entry.hh5
-rw-r--r--paludis/instantiation_policy.hh14
-rw-r--r--paludis/key_value_config_file.cc4
-rw-r--r--paludis/key_value_config_file.hh2
-rw-r--r--paludis/package_dep_atom.cc4
-rw-r--r--paludis/package_dep_atom.hh5
-rw-r--r--paludis/portage_repository.cc23
-rw-r--r--paludis/smart_record.hh.m47
-rw-r--r--paludis/tokeniser.hh74
-rw-r--r--paludis/version_metadata.cc10
-rw-r--r--src/command_line.cc6
-rw-r--r--src/command_line.hh3
-rw-r--r--test/test_framework.cc85
26 files changed, 394 insertions, 279 deletions
diff --git a/configure.ac b/configure.ac
index 77240a6..cc38d7e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -132,11 +132,15 @@ if test "x${cxx_compiler_icc}" = "xyes" ; then
CHECK_CXXFLAG([-wd1125])
CHECK_CXXFLAG([-wd1418])
elif test "x${ac_cv_cxx_compiler_gnu}" = "xyes" ; then
- CHECK_CXXFLAG([-W])
CHECK_CXXFLAG([-Wall])
CHECK_CXXFLAG([-Wextra])
+ if ! test "x$cxxflag_success" = "xyes" ; then
+ CHECK_CXXFLAG([-W])
+ fi
CHECK_CXXFLAG([-Wold-style-cast])
CHECK_CXXFLAG([-Wredundant-decls])
+ CHECK_CXXFLAG([-Wstrict-null-sentinel])
+ CHECK_CXXFLAG([-Wmissing-noreturn])
CHECK_CXXFLAG([-pedantic])
else
CHECK_CXXFLAG([-Wall])
diff --git a/paludis/args/args_TEST.cc b/paludis/args/args_TEST.cc
index b7b9495..789659b 100644
--- a/paludis/args/args_TEST.cc
+++ b/paludis/args/args_TEST.cc
@@ -46,23 +46,30 @@ struct CommandLine : public ArgsHandler
EnumArg arg_enum;
EnumArg arg_other_enum;
- CommandLine() :
- group_one(this, "Group one"),
- arg_foo(&group_one, "foo", 'f', "Enable foo"),
- arg_bar(&group_one, "bar", 'b', "Enable bar"),
- arg_dummy(&group_one, "dummy", 'd', "Enable something else"),
-
- group_two(this, "Group two"),
- arg_baz(&group_two, "baz", 'z', "Enable baz"),
- arg_other_baz(&arg_baz, "other-baz"),
- arg_something(&group_two, "something", 's', "Value of something"),
- arg_somenum(&group_two, "num", 'n', "Some number"),
- arg_enum(&group_two, "enum", 'e', "One of three", EnumArg::EnumArgOptions("one", "Option one")("two", "option two")("three", "option three"), "two"),
- arg_other_enum(&group_two, "something", '\0', "Blah.", EnumArg::EnumArgOptions("a", "A")("b", "B")("c", "C"), "b")
- {
- }
+ CommandLine();
+ ~CommandLine();
};
+CommandLine::CommandLine() :
+ group_one(this, "Group one"),
+ arg_foo(&group_one, "foo", 'f', "Enable foo"),
+ arg_bar(&group_one, "bar", 'b', "Enable bar"),
+ arg_dummy(&group_one, "dummy", 'd', "Enable something else"),
+
+ group_two(this, "Group two"),
+ arg_baz(&group_two, "baz", 'z', "Enable baz"),
+ arg_other_baz(&arg_baz, "other-baz"),
+ arg_something(&group_two, "something", 's', "Value of something"),
+ arg_somenum(&group_two, "num", 'n', "Some number"),
+ arg_enum(&group_two, "enum", 'e', "One of three", EnumArg::EnumArgOptions("one", "Option one")("two", "option two")("three", "option three"), "two"),
+ arg_other_enum(&group_two, "something", '\0', "Blah.", EnumArg::EnumArgOptions("a", "A")("b", "B")("c", "C"), "b")
+{
+}
+
+CommandLine::~CommandLine()
+{
+}
+
#endif
namespace test_cases
diff --git a/paludis/args/args_group.cc b/paludis/args/args_group.cc
index 25c1fad..eab4ea1 100644
--- a/paludis/args/args_group.cc
+++ b/paludis/args/args_group.cc
@@ -41,3 +41,7 @@ ArgsGroup::add(ArgsOption * const value)
_args_options.push_back(value);
}
+ArgsGroup::~ArgsGroup()
+{
+}
+
diff --git a/paludis/args/args_group.hh b/paludis/args/args_group.hh
index 643eb31..7f4f5b7 100644
--- a/paludis/args/args_group.hh
+++ b/paludis/args/args_group.hh
@@ -72,6 +72,11 @@ namespace paludis
ArgsGroup(ArgsHandler * h, const std::string & name);
/**
+ * Destructor.
+ */
+ ~ArgsGroup();
+
+ /**
* Fetch our name.
*/
const std::string & name() const
diff --git a/paludis/args/args_option.cc b/paludis/args/args_option.cc
index 63ffcd5..a1222c3 100644
--- a/paludis/args/args_option.cc
+++ b/paludis/args/args_option.cc
@@ -40,15 +40,13 @@ ArgsOption::ArgsOption(ArgsGroup * const g, const std::string & long_name,
g->_handler->add_option(this, long_name, short_name);
}
-StringArg::StringArg(ArgsGroup * const g, const std::string & long_name,
- const char short_name, const std::string & description) :
- ArgsOption(g, long_name, short_name, description)
+ArgsOption::~ArgsOption()
{
}
-SwitchArg::SwitchArg(ArgsGroup * const group, std::string long_name, char short_name,
- std::string description) :
- ArgsOption(group, long_name, short_name, description)
+StringArg::StringArg(ArgsGroup * const g, const std::string & long_name,
+ const char short_name, const std::string & description) :
+ ArgsOption(g, long_name, short_name, description)
{
}
@@ -67,6 +65,10 @@ void EnumArg::set_argument(const std::string & arg)
_argument = arg;
}
+EnumArg::~EnumArg()
+{
+}
+
EnumArg::EnumArgOptions::EnumArgOptions(std::string opt, std::string desc)
{
_options.insert(std::make_pair(opt, desc));
@@ -77,3 +79,7 @@ EnumArg::EnumArgOptions & EnumArg::EnumArgOptions::operator() (std::string opt,
_options.insert(std::make_pair(opt, desc));
return *this;
}
+
+EnumArg::EnumArgOptions::~EnumArgOptions()
+{
+}
diff --git a/paludis/args/args_option.hh b/paludis/args/args_option.hh
index 5946494..20cdd26 100644
--- a/paludis/args/args_option.hh
+++ b/paludis/args/args_option.hh
@@ -66,6 +66,11 @@ namespace paludis
ArgsOption(ArgsGroup * const, const std::string & long_name,
const char short_name, const std::string & description);
+ /**
+ * Destructor.
+ */
+ ~ArgsOption();
+
public:
/**
* Fetch our long name.
@@ -115,13 +120,6 @@ namespace paludis
{
return _group;
}
-
- /**
- * Destructor.
- */
- virtual ~ArgsOption()
- {
- }
};
/**
@@ -213,6 +211,11 @@ namespace paludis
EnumArgOptions(const std::string, const std::string);
/**
+ * Destructor.
+ */
+ ~EnumArgOptions();
+
+ /**
* Adds another (option, description) pair.
*/
EnumArgOptions& operator() (const std::string, const std::string);
@@ -230,6 +233,8 @@ namespace paludis
{
}
+ ~EnumArg();
+
/**
* Fetch the argument that was given to this option.
*/
diff --git a/paludis/args/switch_arg.cc b/paludis/args/switch_arg.cc
index 72976a0..2d4dc78 100644
--- a/paludis/args/switch_arg.cc
+++ b/paludis/args/switch_arg.cc
@@ -33,3 +33,7 @@ SwitchArg::SwitchArg(ArgsGroup * const group, std::string long_name, char short_
{
}
+SwitchArg::~SwitchArg()
+{
+}
+
diff --git a/paludis/args/switch_arg.hh b/paludis/args/switch_arg.hh
index 33d8fa8..8e0f7bb 100644
--- a/paludis/args/switch_arg.hh
+++ b/paludis/args/switch_arg.hh
@@ -48,6 +48,8 @@ namespace paludis
*/
SwitchArg(ArgsGroup * const group, std::string long_name, char short_name,
std::string description);
+
+ ~SwitchArg();
};
}
}
diff --git a/paludis/default_config.cc b/paludis/default_config.cc
index 47850fe..fc14db7 100644
--- a/paludis/default_config.cc
+++ b/paludis/default_config.cc
@@ -266,3 +266,6 @@ DefaultConfig::DefaultConfig()
}
}
+DefaultConfig::~DefaultConfig()
+{
+}
diff --git a/paludis/default_config.hh b/paludis/default_config.hh
index b68dc8d..62582fa 100644
--- a/paludis/default_config.hh
+++ b/paludis/default_config.hh
@@ -83,6 +83,8 @@ namespace paludis
private:
DefaultConfig();
+ ~DefaultConfig();
+
std::list<RepositoryConfigEntry> _repos;
std::map<QualifiedPackageName, std::vector<
diff --git a/paludis/dep_list_TEST.cc b/paludis/dep_list_TEST.cc
index 1b3d235..b0a41d4 100644
--- a/paludis/dep_list_TEST.cc
+++ b/paludis/dep_list_TEST.cc
@@ -234,60 +234,64 @@ namespace test_cases
{
DepListDepFailureTest() : TestCase("dep failure") { }
- void run_d(VersionMetadataKey dep_kind)
+ void run_d(VersionMetadataKey dep_kind) PALUDIS_ATTRIBUTE((noinline));
+
+ void run()
{
- TestMessageSuffix suffix(stringify(dep_kind), true);
- TestEnvironment e;
+ run_d(vmk_depend);
+ run_d(vmk_rdepend);
+ run_d(vmk_pdepend);
+ }
+ } test_dep_list_dep_failure;
- /* t/one DEPENDs upon t/two and t/three. t/three has unresolvable
- * deps. */
- FakeRepository::Pointer repo(new FakeRepository(RepositoryName("repo")));
+ void
+ DepListDepFailureTest::run_d(VersionMetadataKey dep_kind)
+ {
+ TestMessageSuffix suffix(stringify(dep_kind), true);
+ TestEnvironment e;
- repo->add_version(CategoryNamePart("t"), PackageNamePart("one"), VersionSpec("1.0"))->
- set(vmk_slot, "slot1").
- set(dep_kind, "t/two t/three");
+ /* t/one DEPENDs upon t/two and t/three. t/three has unresolvable
+ * deps. */
+ FakeRepository::Pointer repo(new FakeRepository(RepositoryName("repo")));
- repo->add_version(CategoryNamePart("t"), PackageNamePart("two"), VersionSpec("1.0"))->
- set(vmk_slot, "slot2");
+ repo->add_version(CategoryNamePart("t"), PackageNamePart("one"), VersionSpec("1.0"))->
+ set(vmk_slot, "slot1").
+ set(dep_kind, "t/two t/three");
- repo->add_version(CategoryNamePart("t"), PackageNamePart("three"), VersionSpec("1.0"))->
- set(vmk_slot, "slot3").
- set(dep_kind, "t/bad");
+ repo->add_version(CategoryNamePart("t"), PackageNamePart("two"), VersionSpec("1.0"))->
+ set(vmk_slot, "slot2");
- e.package_db()->add_repository(repo);
+ repo->add_version(CategoryNamePart("t"), PackageNamePart("three"), VersionSpec("1.0"))->
+ set(vmk_slot, "slot3").
+ set(dep_kind, "t/bad");
- FakeRepository::Pointer installed(new FakeRepository(RepositoryName("installed")));
- e.installed_db()->add_repository(installed);
+ e.package_db()->add_repository(repo);
- DepList d(&e);
- TEST_CHECK_THROWS(d.add(DepParser::parse("t/one")), Exception);
- TEST_CHECK(d.begin() == d.end());
+ FakeRepository::Pointer installed(new FakeRepository(RepositoryName("installed")));
+ e.installed_db()->add_repository(installed);
- /* try again, with some stuff already in the dep list. */
- d.add(DepParser::parse("t/two"));
- DepList::Iterator di(d.begin()), di_end(d.end());
- TEST_CHECK(di != di_end);
- TEST_CHECK_EQUAL(*di, DepListEntry(
- QualifiedPackageName(CategoryNamePart("t"), PackageNamePart("two")),
- VersionSpec("1.0"), SlotName("slot2"), RepositoryName("repo")));
- TEST_CHECK(++di == di_end);
+ DepList d(&e);
+ TEST_CHECK_THROWS(d.add(DepParser::parse("t/one")), Exception);
+ TEST_CHECK(d.begin() == d.end());
- TEST_CHECK_THROWS(d.add(DepParser::parse("t/one")), Exception);
- di = d.begin();
- TEST_CHECK(di != di_end);
- TEST_CHECK_EQUAL(*di, DepListEntry(
- QualifiedPackageName(CategoryNamePart("t"), PackageNamePart("two")),
- VersionSpec("1.0"), SlotName("slot2"), RepositoryName("repo")));
- TEST_CHECK(++di == di_end);
- }
+ /* try again, with some stuff already in the dep list. */
+ d.add(DepParser::parse("t/two"));
+ DepList::Iterator di(d.begin()), di_end(d.end());
+ TEST_CHECK(di != di_end);
+ TEST_CHECK_EQUAL(*di, DepListEntry(
+ QualifiedPackageName(CategoryNamePart("t"), PackageNamePart("two")),
+ VersionSpec("1.0"), SlotName("slot2"), RepositoryName("repo")));
+ TEST_CHECK(++di == di_end);
+
+ TEST_CHECK_THROWS(d.add(DepParser::parse("t/one")), Exception);
+ di = d.begin();
+ TEST_CHECK(di != di_end);
+ TEST_CHECK_EQUAL(*di, DepListEntry(
+ QualifiedPackageName(CategoryNamePart("t"), PackageNamePart("two")),
+ VersionSpec("1.0"), SlotName("slot2"), RepositoryName("repo")));
+ TEST_CHECK(++di == di_end);
+ }
- void run()
- {
- run_d(vmk_depend);
- run_d(vmk_rdepend);
- run_d(vmk_pdepend);
- }
- } test_dep_list_dep_failure;
/**
* \test Test dep list: indirect circular deps.
@@ -437,63 +441,7 @@ namespace test_cases
{
DepListComplexMetOrDepTest() : TestCase("complex met or dep") { }
- void run_n(int n)
- {
- TestEnvironment e;
-#if ((! defined(__GNUC__)) || ((__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)))
- TestMessageSuffix(stringify(n), true);
-# endif
-
- /* t/one DEPENDs upon
- * || (
- * ( t/two t/three )
- * (
- * t/four
- * || (
- * t/five
- * ( t/six t/seven )
- * )
- * )
- * )
- */
- FakeRepository::Pointer repo(new FakeRepository(RepositoryName("repo")));
-
- repo->add_version(CategoryNamePart("t"), PackageNamePart("one"), VersionSpec("1.0"))->
- set(vmk_slot, "1").
- set(vmk_depend, "|| ( ( t/two t/three ) ( t/four || ( t/five ( t/six t/seven ) ) ) )");
-
- e.package_db()->add_repository(repo);
-
- FakeRepository::Pointer installed(new FakeRepository(RepositoryName("installed")));
-
- if (n == 1)
- {
- installed->add_version(CategoryNamePart("t"), PackageNamePart("two"), VersionSpec("1.0"));
- installed->add_version(CategoryNamePart("t"), PackageNamePart("three"), VersionSpec("1.0"));
- }
- else if (n == 2)
- {
- installed->add_version(CategoryNamePart("t"), PackageNamePart("four"), VersionSpec("1.0"));
- installed->add_version(CategoryNamePart("t"), PackageNamePart("five"), VersionSpec("1.0"));
- }
- else if (n == 3)
- {
- installed->add_version(CategoryNamePart("t"), PackageNamePart("four"), VersionSpec("1.0"));
- installed->add_version(CategoryNamePart("t"), PackageNamePart("six"), VersionSpec("1.0"));
- installed->add_version(CategoryNamePart("t"), PackageNamePart("seven"), VersionSpec("1.0"));
- }
-
- e.installed_db()->add_repository(installed);
-
- DepList d(&e);
- d.add(DepParser::parse("t/one"));
- DepList::Iterator di(d.begin()), di_end(d.end());
- TEST_CHECK(di != di_end);
- TEST_CHECK_EQUAL(*di, DepListEntry(
- QualifiedPackageName(CategoryNamePart("t"), PackageNamePart("one")),
- VersionSpec("1.0"), SlotName("1"), RepositoryName("repo")));
- TEST_CHECK(++di == di_end);
- }
+ void run_n(int n) PALUDIS_ATTRIBUTE((noinline));
void run()
{
@@ -502,6 +450,66 @@ namespace test_cases
}
} test_dep_list_complex_met_or_dep;
+ void
+ DepListComplexMetOrDepTest::run_n(int n)
+ {
+ TestEnvironment e;
+#if ((! defined(__GNUC__)) || ((__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)))
+ TestMessageSuffix(stringify(n), true);
+# endif
+
+ /* t/one DEPENDs upon
+ * || (
+ * ( t/two t/three )
+ * (
+ * t/four
+ * || (
+ * t/five
+ * ( t/six t/seven )
+ * )
+ * )
+ * )
+ */
+ FakeRepository::Pointer repo(new FakeRepository(RepositoryName("repo")));
+
+ repo->add_version(CategoryNamePart("t"), PackageNamePart("one"), VersionSpec("1.0"))->
+ set(vmk_slot, "1").
+ set(vmk_depend, "|| ( ( t/two t/three ) ( t/four || ( t/five ( t/six t/seven ) ) ) )");
+
+ e.package_db()->add_repository(repo);
+
+ FakeRepository::Pointer installed(new FakeRepository(RepositoryName("installed")));
+
+ if (n == 1)
+ {
+ installed->add_version(CategoryNamePart("t"), PackageNamePart("two"), VersionSpec("1.0"));
+ installed->add_version(CategoryNamePart("t"), PackageNamePart("three"), VersionSpec("1.0"));
+ }
+ else if (n == 2)
+ {
+ installed->add_version(CategoryNamePart("t"), PackageNamePart("four"), VersionSpec("1.0"));
+ installed->add_version(CategoryNamePart("t"), PackageNamePart("five"), VersionSpec("1.0"));
+ }
+ else if (n == 3)
+ {
+ installed->add_version(CategoryNamePart("t"), PackageNamePart("four"), VersionSpec("1.0"));
+ installed->add_version(CategoryNamePart("t"), PackageNamePart("six"), VersionSpec("1.0"));
+ installed->add_version(CategoryNamePart("t"), PackageNamePart("seven"), VersionSpec("1.0"));
+ }
+
+ e.installed_db()->add_repository(installed);
+
+ DepList d(&e);
+ d.add(DepParser::parse("t/one"));
+ DepList::Iterator di(d.begin()), di_end(d.end());
+ TEST_CHECK(di != di_end);
+ TEST_CHECK_EQUAL(*di, DepListEntry(
+ QualifiedPackageName(CategoryNamePart("t"), PackageNamePart("one")),
+ VersionSpec("1.0"), SlotName("1"), RepositoryName("repo")));
+ TEST_CHECK(++di == di_end);
+ }
+
+
/**
* \test Test dep list: complex unmet or dep.
*
@@ -511,58 +519,7 @@ namespace test_cases
{
DepListComplexUnmetOrDepTest() : TestCase("complex unmet or dep") { }
- void run_n(int n)
- {
- TestEnvironment e;
- TestMessageSuffix suffix(stringify(n), true);
-
- /* t/one DEPENDs upon
- * || (
- * ( t/two t/three )
- * (
- * t/four
- * || (
- * t/five
- * ( t/six t/seven )
- * )
- * )
- * )
- */
- FakeRepository::Pointer repo(new FakeRepository(RepositoryName("repo")));
-
- repo->add_version(CategoryNamePart("t"), PackageNamePart("one"), VersionSpec("1.0"))->
- set(vmk_slot, "1").
- set(vmk_depend, "|| ( ( t/two t/three ) ( t/four || ( t/five ( t/six t/seven ) ) ) )");
-
- e.package_db()->add_repository(repo);
-
- FakeRepository::Pointer installed(new FakeRepository(RepositoryName("installed")));
-
- if (n == 1)
- {
- installed->add_version(CategoryNamePart("t"), PackageNamePart("two"), VersionSpec("1.0"));
- }
- else if (n == 2)
- {
- installed->add_version(CategoryNamePart("t"), PackageNamePart("three"), VersionSpec("1.0"));
- }
- else if (n == 3)
- {
- installed->add_version(CategoryNamePart("t"), PackageNamePart("five"), VersionSpec("1.0"));
- }
- else if (n == 4)
- {
- installed->add_version(CategoryNamePart("t"), PackageNamePart("four"), VersionSpec("1.0"));
- installed->add_version(CategoryNamePart("t"), PackageNamePart("seven"), VersionSpec("1.0"));
- }
-
- e.installed_db()->add_repository(installed);
-
- DepList d(&e);
- TEST_CHECK(d.begin() == d.end());
- TEST_CHECK_THROWS(d.add(DepParser::parse("t/one")), DepListError);
- TEST_CHECK(d.begin() == d.end());
- }
+ void run_n(int n) PALUDIS_ATTRIBUTE((noinline));
void run()
{
@@ -571,6 +528,60 @@ namespace test_cases
}
} test_dep_list_complex_unmet_or_dep;
+ void
+ DepListComplexUnmetOrDepTest::run_n(int n)
+ {
+ TestEnvironment e;
+ TestMessageSuffix suffix(stringify(n), true);
+
+ /* t/one DEPENDs upon
+ * || (
+ * ( t/two t/three )
+ * (
+ * t/four
+ * || (
+ * t/five
+ * ( t/six t/seven )
+ * )
+ * )
+ * )
+ */
+ FakeRepository::Pointer repo(new FakeRepository(RepositoryName("repo")));
+
+ repo->add_version(CategoryNamePart("t"), PackageNamePart("one"), VersionSpec("1.0"))->
+ set(vmk_slot, "1").
+ set(vmk_depend, "|| ( ( t/two t/three ) ( t/four || ( t/five ( t/six t/seven ) ) ) )");
+
+ e.package_db()->add_repository(repo);
+
+ FakeRepository::Pointer installed(new FakeRepository(RepositoryName("installed")));
+
+ if (n == 1)
+ {
+ installed->add_version(CategoryNamePart("t"), PackageNamePart("two"), VersionSpec("1.0"));
+ }
+ else if (n == 2)
+ {
+ installed->add_version(CategoryNamePart("t"), PackageNamePart("three"), VersionSpec("1.0"));
+ }
+ else if (n == 3)
+ {
+ installed->add_version(CategoryNamePart("t"), PackageNamePart("five"), VersionSpec("1.0"));
+ }
+ else if (n == 4)
+ {
+ installed->add_version(CategoryNamePart("t"), PackageNamePart("four"), VersionSpec("1.0"));
+ installed->add_version(CategoryNamePart("t"), PackageNamePart("seven"), VersionSpec("1.0"));
+ }
+
+ e.installed_db()->add_repository(installed);
+
+ DepList d(&e);
+ TEST_CHECK(d.begin() == d.end());
+ TEST_CHECK_THROWS(d.add(DepParser::parse("t/one")), DepListError);
+ TEST_CHECK(d.begin() == d.end());
+ }
+
/**
* \test Test dep list: or all use dep.
*
diff --git a/paludis/filter_insert_iterator.hh b/paludis/filter_insert_iterator.hh
index 22d0ac3..51ee8c5 100644
--- a/paludis/filter_insert_iterator.hh
+++ b/paludis/filter_insert_iterator.hh
@@ -74,6 +74,11 @@ namespace paludis
}
/**
+ * Destructor.
+ */
+ ~FilterInsertIterator();
+
+ /**
* Dereference.
*/
FilterInsertIterator & operator* ()
@@ -106,6 +111,11 @@ namespace paludis
}
};
+ template <typename Iter_, typename Pred_>
+ FilterInsertIterator<Iter_, Pred_>::~FilterInsertIterator()
+ {
+ }
+
/**
* Convenience function: make a FilterInsertIterator.
*
diff --git a/paludis/fs_entry.cc b/paludis/fs_entry.cc
index 4f3dd92..3cad06a 100644
--- a/paludis/fs_entry.cc
+++ b/paludis/fs_entry.cc
@@ -73,6 +73,12 @@ FSEntry::operator/ (const FSEntry & rhs) const
return FSEntry(_path + "/" + rhs._path);
}
+FSEntry
+FSEntry::operator/ (const std::string & rhs) const
+{
+ return operator/ (FSEntry(rhs));
+}
+
const FSEntry &
FSEntry::operator/= (const FSEntry & rhs)
{
diff --git a/paludis/fs_entry.hh b/paludis/fs_entry.hh
index 263acdf..36d6778 100644
--- a/paludis/fs_entry.hh
+++ b/paludis/fs_entry.hh
@@ -81,10 +81,7 @@ namespace paludis
/**
* Join with another path.
*/
- FSEntry operator/ (const std::string & rhs) const
- {
- return operator/ (FSEntry(rhs));
- }
+ FSEntry operator/ (const std::string & rhs) const;
/**
* Append another path.
diff --git a/paludis/instantiation_policy.hh b/paludis/instantiation_policy.hh
index dcf6aaa..9d083fc 100644
--- a/paludis/instantiation_policy.hh
+++ b/paludis/instantiation_policy.hh
@@ -173,12 +173,16 @@ namespace paludis
/**
* Fetch our instance.
*/
- static OurType_ * get_instance()
- {
- static OurType_ instance;
- return &instance;
- }
+ static OurType_ * get_instance();
};
+
+ template<typename OurType_>
+ OurType_ *
+ InstantiationPolicy<OurType_, instantiation_method::SingletonAsNeededTag>::get_instance()
+ {
+ static OurType_ instance;
+ return &instance;
+ }
}
#endif
diff --git a/paludis/key_value_config_file.cc b/paludis/key_value_config_file.cc
index 0793b13..47bd0a3 100644
--- a/paludis/key_value_config_file.cc
+++ b/paludis/key_value_config_file.cc
@@ -30,6 +30,10 @@ KeyValueConfigFile::KeyValueConfigFile(std::istream * const s) :
need_lines();
}
+KeyValueConfigFile::~KeyValueConfigFile()
+{
+}
+
void
KeyValueConfigFile::accept_line(const std::string & line) const
{
diff --git a/paludis/key_value_config_file.hh b/paludis/key_value_config_file.hh
index 0d2ac95..8f6f2e1 100644
--- a/paludis/key_value_config_file.hh
+++ b/paludis/key_value_config_file.hh
@@ -54,6 +54,8 @@ namespace paludis
public:
KeyValueConfigFile(std::istream * const);
+ ~KeyValueConfigFile();
+
typedef std::map<std::string, std::string>::const_iterator Iterator;
Iterator begin() const
diff --git a/paludis/package_dep_atom.cc b/paludis/package_dep_atom.cc
index 40bc31c..319fadd 100644
--- a/paludis/package_dep_atom.cc
+++ b/paludis/package_dep_atom.cc
@@ -107,6 +107,10 @@ PackageDepAtom::PackageDepAtom(const std::string & s) :
}
}
+PackageDepAtom::~PackageDepAtom()
+{
+}
+
std::ostream &
paludis::operator<< (std::ostream & s, const PackageDepAtom & a)
{
diff --git a/paludis/package_dep_atom.hh b/paludis/package_dep_atom.hh
index 8dc4936..01a8fec 100644
--- a/paludis/package_dep_atom.hh
+++ b/paludis/package_dep_atom.hh
@@ -73,6 +73,11 @@ namespace paludis
PackageDepAtom(const std::string &);
/**
+ * Destructor.
+ */
+ ~PackageDepAtom();
+
+ /**
* Fetch the package name.
*/
const QualifiedPackageName & package() const
diff --git a/paludis/portage_repository.cc b/paludis/portage_repository.cc
index 08d1399..304cc39 100644
--- a/paludis/portage_repository.cc
+++ b/paludis/portage_repository.cc
@@ -87,19 +87,28 @@ namespace paludis
mutable bool has_profile;
/// Constructor.
- Implementation(const FSEntry & l, const FSEntry & p) :
- location(l),
- profile(p),
- has_category_names(false),
- has_repo_mask(false)
- {
- }
+ Implementation(const FSEntry & l, const FSEntry & p);
+
+ /// Destructor.
+ ~Implementation();
/// Add a use.mask, use from a profile directory, recursive.
void add_profile(const FSEntry & f) const;
};
}
+Implementation<PortageRepository>::Implementation(const FSEntry & l, const FSEntry & p) :
+ location(l),
+ profile(p),
+ has_category_names(false),
+ has_repo_mask(false)
+{
+}
+
+Implementation<PortageRepository>::~Implementation()
+{
+}
+
void
Implementation<PortageRepository>::add_profile(const FSEntry & f) const
{
diff --git a/paludis/smart_record.hh.m4 b/paludis/smart_record.hh.m4
index 065732f..2c2df41 100644
--- a/paludis/smart_record.hh.m4
+++ b/paludis/smart_record.hh.m4
@@ -402,6 +402,8 @@ forloop(`idy', `0', decr(`'idx`'), `
')
public:
+ ~RecordBase();
+
RecordBase(
ifelse(idx, `1', `', `forloop(`idy', `0', decr(decr(idx)), `
const typename Tag_::KeyType`'idy`' & p`'idy`',
@@ -439,6 +441,11 @@ forloop(`idy', `0', decr(idx), `
return RecordKeyGetter<Tag_, `'idx`', k_>::do_get(*this);
}
};
+
+ template<typename Tag_>
+ RecordBase<Tag_, `'idx`'>::~RecordBase()
+ {
+ }
')
forloop(`idx', `0', max_record_size, `
diff --git a/paludis/tokeniser.hh b/paludis/tokeniser.hh
index 1c3e231..3d7494e 100644
--- a/paludis/tokeniser.hh
+++ b/paludis/tokeniser.hh
@@ -160,46 +160,52 @@ namespace paludis
}
template <typename Iter_>
- void tokenise(const std::basic_string<Char_> & s, Iter_ iter) const
- {
- typename std::basic_string<Char_>::size_type p(0), old_p(0);
- bool in_delim((! s.empty()) && std::basic_string<Char_>::npos != _delims.find(s[0]));
+ void tokenise(const std::basic_string<Char_> & s, Iter_ iter) const;
+ };
- for ( ; p < s.length() ; ++p)
+ template <typename DelimMode_, typename Char_>
+ template <typename Iter_>
+ void
+ Tokeniser<delim_kind::AnyOfTag, DelimMode_, Char_>::tokenise(
+ const std::basic_string<Char_> & s, Iter_ iter) const
+ {
+ typename std::basic_string<Char_>::size_type p(0), old_p(0);
+ bool in_delim((! s.empty()) && std::basic_string<Char_>::npos != _delims.find(s[0]));
+
+ for ( ; p < s.length() ; ++p)
+ {
+ if (in_delim)
+ {
+ if (std::basic_string<Char_>::npos == _delims.find(s[p]))
{
- if (in_delim)
- {
- if (std::basic_string<Char_>::npos == _delims.find(s[p]))
- {
- tokeniser_internals::Writer<DelimMode_, Char_, Iter_>::handle_delim(
- s.substr(old_p, p - old_p), iter);
- in_delim = false;
- old_p = p;
- }
- }
- else
- {
- if (std::basic_string<Char_>::npos != _delims.find(s[p]))
- {
- tokeniser_internals::Writer<DelimMode_, Char_, Iter_>::handle_token(
- s.substr(old_p, p - old_p), iter);
- in_delim = true;
- old_p = p;
- }
- }
+ tokeniser_internals::Writer<DelimMode_, Char_, Iter_>::handle_delim(
+ s.substr(old_p, p - old_p), iter);
+ in_delim = false;
+ old_p = p;
}
-
- if (old_p != p)
+ }
+ else
+ {
+ if (std::basic_string<Char_>::npos != _delims.find(s[p]))
{
- if (in_delim)
- tokeniser_internals::Writer<DelimMode_, Char_, Iter_>::handle_delim(
- s.substr(old_p, p - old_p), iter);
- else
- tokeniser_internals::Writer<DelimMode_, Char_, Iter_>::handle_token(
- s.substr(old_p, p - old_p), iter);
+ tokeniser_internals::Writer<DelimMode_, Char_, Iter_>::handle_token(
+ s.substr(old_p, p - old_p), iter);
+ in_delim = true;
+ old_p = p;
}
}
- };
+ }
+
+ if (old_p != p)
+ {
+ if (in_delim)
+ tokeniser_internals::Writer<DelimMode_, Char_, Iter_>::handle_delim(
+ s.substr(old_p, p - old_p), iter);
+ else
+ tokeniser_internals::Writer<DelimMode_, Char_, Iter_>::handle_token(
+ s.substr(old_p, p - old_p), iter);
+ }
+ }
}
diff --git a/paludis/version_metadata.cc b/paludis/version_metadata.cc
index 868b0ea..e8ffd81 100644
--- a/paludis/version_metadata.cc
+++ b/paludis/version_metadata.cc
@@ -57,13 +57,15 @@ namespace paludis
/**
* Constructor.
*/
- Implementation()
- {
- values.resize(static_cast<unsigned>(last_vmk));
- }
+ Implementation();
};
}
+Implementation<VersionMetadata>::Implementation()
+{
+ values.resize(static_cast<unsigned>(last_vmk));
+}
+
VersionMetadata::VersionMetadata() :
PrivateImplementationPattern<VersionMetadata>(new Implementation<VersionMetadata>())
{
diff --git a/src/command_line.cc b/src/command_line.cc
index 25416d6..d0802c7 100644
--- a/src/command_line.cc
+++ b/src/command_line.cc
@@ -20,8 +20,6 @@
#include "src/command_line.hh"
-#ifndef DOXYGEN
-
CommandLine::CommandLine() :
ArgsHandler(),
@@ -59,5 +57,7 @@ CommandLine::CommandLine() :
a_dl_max_stack_depth.set_argument(100);
}
-#endif
+CommandLine::~CommandLine()
+{
+}
diff --git a/src/command_line.hh b/src/command_line.hh
index d952b54..7d808bb 100644
--- a/src/command_line.hh
+++ b/src/command_line.hh
@@ -41,6 +41,9 @@ class CommandLine :
/// Constructor.
CommandLine();
+ /// Destructor.
+ ~CommandLine();
+
public:
/// \name Action arguments
///{
diff --git a/test/test_framework.cc b/test/test_framework.cc
index a7234fe..8b60de4 100644
--- a/test/test_framework.cc
+++ b/test/test_framework.cc
@@ -155,49 +155,52 @@ class RunTest
{
}
- void operator() (TestCase * test_case) const
+ void operator() (TestCase * test_case) const;
+};
+
+void
+RunTest::operator() (TestCase * test_case) const
+{
+ bool had_local_failure(false);
+
+ std::cout << "* \"" << test_case->name() << "\": " << std::flush;
+
+ for (int repeat = 0 ; repeat < 2 ; ++repeat)
+ {
+ if (0 != repeat)
+ std::cout << " (repeat): " << std::flush;
+
+ try
{
- bool had_local_failure(false);
-
- std::cout << "* \"" << test_case->name() << "\": " << std::flush;
-
- for (int repeat = 0 ; repeat < 2 ; ++repeat)
- {
- if (0 != repeat)
- std::cout << " (repeat): " << std::flush;
-
- try
- {
- alarm(test_case->max_run_time());
- test_case->call_run();
- alarm(0);
- }
- catch (std::exception &e)
- {
- std::cout << "!{" << std::endl << exception_to_debug_string(e) <<
- std::endl << " } " << std::flush;
- had_local_failure = true;
- *_had_a_failure = true;
- }
- catch (...)
- {
- std::cout << "!{Unknown exception type} ";
- had_local_failure = true;
- *_had_a_failure = true;
- }
-
- if (had_local_failure)
- std::cout << " NOT OK";
- else
- std::cout << " OK";
-
- std::cout << std::endl;
-
- if (! test_case->repeatable())
- break;
- }
+ alarm(test_case->max_run_time());
+ test_case->call_run();
+ alarm(0);
}
-};
+ catch (std::exception &e)
+ {
+ std::cout << "!{" << std::endl << exception_to_debug_string(e) <<
+ std::endl << " } " << std::flush;
+ had_local_failure = true;
+ *_had_a_failure = true;
+ }
+ catch (...)
+ {
+ std::cout << "!{Unknown exception type} ";
+ had_local_failure = true;
+ *_had_a_failure = true;
+ }
+
+ if (had_local_failure)
+ std::cout << " NOT OK";
+ else
+ std::cout << " OK";
+
+ std::cout << std::endl;
+
+ if (! test_case->repeatable())
+ break;
+ }
+}
bool
TestCaseList::run_tests()