aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-02-24 00:25:46 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-02-24 00:25:46 +0000
commita632d1308dc78d9424175c7af5641de50b288e87 (patch)
treeeb23d962e021f986f3720e23ca8bc8d1d82e0165
parent8abf01f6237bdfa99a29fc4f13a4bc70e177c295 (diff)
downloadpaludis-a632d1308dc78d9424175c7af5641de50b288e87.tar.gz
paludis-a632d1308dc78d9424175c7af5641de50b288e87.tar.xz
Be much stricter. Trunk is now 0.21.
-rw-r--r--configure.ac2
-rw-r--r--paludis/config_file.hh15
-rw-r--r--paludis/contents.hh6
-rw-r--r--paludis/dep_spec.hh21
-rw-r--r--paludis/environment.cc50
-rw-r--r--paludis/environment.hh94
-rw-r--r--paludis/match_package.hh6
-rw-r--r--paludis/package_database.hh38
-rw-r--r--paludis/repositories/gentoo/ebin.cc3
-rw-r--r--paludis/repository.hh123
-rw-r--r--paludis/util/dir_iterator.hh12
-rw-r--r--paludis/util/fs_entry.hh60
-rw-r--r--paludis/util/fs_entry_TEST.cc16
-rw-r--r--paludis/util/instantiation_policy.hh3
-rw-r--r--paludis/util/instantiation_policy_TEST.cc2
-rw-r--r--paludis/util/is_file_with_extension.hh5
-rw-r--r--paludis/util/log.hh3
-rw-r--r--paludis/util/strip.hh14
-rw-r--r--paludis/util/system.hh3
-rw-r--r--paludis/util/system_TEST.cc4
-rw-r--r--src/clients/paludis/applets.cc8
-rw-r--r--test/test_framework.hh35
22 files changed, 351 insertions, 172 deletions
diff --git a/configure.ac b/configure.ac
index 7e527b8..246c484 100644
--- a/configure.ac
+++ b/configure.ac
@@ -6,7 +6,7 @@ AC_INIT([paludis/paludis.hh])
AC_CONFIG_AUX_DIR(config)
VERSION_MAJOR=0
-VERSION_MINOR=20
+VERSION_MINOR=21
VERSION_MICRO=0
VERSION_FULL="$VERSION_MAJOR.$VERSION_MINOR.$VERSION_MICRO"
VERSION="$VERSION_FULL"
diff --git a/paludis/config_file.hh b/paludis/config_file.hh
index 73cc2e0..302d6e7 100644
--- a/paludis/config_file.hh
+++ b/paludis/config_file.hh
@@ -191,9 +191,11 @@ namespace paludis
typedef libwrapiter::ForwardIterator<LineConfigFile, const std::string> Iterator;
- Iterator begin() const;
+ Iterator begin() const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
- Iterator end() const;
+ Iterator end() const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
///\}
};
@@ -294,16 +296,19 @@ namespace paludis
typedef libwrapiter::ForwardIterator<KeyValueConfigFile,
std::pair<const std::string, std::string> > Iterator;
- Iterator begin() const;
+ Iterator begin() const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
- Iterator end() const;
+ Iterator end() const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
///\}
/**
* Fetch the specified key, or a blank string.
*/
- std::string get(const std::string & key) const;
+ std::string get(const std::string & key) const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
};
}
diff --git a/paludis/contents.hh b/paludis/contents.hh
index 8e8040b..6de6b13 100644
--- a/paludis/contents.hh
+++ b/paludis/contents.hh
@@ -241,9 +241,11 @@ namespace paludis
typedef libwrapiter::ForwardIterator<Contents, const std::tr1::shared_ptr<const ContentsEntry> > Iterator;
- Iterator begin() const;
+ Iterator begin() const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
- Iterator end() const;
+ Iterator end() const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
///\}
};
diff --git a/paludis/dep_spec.hh b/paludis/dep_spec.hh
index bd4b19c..301349c 100644
--- a/paludis/dep_spec.hh
+++ b/paludis/dep_spec.hh
@@ -86,13 +86,15 @@ namespace paludis
* Return us as a UseDepSpec, or 0 if we are not a
* UseDepSpec.
*/
- virtual const UseDepSpec * as_use_dep_spec() const;
+ virtual const UseDepSpec * as_use_dep_spec() const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
/**
* Return us as a PackageDepSpec, or 0 if we are not a
* UseDepSpec.
*/
- virtual const PackageDepSpec * as_package_dep_spec() const;
+ virtual const PackageDepSpec * as_package_dep_spec() const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
///\}
};
@@ -139,9 +141,11 @@ namespace paludis
typedef libwrapiter::ForwardIterator<CompositeDepSpec, const std::tr1::shared_ptr<const DepSpec> > Iterator;
- Iterator begin() const;
+ Iterator begin() const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
- Iterator end() const;
+ Iterator end() const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
///\}
};
@@ -289,13 +293,16 @@ namespace paludis
///\}
/// Find the requirement for a particular USE flag.
- Iterator find(const UseFlagName & u) const;
+ Iterator find(const UseFlagName & u) const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
/// Insert a new requirement.
- bool insert(const UseFlagName & u, UseFlagState s);
+ bool insert(const UseFlagName & u, UseFlagState s)
+ PALUDIS_ATTRIBUTE((warn_unused_result));
/// What state is desired for a particular use flag?
- UseFlagState state(const UseFlagName &) const;
+ UseFlagState state(const UseFlagName &) const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
};
/**
diff --git a/paludis/environment.cc b/paludis/environment.cc
index 7f418ab..9b31530 100644
--- a/paludis/environment.cc
+++ b/paludis/environment.cc
@@ -38,8 +38,7 @@
using namespace paludis;
Environment::Environment(std::tr1::shared_ptr<PackageDatabase> d) :
- _package_database(d),
- _has_provide_map(false)
+ _package_database(d)
{
}
@@ -406,8 +405,33 @@ Environment::remove_set_from_world(const SetName & s,
ww->remove_callback(s);
}
+namespace paludis
+{
+ template<>
+ struct Implementation<Hook>
+ {
+ std::string name;
+ std::map<std::string, std::string> extra_env;
+
+ Implementation(const std::string & n, const std::map<std::string, std::string> & e) :
+ name(n),
+ extra_env(e)
+ {
+ }
+ };
+}
+
Hook::Hook(const std::string & n) :
- _name(n)
+ PrivateImplementationPattern<Hook>(new Implementation<Hook>(n, std::map<std::string, std::string>()))
+{
+}
+
+Hook::Hook(const Hook & h) :
+ PrivateImplementationPattern<Hook>(new Implementation<Hook>(h._imp->name, h._imp->extra_env))
+{
+}
+
+Hook::~Hook()
{
}
@@ -415,10 +439,28 @@ Hook
Hook::operator() (const std::string & k, const std::string & v) const
{
Hook result(*this);
- result._extra_env.insert(std::make_pair(k, v));
+ result._imp->extra_env.insert(std::make_pair(k, v));
return result;
}
+Hook::Iterator
+Hook::begin() const
+{
+ return Iterator(_imp->extra_env.begin());
+}
+
+Hook::Iterator
+Hook::end() const
+{
+ return Iterator(_imp->extra_env.end());
+}
+
+std::string
+Hook::name() const
+{
+ return _imp->name;
+}
+
bool
Environment::query_use(const UseFlagName & f, const PackageDatabaseEntry * e) const
{
diff --git a/paludis/environment.hh b/paludis/environment.hh
index 2985ed4..4884a0b 100644
--- a/paludis/environment.hh
+++ b/paludis/environment.hh
@@ -49,40 +49,37 @@ namespace paludis
*
* \ingroup grpenvironment
*/
- class Hook
+ class Hook :
+ private PrivateImplementationPattern<Hook>
{
- private:
- std::map<std::string, std::string> _extra_env;
-
- std::string _name;
-
public:
/// Constructor.
Hook(const std::string & name);
- /// Perform the hook.
- Hook operator() (const std::string & key, const std::string & value) const;
+ /// Copy constructor.
+ Hook(const Hook &);
+
+ /// Destructor.
+ ~Hook();
+
+ /// Add data to the hook.
+ Hook operator() (const std::string & key, const std::string & value) const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
/// Iterate over extra environment data.
- typedef std::map<std::string, std::string>::const_iterator Iterator;
+ typedef libwrapiter::ForwardIterator<Hook, const std::pair<const std::string, std::string> > Iterator;
/// Start of extra environment data.
Iterator begin() const
- {
- return _extra_env.begin();
- }
+ PALUDIS_ATTRIBUTE((warn_unused_result));
/// End of extra environment data.
Iterator end() const
- {
- return _extra_env.end();
- }
+ PALUDIS_ATTRIBUTE((warn_unused_result));
/// Our name.
std::string name() const
- {
- return _name;
- }
+ PALUDIS_ATTRIBUTE((warn_unused_result));
};
/**
@@ -98,10 +95,6 @@ namespace paludis
private:
std::tr1::shared_ptr<PackageDatabase> _package_database;
- mutable bool _has_provide_map;
-
- mutable std::map<QualifiedPackageName, QualifiedPackageName> _provide_map;
-
protected:
/**
* Constructor.
@@ -132,7 +125,8 @@ namespace paludis
* Default behaviour: all USE flags turned off, unless overridden by
* the repository for the pde.
*/
- virtual bool query_use(const UseFlagName &, const PackageDatabaseEntry *) const;
+ virtual bool query_use(const UseFlagName &, const PackageDatabaseEntry *) const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
/**
* Fetch any known use expand names (excluding prefix) that start with a
@@ -141,7 +135,8 @@ namespace paludis
* Default behaviour: no names known.
*/
virtual std::tr1::shared_ptr<const UseFlagNameCollection> known_use_expand_names(const UseFlagName &,
- const PackageDatabaseEntry *) const;
+ const PackageDatabaseEntry *) const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
/**
* Is the specified KEYWORD accepted?
@@ -149,42 +144,48 @@ namespace paludis
* Default behaviour: only "*" accepted.
*/
virtual bool accept_keyword(const KeywordName &, const PackageDatabaseEntry * const,
- const bool override_tilde_keywords = false) const;
+ const bool override_tilde_keywords = false) const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
/**
* Is the specified EAPI accepted?
*
* Default behaviour: known EAPIs accepted.
*/
- virtual bool accept_eapi(const std::string &) const;
+ virtual bool accept_eapi(const std::string &) const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
/**
* Is the specified LICENSE accepted?
*
* Default behaviour: yes.
*/
- virtual bool accept_license(const std::string &, const PackageDatabaseEntry * const) const;
+ virtual bool accept_license(const std::string &, const PackageDatabaseEntry * const) const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
/**
* Fetch the masks for a particular package.
*/
MaskReasons mask_reasons(const PackageDatabaseEntry &,
const bool override_tilde_keywords = false,
- const bool override_unkeyworded = false) const;
+ const bool override_unkeyworded = false) const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
/**
* Are there any user masks on a package?
*
* Default behaviour: no.
*/
- virtual bool query_user_masks(const PackageDatabaseEntry &) const;
+ virtual bool query_user_masks(const PackageDatabaseEntry &) const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
/**
* Are there any user unmasks on a package?
*
* Default behaviour: no.
*/
- virtual bool query_user_unmasks(const PackageDatabaseEntry &) const;
+ virtual bool query_user_unmasks(const PackageDatabaseEntry &) const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
/**
* Fetch our package database.
@@ -207,33 +208,38 @@ namespace paludis
*
* Default behaviour: none.
*/
- virtual std::string bashrc_files() const;
+ virtual std::string bashrc_files() const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
/**
* Our hook directories.
*
* Default behaviour: none.
*/
- virtual std::string hook_dirs() const;
+ virtual std::string hook_dirs() const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
/**
* Our fetchers directories.
*
* Default behaviour: user then paludis fetcher dirs.
*/
- virtual std::string fetchers_dirs() const;
+ virtual std::string fetchers_dirs() const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
/**
* Our syncers directories.
*
* Default behaviour: user then paludis syncer dirs.
*/
- virtual std::string syncers_dirs() const;
+ virtual std::string syncers_dirs() const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
/**
* How to run paludis.
*/
- virtual std::string paludis_command() const = 0;
+ virtual std::string paludis_command() const
+ PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
/**
* Destructor.
@@ -251,7 +257,8 @@ namespace paludis
* Default behaviour: no mirrors. If specialising, also do
* Environment::end_mirrors.
*/
- virtual MirrorIterator begin_mirrors(const std::string & mirror) const;
+ virtual MirrorIterator begin_mirrors(const std::string & mirror) const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
/**
* Iterator to past the end of our mirrors.
@@ -259,19 +266,22 @@ namespace paludis
* Default behaviour: no mirrors. If specialising, also do
* Environment::begin_mirrors.
*/
- virtual MirrorIterator end_mirrors(const std::string & mirror) const;
+ virtual MirrorIterator end_mirrors(const std::string & mirror) const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
/**
* Fetch a named package set.
*/
- std::tr1::shared_ptr<DepSpec> package_set(const SetName &) const;
+ std::tr1::shared_ptr<DepSpec> package_set(const SetName &) const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
/**
* Fetch all named sets. Does not include sets from repositories.
*
* Default behaviour: no sets.
*/
- virtual std::tr1::shared_ptr<const SetsCollection> sets_list() const;
+ virtual std::tr1::shared_ptr<const SetsCollection> sets_list() const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
/**
* Subclass for callbacks used by add_appropriate_to_world and
@@ -364,7 +374,8 @@ namespace paludis
*
* Default: /.
*/
- virtual FSEntry root() const;
+ virtual FSEntry root() const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
/**
* Default destinations.
@@ -372,7 +383,8 @@ namespace paludis
* Default: all repositories that provide RepositoryDestinationInterface and mark themselves
* as a default destination.
*/
- virtual std::tr1::shared_ptr<const DestinationsCollection> default_destinations() const;
+ virtual std::tr1::shared_ptr<const DestinationsCollection> default_destinations() const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
};
}
diff --git a/paludis/match_package.hh b/paludis/match_package.hh
index 095f91a..6d30390 100644
--- a/paludis/match_package.hh
+++ b/paludis/match_package.hh
@@ -27,7 +27,8 @@ namespace paludis
bool match_package(
const Environment & env,
const PackageDepSpec & spec,
- const PackageDatabaseEntry & target);
+ const PackageDatabaseEntry & target)
+ PALUDIS_ATTRIBUTE((warn_unused_result));
/**
* Return whether the specified spec matches the specified target, for heirarchies.
@@ -37,7 +38,8 @@ namespace paludis
bool match_package_in_heirarchy(
const Environment & env,
const DepSpec & spec,
- const PackageDatabaseEntry & target);
+ const PackageDatabaseEntry & target)
+ PALUDIS_ATTRIBUTE((warn_unused_result));
}
#endif
diff --git a/paludis/package_database.hh b/paludis/package_database.hh
index f0a8447..820a1ed 100644
--- a/paludis/package_database.hh
+++ b/paludis/package_database.hh
@@ -116,7 +116,7 @@ namespace paludis
/**
* The name of the package.
*/
- const std::string & name() const;
+ const std::string & name() const PALUDIS_ATTRIBUTE((warn_unused_result));
///\name Iterate over possible matches
///\{
@@ -124,8 +124,8 @@ namespace paludis
typedef libwrapiter::ForwardIterator<AmbiguousPackageNameError,
const std::string> OptionsIterator;
- OptionsIterator begin_options() const;
- OptionsIterator end_options() const;
+ OptionsIterator begin_options() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ OptionsIterator end_options() const PALUDIS_ATTRIBUTE((warn_unused_result));
///\}
};
@@ -260,12 +260,14 @@ namespace paludis
/**
* Fetch a named repository.
*/
- std::tr1::shared_ptr<const Repository> fetch_repository(const RepositoryName &) const;
+ std::tr1::shared_ptr<const Repository> fetch_repository(const RepositoryName &) const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
/**
* Fetch a named repository.
*/
- std::tr1::shared_ptr<Repository> fetch_repository(const RepositoryName &);
+ std::tr1::shared_ptr<Repository> fetch_repository(const RepositoryName &)
+ PALUDIS_ATTRIBUTE((warn_unused_result));
/**
* Fetch the name of our 'favourite' repository (if a repository's
@@ -275,13 +277,15 @@ namespace paludis
* Note that this is the repository with the <i>lowest</i> importance
* that is not a virtuals or installed_virtuals repository.
*/
- RepositoryName favourite_repository() const;
+ RepositoryName favourite_repository() const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
/**
* Disambiguate a package name.
*/
QualifiedPackageName fetch_unique_qualified_package_name(
- const PackageNamePart &) const;
+ const PackageNamePart &) const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
/**
* Query the repository.
@@ -290,35 +294,43 @@ namespace paludis
*/
std::tr1::shared_ptr<PackageDatabaseEntryCollection> query(
const PackageDepSpec & a,
- const InstallState) const;
+ const InstallState) const
+ PALUDIS_ATTRIBUTE((deprecated)) PALUDIS_ATTRIBUTE((warn_unused_result));
/**
* Query the repository.
+ *
+ * \deprecated use the Query form
*/
std::tr1::shared_ptr<PackageDatabaseEntryCollection> query(
const PackageDepSpec & a,
const InstallState,
- const QueryOrder) const;
+ const QueryOrder) const
+ PALUDIS_ATTRIBUTE((deprecated)) PALUDIS_ATTRIBUTE((warn_unused_result));
/**
* Query the repository.
*/
std::tr1::shared_ptr<PackageDatabaseEntryCollection> query(
- const Query &, const QueryOrder) const;
+ const Query &, const QueryOrder) const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
/**
* Return true if the first repository is more important than the second.
*/
- bool more_important_than(const RepositoryName &, const RepositoryName &) const;
+ bool more_important_than(const RepositoryName &, const RepositoryName &) const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
///\name Iterate over our repositories
///\{
typedef libwrapiter::ForwardIterator<PackageDatabase, const std::tr1::shared_ptr<Repository> > RepositoryIterator;
- RepositoryIterator begin_repositories() const;
+ RepositoryIterator begin_repositories() const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
- RepositoryIterator end_repositories() const;
+ RepositoryIterator end_repositories() const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
///\}
};
diff --git a/paludis/repositories/gentoo/ebin.cc b/paludis/repositories/gentoo/ebin.cc
index 314e74f..fc411bd 100644
--- a/paludis/repositories/gentoo/ebin.cc
+++ b/paludis/repositories/gentoo/ebin.cc
@@ -278,7 +278,8 @@ EbinMergeCommand::operator() ()
Command clean_env(Command("rm -f '.paludis-binpkg-environment'")
.with_chdir(merge_params.image)
.with_echo_to_stderr());
- run_command(clean_env);
+ if (0 != run_command(clean_env))
+ Log::get_instance()->message(ll_warning, lc_context, "Cleaning environment failed");
Command compress_tarball(Command("bzip2 '" + tar + "'")
.with_chdir(merge_params.image)
diff --git a/paludis/repository.hh b/paludis/repository.hh
index a8ad406..869bd54 100644
--- a/paludis/repository.hh
+++ b/paludis/repository.hh
@@ -111,7 +111,8 @@ namespace paludis
///\}
/// Our heading.
- std::string heading() const;
+ std::string heading() const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
///\name Iterate over our key/values
///\{
@@ -119,9 +120,11 @@ namespace paludis
typedef libwrapiter::ForwardIterator<RepositoryInfoSection,
const std::pair<const std::string, std::string> > KeyValueIterator;
- KeyValueIterator begin_kvs() const;
+ KeyValueIterator begin_kvs() const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
- KeyValueIterator end_kvs() const;
+ KeyValueIterator end_kvs() const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
///\}
@@ -153,9 +156,11 @@ namespace paludis
typedef libwrapiter::ForwardIterator<RepositoryInfo,
const std::tr1::shared_ptr<const RepositoryInfoSection> > SectionIterator;
- SectionIterator begin_sections() const;
+ SectionIterator begin_sections() const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
- SectionIterator end_sections() const;
+ SectionIterator end_sections() const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
///\}
@@ -214,47 +219,55 @@ namespace paludis
*/
virtual std::tr1::shared_ptr<const VersionMetadata> do_version_metadata(
const QualifiedPackageName &,
- const VersionSpec &) const = 0;
+ const VersionSpec &) const
+ PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
/**
* Override in descendents: check for a version.
*/
virtual bool do_has_version(const QualifiedPackageName &,
- const VersionSpec &) const = 0;
+ const VersionSpec &) const
+ PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
/**
* Override in descendents: fetch version specs.
*/
virtual std::tr1::shared_ptr<const VersionSpecCollection> do_version_specs(
- const QualifiedPackageName &) const = 0;
+ const QualifiedPackageName &) const
+ PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
/**
* Override in descendents: fetch package names.
*/
virtual std::tr1::shared_ptr<const QualifiedPackageNameCollection> do_package_names(
- const CategoryNamePart &) const = 0;
+ const CategoryNamePart &) const
+ PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
/**
* Override in descendents: fetch category names.
*/
- virtual std::tr1::shared_ptr<const CategoryNamePartCollection> do_category_names() const = 0;
+ virtual std::tr1::shared_ptr<const CategoryNamePartCollection> do_category_names() const
+ PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
/**
* Override in descendents if a fast implementation is available: fetch category names
* that contain a particular package.
*/
virtual std::tr1::shared_ptr<const CategoryNamePartCollection> do_category_names_containing_package(
- const PackageNamePart &) const;
+ const PackageNamePart &) const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
/**
* Override in descendents: check for a package.
*/
- virtual bool do_has_package_named(const QualifiedPackageName &) const = 0;
+ virtual bool do_has_package_named(const QualifiedPackageName &) const
+ PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
/**
* Override in descendents: check for a category.
*/
- virtual bool do_has_category_named(const CategoryNamePart &) const = 0;
+ virtual bool do_has_category_named(const CategoryNamePart &) const
+ PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
///\}
@@ -272,17 +285,20 @@ namespace paludis
/**
* Fetch information about the repository.
*/
- virtual std::tr1::shared_ptr<const RepositoryInfo> info(bool verbose) const;
+ virtual std::tr1::shared_ptr<const RepositoryInfo> info(bool verbose) const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
/**
* Return our name.
*/
- const RepositoryName & name() const PALUDIS_ATTRIBUTE((nothrow));
+ const RepositoryName & name() const PALUDIS_ATTRIBUTE((nothrow))
+ PALUDIS_ATTRIBUTE((warn_unused_result));
/**
* Return our format.
*/
- std::string format() const;
+ std::string format() const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
/**
* Are we allowed to be favourite repository?
@@ -402,13 +418,15 @@ namespace paludis
* Override in descendents: check for a mask.
*/
virtual bool do_query_repository_masks(const QualifiedPackageName &,
- const VersionSpec &) const = 0;
+ const VersionSpec &) const
+ PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
/**
* Override in descendents: check for a mask.
*/
virtual bool do_query_profile_masks(const QualifiedPackageName &,
- const VersionSpec &) const = 0;
+ const VersionSpec &) const
+ PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
///\}
@@ -453,43 +471,51 @@ namespace paludis
/**
* Override in descendents: get use.
*/
- virtual UseFlagState do_query_use(const UseFlagName &, const PackageDatabaseEntry *) const = 0;
+ virtual UseFlagState do_query_use(const UseFlagName &, const PackageDatabaseEntry *) const
+ PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
/**
* Override in descendents: get use mask.
*/
- virtual bool do_query_use_mask(const UseFlagName &, const PackageDatabaseEntry *) const = 0;
+ virtual bool do_query_use_mask(const UseFlagName &, const PackageDatabaseEntry *) const
+ PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
/**
* Override in descendents: get use force.
*/
- virtual bool do_query_use_force(const UseFlagName &, const PackageDatabaseEntry *) const = 0;
+ virtual bool do_query_use_force(const UseFlagName &, const PackageDatabaseEntry *) const
+ PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
/**
* Override in descendents: fetch all arch flags.
*/
- virtual std::tr1::shared_ptr<const UseFlagNameCollection> do_arch_flags() const = 0;
+ virtual std::tr1::shared_ptr<const UseFlagNameCollection> do_arch_flags() const
+ PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
/**
* Override in descendents: fetch all use expand flags.
*/
- virtual std::tr1::shared_ptr<const UseFlagNameCollection> do_use_expand_flags() const = 0;
+ virtual std::tr1::shared_ptr<const UseFlagNameCollection> do_use_expand_flags() const
+ PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
/**
* Override in descendents: fetch all use expand hidden prefixes.
*/
- virtual std::tr1::shared_ptr<const UseFlagNameCollection> do_use_expand_hidden_prefixes() const = 0;
+ virtual std::tr1::shared_ptr<const UseFlagNameCollection> do_use_expand_hidden_prefixes() const
+ PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
/**
* Override in descendents: fetch all use expand prefixes.
*/
- virtual std::tr1::shared_ptr<const UseFlagNameCollection> do_use_expand_prefixes() const = 0;
+ virtual std::tr1::shared_ptr<const UseFlagNameCollection> do_use_expand_prefixes() const
+ PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
/**
* Override in descendents: describe a use flag.
*/
virtual std::string do_describe_use_flag(const UseFlagName &,
- const PackageDatabaseEntry * const) const = 0;
+ const PackageDatabaseEntry * const) const
+ PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
///\}
@@ -616,7 +642,8 @@ namespace paludis
/**
* What is our filesystem root?
*/
- virtual FSEntry root() const = 0;
+ virtual FSEntry root() const
+ PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
///\}
@@ -722,7 +749,8 @@ namespace paludis
/**
* Override in descendents: package list.
*/
- virtual std::tr1::shared_ptr<DepSpec> do_package_set(const SetName & id) const = 0;
+ virtual std::tr1::shared_ptr<DepSpec> do_package_set(const SetName & id) const
+ PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
///\}
@@ -741,7 +769,8 @@ namespace paludis
/**
* Gives a list of the names of all the sets provided by this repo.
*/
- virtual std::tr1::shared_ptr<const SetsCollection> sets_list() const = 0;
+ virtual std::tr1::shared_ptr<const SetsCollection> sets_list() const
+ PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
///\}
@@ -866,7 +895,8 @@ namespace paludis
*/
virtual std::string get_environment_variable(
const PackageDatabaseEntry & for_package,
- const std::string & var) const = 0;
+ const std::string & var) const
+ PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
///\}
@@ -889,8 +919,10 @@ namespace paludis
typedef libwrapiter::ForwardIterator<RepositoryMirrorsInterface,
const std::pair<const std::string, std::string> > MirrorsIterator;
- virtual MirrorsIterator begin_mirrors(const std::string & s) const = 0;
- virtual MirrorsIterator end_mirrors(const std::string & s) const = 0;
+ virtual MirrorsIterator begin_mirrors(const std::string & s) const
+ PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
+ virtual MirrorsIterator end_mirrors(const std::string & s) const
+ PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
/**
* Is the named item a mirror?
@@ -928,13 +960,15 @@ namespace paludis
/**
* Fetch our virtual packages.
*/
- virtual std::tr1::shared_ptr<const VirtualsCollection> virtual_packages() const = 0;
+ virtual std::tr1::shared_ptr<const VirtualsCollection> virtual_packages() const
+ PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
/**
* Fetch version metadata for a virtual
*/
virtual std::tr1::shared_ptr<const VersionMetadata> virtual_package_version_metadata(
- const RepositoryVirtualsEntry &, const VersionSpec & v) const = 0;
+ const RepositoryVirtualsEntry &, const VersionSpec & v) const
+ PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
///\}
@@ -964,13 +998,15 @@ namespace paludis
/**
* Fetch our provided packages.
*/
- virtual std::tr1::shared_ptr<const ProvidesCollection> provided_packages() const = 0;
+ virtual std::tr1::shared_ptr<const ProvidesCollection> provided_packages() const
+ PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
/**
* Fetch version metadata for a provided package.
*/
virtual std::tr1::shared_ptr<const VersionMetadata> provided_package_version_metadata(
- const RepositoryProvidesEntry &) const = 0;
+ const RepositoryProvidesEntry &) const
+ PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
///\}
@@ -993,12 +1029,14 @@ namespace paludis
/**
* Are we a suitable destination for the specified package?
*/
- virtual bool is_suitable_destination_for(const PackageDatabaseEntry &) const = 0;
+ virtual bool is_suitable_destination_for(const PackageDatabaseEntry &) const
+ PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
/**
* Are we to be included in the Environment::default_destinations list?
*/
- virtual bool is_default_destination() const = 0;
+ virtual bool is_default_destination() const
+ PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
/**
* If true, pre and post install phases will be used when writing to this
@@ -1008,7 +1046,8 @@ namespace paludis
* not root is /, if root merges are supported), and false for intermediate
* destinations such as binary repositories.
*/
- virtual bool want_pre_post_phases() const = 0;
+ virtual bool want_pre_post_phases() const
+ PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
/**
* Merge a package.
@@ -1038,7 +1077,8 @@ namespace paludis
*/
virtual std::tr1::shared_ptr<const Contents> do_contents(
const QualifiedPackageName &,
- const VersionSpec &) const = 0;
+ const VersionSpec &) const
+ PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
///\}
@@ -1119,7 +1159,8 @@ namespace paludis
* Override in descendents: do the actual check,
*/
virtual std::tr1::shared_ptr<FSEntry>
- do_license_exists(const std::string & license) const = 0;
+ do_license_exists(const std::string & license) const
+ PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
///\}
diff --git a/paludis/util/dir_iterator.hh b/paludis/util/dir_iterator.hh
index 77791d9..96fe771 100644
--- a/paludis/util/dir_iterator.hh
+++ b/paludis/util/dir_iterator.hh
@@ -91,9 +91,11 @@ namespace paludis
///\name Dereference operators
///\{
- const FSEntry & operator* () const;
+ const FSEntry & operator* () const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
- const FSEntry * operator-> () const;
+ const FSEntry * operator-> () const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
///\}
@@ -108,8 +110,10 @@ namespace paludis
///\name Comparison operators
///\{
- bool operator== (const DirIterator & other) const;
- bool operator!= (const DirIterator & other) const;
+ bool operator== (const DirIterator & other) const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+ bool operator!= (const DirIterator & other) const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
///\}
};
diff --git a/paludis/util/fs_entry.hh b/paludis/util/fs_entry.hh
index d83d3b8..69e3a30 100644
--- a/paludis/util/fs_entry.hh
+++ b/paludis/util/fs_entry.hh
@@ -134,7 +134,8 @@ namespace paludis
/**
* Join with another FSEntry.
*/
- FSEntry operator/ (const FSEntry & rhs) const;
+ FSEntry operator/ (const FSEntry & rhs) const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
/**
* Append another FSEntry.
@@ -144,7 +145,8 @@ namespace paludis
/**
* Join with another path.
*/
- FSEntry operator/ (const std::string & rhs) const;
+ FSEntry operator/ (const std::string & rhs) const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
/**
* Append another path.
@@ -157,12 +159,14 @@ namespace paludis
/**
* Return the last part of our path (eg '/foo/bar' => 'bar').
*/
- std::string basename() const;
+ std::string basename() const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
/**
* Return the first part of our path (eg '/foo/bar' => '/foo').
*/
- FSEntry dirname() const;
+ FSEntry dirname() const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
///\}
@@ -173,54 +177,63 @@ namespace paludis
/**
* Does a filesystem entry exist at our location?
*/
- bool exists() const;
+ bool exists() const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
/**
* Does a filesystem entry exist at our location, and if it does,
* is it a directory?
*/
- bool is_directory() const;
+ bool is_directory() const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
/**
* Does a filesystem entry exist at our location, and if it does,
* is it a regular file?
*/
- bool is_regular_file() const;
+ bool is_regular_file() const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
/**
* Does a filesystem entry exist at our location, and if it does,
* is it a symbolic link?
*/
- bool is_symbolic_link() const;
+ bool is_symbolic_link() const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
/**
* Whether we exist and are a device file.
*/
- bool is_device() const;
+ bool is_device() const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
/**
* Whether we exist and are a fifo.
*/
- bool is_fifo() const;
+ bool is_fifo() const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
/**
* Check if filesystem entry has `perm` for `user_group`.
*
* \exception FSError if there was a problem accessing the filesystem entry
*/
- bool has_permission(const FSUserGroup & user_group, const FSPermission & fs_perm) const;
+ bool has_permission(const FSUserGroup & user_group, const FSPermission & fs_perm) const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
/**
* Return the permissions for our item.
*
* \exception FSError if there was a problem accessing the filesystem entry
*/
- mode_t permissions() const;
+ mode_t permissions() const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
/**
* Return the canonicalised version of our path.
*/
- FSEntry realpath() const;
+ FSEntry realpath() const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
/**
* Return our destination, if we are a symlink.
@@ -228,45 +241,52 @@ namespace paludis
* \exception FSError if we are not a symlink, or if the system call
* fails.
*/
- std::string readlink() const;
+ std::string readlink() const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
/**
* Return the time the filesystem entry was created
* \exception FSError if there was a problem accessing the filesystem entry
*/
- time_t ctime() const;
+ time_t ctime() const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
/**
* Return the time the filesystem entry was last modified
* \exception FSError if there was a problem accessing the filesystem entry
*/
- time_t mtime() const;
+ time_t mtime() const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
/**
* Return the size of our file, in bytes.
*
* \exception FSError if we don't have a size.
*/
- off_t file_size() const;
+ off_t file_size() const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
/**
* Fetch our owner.
*
* \exception FSError If we don't exist or the stat call fails.
*/
- uid_t owner() const;
+ uid_t owner() const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
/**
* Fetch our group.
*
* \exception FSError If we don't exist or the stat call fails.
*/
- gid_t group() const;
+ gid_t group() const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
/**
* Return the current working directory
*/
- static FSEntry cwd();
+ static FSEntry cwd()
+ PALUDIS_ATTRIBUTE((warn_unused_result));
///\}
diff --git a/paludis/util/fs_entry_TEST.cc b/paludis/util/fs_entry_TEST.cc
index 0dc8224..4e57d4e 100644
--- a/paludis/util/fs_entry_TEST.cc
+++ b/paludis/util/fs_entry_TEST.cc
@@ -71,8 +71,8 @@ namespace test_cases
TEST_CHECK(b.mtime() < b.ctime());
TEST_CHECK(d.mtime() == d.ctime());
- TEST_CHECK_THROWS(c.ctime(), FSError);
- TEST_CHECK_THROWS(c.mtime(), FSError);
+ TEST_CHECK_THROWS(time_t x = c.ctime(), FSError);
+ TEST_CHECK_THROWS(time_t x = c.mtime(), FSError);
}
} test_fs_entry_time;
@@ -211,7 +211,7 @@ namespace test_cases
TEST_CHECK(!b.has_permission(fs_ug_others, fs_perm_write));
TEST_CHECK(!b.has_permission(fs_ug_others, fs_perm_execute));
- TEST_CHECK_THROWS(c.has_permission(fs_ug_owner, fs_perm_read), FSError);
+ TEST_CHECK_THROWS(bool x = c.has_permission(fs_ug_owner, fs_perm_read), FSError);
}
} test_fs_entry_permission;
@@ -231,8 +231,8 @@ namespace test_cases
FSEntry e("fs_entry_TEST_dir/no_such_file");
TEST_CHECK_EQUAL(f.file_size(), 10);
- TEST_CHECK_THROWS(d.file_size(), FSError);
- TEST_CHECK_THROWS(e.file_size(), FSError);
+ TEST_CHECK_THROWS(size_t x = d.file_size(), FSError);
+ TEST_CHECK_THROWS(size_t x = e.file_size(), FSError);
}
} test_fs_entry_size;
@@ -300,11 +300,11 @@ namespace test_cases
FSEntry d("fs_entry_TEST_dir/i_dont_exist");
- TEST_CHECK_THROWS(d.permissions(), FSError);
+ TEST_CHECK_THROWS(mode_t x = d.permissions(), FSError);
TEST_CHECK_THROWS(d.chmod(all_perms), FSError);
TEST_CHECK_THROWS(d.chown(static_cast<uid_t>(-1)), FSError);
- TEST_CHECK_THROWS(d.owner(), FSError);
- TEST_CHECK_THROWS(d.group(), FSError);
+ TEST_CHECK_THROWS(uid_t x = d.owner(), FSError);
+ TEST_CHECK_THROWS(gid_t x = d.group(), FSError);
if (0 == my_uid)
{
diff --git a/paludis/util/instantiation_policy.hh b/paludis/util/instantiation_policy.hh
index 6d5c4ab..c9cdf0b 100644
--- a/paludis/util/instantiation_policy.hh
+++ b/paludis/util/instantiation_policy.hh
@@ -193,7 +193,8 @@ namespace paludis
/**
* Fetch our instance.
*/
- static OurType_ * get_instance();
+ static OurType_ * get_instance()
+ PALUDIS_ATTRIBUTE((warn_unused_result));
/**
* Destroy our instance.
diff --git a/paludis/util/instantiation_policy_TEST.cc b/paludis/util/instantiation_policy_TEST.cc
index 3ae1793..e265df5 100644
--- a/paludis/util/instantiation_policy_TEST.cc
+++ b/paludis/util/instantiation_policy_TEST.cc
@@ -158,7 +158,7 @@ namespace test_cases
void run()
{
- TEST_CHECK_THROWS(MyRecursiveClass::get_instance(), InternalError);
+ TEST_CHECK_THROWS(MyRecursiveClass * x = MyRecursiveClass::get_instance(), InternalError);
}
} test_singleton_pattern_recurse;
}
diff --git a/paludis/util/is_file_with_extension.hh b/paludis/util/is_file_with_extension.hh
index a96d290..4e1cbf7 100644
--- a/paludis/util/is_file_with_extension.hh
+++ b/paludis/util/is_file_with_extension.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
+ * Copyright (c) 2006, 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -60,7 +60,8 @@ namespace paludis
/**
* Operator.
*/
- bool operator() (const FSEntry & f) const;
+ bool operator() (const FSEntry & f) const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
};
}
diff --git a/paludis/util/log.hh b/paludis/util/log.hh
index 757c69d..6584e57 100644
--- a/paludis/util/log.hh
+++ b/paludis/util/log.hh
@@ -94,7 +94,8 @@ namespace paludis
/**
* Fetch the current log level.
*/
- LogLevel log_level() const;
+ LogLevel log_level() const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
/**
* Log a message at the specified level.
diff --git a/paludis/util/strip.hh b/paludis/util/strip.hh
index d42a46e..033c02c 100644
--- a/paludis/util/strip.hh
+++ b/paludis/util/strip.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
+ * Copyright (c) 2006, 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -38,7 +38,8 @@ namespace paludis
*
* \ingroup grpstrippers
*/
- std::string strip_leading_string(const std::string & s, const std::string & prefix) PALUDIS_VISIBLE;
+ std::string strip_leading_string(const std::string & s, const std::string & prefix) PALUDIS_VISIBLE
+ PALUDIS_ATTRIBUTE((warn_unused_result));
/**
* Return a string equal to s, minus the string remove if remove occurs at
@@ -46,7 +47,8 @@ namespace paludis
*
* \ingroup grpstrippers
*/
- std::string strip_leading(const std::string & s, const std::string & remove) PALUDIS_VISIBLE;
+ std::string strip_leading(const std::string & s, const std::string & remove) PALUDIS_VISIBLE
+ PALUDIS_ATTRIBUTE((warn_unused_result));
/**
* Return a string equal to s minus any trailing characters that are
@@ -54,7 +56,8 @@ namespace paludis
*
* \ingroup grpstrippers
*/
- std::string strip_trailing_string(const std::string & s, const std::string & suffix) PALUDIS_VISIBLE;
+ std::string strip_trailing_string(const std::string & s, const std::string & suffix) PALUDIS_VISIBLE
+ PALUDIS_ATTRIBUTE((warn_unused_result));
/**
* Return a string equal to s, minus the string remove if remove occurs at
@@ -62,7 +65,8 @@ namespace paludis
*
* \ingroup grpstrippers
*/
- std::string strip_trailing(const std::string & s, const std::string & remove) PALUDIS_VISIBLE;
+ std::string strip_trailing(const std::string & s, const std::string & remove) PALUDIS_VISIBLE
+ PALUDIS_ATTRIBUTE((warn_unused_result));
/**
* Adapt one of the strip_ functions for use as a std::unary_function by
diff --git a/paludis/util/system.hh b/paludis/util/system.hh
index 2798cc8..15f09bf 100644
--- a/paludis/util/system.hh
+++ b/paludis/util/system.hh
@@ -126,7 +126,8 @@ namespace paludis
*
* \ingroup grpsystem
*/
- int run_command(const Command & cmd) PALUDIS_VISIBLE;
+ int run_command(const Command & cmd) PALUDIS_VISIBLE
+ PALUDIS_ATTRIBUTE((warn_unused_result));
/**
* Set the stderr and close for stdout fds used by run_command and
diff --git a/paludis/util/system_TEST.cc b/paludis/util/system_TEST.cc
index a5eae4b..0367a7f 100644
--- a/paludis/util/system_TEST.cc
+++ b/paludis/util/system_TEST.cc
@@ -117,9 +117,9 @@ namespace test_cases
FSEntry dir("system_TEST_dir");
TEST_CHECK(dir.is_directory());
- run_command(Command("touch in_directory").with_chdir(dir));
+ TEST_CHECK_EQUAL(run_command(Command("touch in_directory").with_chdir(dir)), 0);
TEST_CHECK(FSEntry(dir / "in_directory").exists());
- run_command(Command("rm in_directory").with_chdir(dir));
+ TEST_CHECK_EQUAL(run_command(Command("rm in_directory").with_chdir(dir)), 0);
TEST_CHECK(! FSEntry(dir / "in_directory").exists());
}
} test_run_command_in_directory;
diff --git a/src/clients/paludis/applets.cc b/src/clients/paludis/applets.cc
index c4cf0af..64aa7b6 100644
--- a/src/clients/paludis/applets.cc
+++ b/src/clients/paludis/applets.cc
@@ -225,9 +225,11 @@ int do_list_sync_protocols()
s != s_end ; ++s)
{
std::cout << "* " << colour(cl_key_name, s->first) << std::endl;
- run_command(Command(s->second + " --help")
- .with_setenv("PALUDIS_FETCHERS_DIRS", env->fetchers_dirs())
- .with_setenv("PALUDIS_EBUILD_DIR", getenv_with_default("PALUDIS_EBUILD_DIR", LIBEXECDIR "/paludis")));
+ if (0 != run_command(Command(s->second + " --help")
+ .with_setenv("PALUDIS_FETCHERS_DIRS", env->fetchers_dirs())
+ .with_setenv("PALUDIS_EBUILD_DIR", getenv_with_default("PALUDIS_EBUILD_DIR", LIBEXECDIR "/paludis"))))
+ Log::get_instance()->message(ll_warning, lc_context, "Syncer help command '" +
+ s->second + " --help' failed");
}
}
diff --git a/test/test_framework.hh b/test/test_framework.hh
index e9768bb..7f2ee10 100644
--- a/test/test_framework.hh
+++ b/test/test_framework.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
+ * Copyright (c) 2006, 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -192,6 +192,24 @@ namespace test
* Fetch the function used to get a string description of an exception.
*/
std::string (* get_exception_to_debug_string()) (const std::exception &);
+
+ /**
+ * Utility class used by TEST_CHECK_EQUAL.
+ */
+ struct TwoVarHolder
+ {
+ bool result;
+ std::string s_a;
+ std::string s_b;
+
+ template <typename T1_, typename T2_>
+ TwoVarHolder(T1_ a, T2_ b) :
+ result(a == b),
+ s_a(paludis::stringify(a)),
+ s_b(paludis::stringify(b))
+ {
+ }
+ };
}
/**
@@ -200,9 +218,10 @@ namespace test
#define TEST_CHECK_EQUAL(a, b) \
do { \
try { \
- check(__PRETTY_FUNCTION__, __FILE__, __LINE__, a == b, \
- "Expected '" #a "' to equal '" + paludis::stringify(b) + \
- "' but got '" + paludis::stringify(a) + "'"); \
+ test::TwoVarHolder test_h(a, b); \
+ check(__PRETTY_FUNCTION__, __FILE__, __LINE__, test_h.result, \
+ "Expected '" #a "' to equal '" + test_h.s_b + \
+ "' but got '" + test_h.s_a + "'"); \
} catch (const TestFailedException &) { \
throw; \
} catch (const std::exception & e) { \
@@ -221,9 +240,11 @@ namespace test
#define TEST_CHECK_STRINGIFY_EQUAL(a, b) \
do { \
try { \
- check(__PRETTY_FUNCTION__, __FILE__, __LINE__, paludis::stringify(a) == paludis::stringify(b), \
- "Expected '" #a "' to equal '" + paludis::stringify(b) + \
- "' but got '" + paludis::stringify(a) + "'"); \
+ std::string s_a(paludis::stringify(a)); \
+ std::string s_b(paludis::stringify(b)); \
+ check(__PRETTY_FUNCTION__, __FILE__, __LINE__, s_a == s_b, \
+ "Expected '" #a "' to equal '" + s_b + \
+ "' but got '" + s_a + "'"); \
} catch (const TestFailedException &) { \
throw; \
} catch (const std::exception & e) { \