aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-06-04 16:25:55 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-06-04 16:25:55 +0000
commitdaac17871c1b559e0de897ecf6c4cdafcf3cef8f (patch)
tree02a80d3f8ba1bc8c4fb2ebd45d2dab405d8d78f7
parent1d6f454162b54ada09ead2ab89d379cd1c1b280a (diff)
downloadpaludis-daac17871c1b559e0de897ecf6c4cdafcf3cef8f.tar.gz
paludis-daac17871c1b559e0de897ecf6c4cdafcf3cef8f.tar.xz
r3200@snowflake: ciaranm | 2007-06-04 17:24:43 +0100
Use -D rather than .in for hashes. Fixes: ticket:270
-rw-r--r--configure.ac20
-rw-r--r--paludis/Makefile.am.m45
-rw-r--r--paludis/dep_list/uninstall_list.cc2
-rw-r--r--paludis/files.m42
-rw-r--r--paludis/hashed_containers.cc8
-rw-r--r--paludis/hashed_containers.hh (renamed from paludis/hashed_containers.hh.in)64
6 files changed, 29 insertions, 72 deletions
diff --git a/configure.ac b/configure.ac
index 4b6ac95..58bb5b4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -150,9 +150,6 @@ int main(int, char **)
dnl }}}
dnl {{{ check for hashes
-have_tr1_hashes=0
-have_ext_hashes=0
-have_std_hashes=0
AC_MSG_CHECKING([for hashed associative containers])
AC_COMPILE_IFELSE([
#include <tr1/unordered_map>
@@ -164,7 +161,7 @@ int main(int, char **)
],
[
AC_MSG_RESULT([std::tr1::unordered_map])
- have_tr1_hashes=1
+ PALUDIS_CXXFLAGS="${PALUDIS_CXXFLAGS} -DPALUDIS_HASH_IS_STD_TR1_UNORDERED=1"
],
[
AC_COMPILE_IFELSE([
@@ -177,7 +174,7 @@ int main(int, char **)
],
[
AC_MSG_RESULT([__gnu_cxx::hash_map])
- have_ext_hashes=1
+ PALUDIS_CXXFLAGS="${PALUDIS_CXXFLAGS} -DPALUDIS_HASH_IS_GNU_CXX_HASH=1"
],
[
AC_COMPILE_IFELSE([
@@ -190,21 +187,11 @@ int main(int, char **)
],
[
AC_MSG_RESULT([std::hash_map])
- have_std_hashes=1
+ PALUDIS_CXXFLAGS="${PALUDIS_CXXFLAGS} -DPALUDIS_HASH_IS_STD_HASH=1"
],
[
AC_MSG_RESULT([no, falling back to std::map (slower)])
])])])
-
-HAVE_TR1_HASHES=$have_tr1_hashes
-AC_DEFINE_UNQUOTED([HAVE_TR1_HASHES], $have_tr1_hashes, [Do we have std::tr1:: hashes?])
-AC_SUBST([HAVE_TR1_HASHES])
-HAVE_EXT_HASHES=$have_ext_hashes
-AC_DEFINE_UNQUOTED([HAVE_EXT_HASHES], $have_ext_hashes, [Do we have __gnu_cxx:: hashes?])
-AC_SUBST([HAVE_EXT_HASHES])
-HAVE_STD_HASHES=$have_std_hashes
-AC_DEFINE_UNQUOTED([HAVE_STD_HASHES], $have_std_hashes, [Do we have std:: hashes?])
-AC_SUBST([HAVE_STD_HASHES])
dnl }}}
dnl {{{ tr1 shared pointers
@@ -1154,7 +1141,6 @@ AC_OUTPUT(
paludis/environments/no_config/Makefile
paludis/environments/test/Makefile
paludis/fetchers/Makefile
- paludis/hashed_containers.hh
paludis/merger/Makefile
paludis/qa/Makefile
paludis/repositories/Makefile
diff --git a/paludis/Makefile.am.m4 b/paludis/Makefile.am.m4
index 23729a3..8aeacb6 100644
--- a/paludis/Makefile.am.m4
+++ b/paludis/Makefile.am.m4
@@ -71,8 +71,7 @@ AM_CXXFLAGS = -I$(top_srcdir) @PALUDIS_CXXFLAGS@ @PALUDIS_CXXFLAGS_VISIBILITY@
include(`paludis/files.m4')
CLEANFILES = *~ gmon.out *.gcov *.gcno *.gcda ihateautomake.cc ihateautomake.o
-MAINTAINERCLEANFILES = Makefile.in Makefile.am about.hh paludis.hh \
- hashed_containers.hh
+MAINTAINERCLEANFILES = Makefile.in Makefile.am about.hh paludis.hh
DISTCLEANFILES = srcleanlist secleanlist
DEFS= \
-DSYSCONFDIR=\"$(sysconfdir)\" \
@@ -80,7 +79,7 @@ DEFS= \
-DDATADIR=\"$(datadir)\" \
-DLIBDIR=\"$(libdir)\"
EXTRA_DIST = about.hh.in Makefile.am.m4 paludis.hh.m4 files.m4 \
- hashed_containers.hh.in testscriptlist srlist srcleanlist selist secleanlist \
+ testscriptlist srlist srcleanlist selist secleanlist \
repository_blacklist.txt hooker.bash
SUBDIRS = digests distributions eapis fetchers syncers util selinux . dep_list merger repositories environments args qa tasks
BUILT_SOURCES = srcleanlist secleanlist
diff --git a/paludis/dep_list/uninstall_list.cc b/paludis/dep_list/uninstall_list.cc
index d4bd67f..a70bb11 100644
--- a/paludis/dep_list/uninstall_list.cc
+++ b/paludis/dep_list/uninstall_list.cc
@@ -48,7 +48,7 @@ namespace paludis
return CRCHash<std::string>::operator() (stringify(val));
}
-#if (! PALUDIS_HAVE_TR1_HASHES) && (! PALUDIS_HAVE_EXT_HASHES)
+#if (! defined(PALUDIS_HASH_IS_STD_TR1_UNORDERED)) && (! defined(PALUDIS_HASH_IS_GNU_CXX_HASH))
bool operator() (const PackageDatabaseEntry & lhs,
const PackageDatabaseEntry & rhs) const
{
diff --git a/paludis/files.m4 b/paludis/files.m4
index e4b186a..6e57906 100644
--- a/paludis/files.m4
+++ b/paludis/files.m4
@@ -19,7 +19,7 @@ add(`distribution', `hh', `cc', `fwd', `sr')
add(`eapi', `hh', `cc', `fwd', `sr')
add(`environment', `hh', `cc', `se')
add(`environment_implementation', `hh', `cc', `test')
-add(`hashed_containers', `hhx', `cc', `test')
+add(`hashed_containers', `hh', `cc', `test')
add(`hook', `hh', `cc', `se', `sr')
add(`hooker', `hh', `cc', `test', `testscript')
add(`host_tuple_name', `hh', `cc', `sr', `test')
diff --git a/paludis/hashed_containers.cc b/paludis/hashed_containers.cc
index 6c905ab..152a46f 100644
--- a/paludis/hashed_containers.cc
+++ b/paludis/hashed_containers.cc
@@ -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
@@ -27,9 +27,7 @@
using namespace paludis;
-#if PALUDIS_HAVE_TR1_HASHES || PALUDIS_HAVE_EXT_HASHES || PALUDIS_HAVE_STD_HASHES
-
-#ifndef DOXYGEN
+#if defined(PALUDIS_HASH_IS_STD_TR1_UNORDERED) || defined(PALUDIS_HASH_IS_GNU_CXX_HASH) || defined(PALUDIS_HASH_IS_STD_HASH)
std::size_t
CRCHash<QualifiedPackageName>::operator() (const QualifiedPackageName & val) const
@@ -104,5 +102,3 @@ CRCHash<std::pair<QualifiedPackageName, VersionSpec> >::operator() (
#endif
-#endif
-
diff --git a/paludis/hashed_containers.hh.in b/paludis/hashed_containers.hh
index f3aeb62..5e01e1a 100644
--- a/paludis/hashed_containers.hh.in
+++ b/paludis/hashed_containers.hh
@@ -1,7 +1,5 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-@GENERATED_FILE@
-
/*
* Copyright (c) 2006, 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
*
@@ -29,39 +27,17 @@
* \ingroup grphashedcontainers
*/
-/**
- * Non-zero if we have std::tr1:: hashes (g++-4).
- *
- * \ingroup grphashedcontainers
- */
-#define PALUDIS_HAVE_TR1_HASHES @HAVE_TR1_HASHES@
-
-/**
- * Non-zero if we have __gnu_cxx:: hashes under ext/ (g++-3).
- *
- * \ingroup grphashedcontainers
- */
-#define PALUDIS_HAVE_EXT_HASHES @HAVE_EXT_HASHES@
-
-
-/**
- * Non-zero if we have std:: hashes (icc70).
- *
- * \ingroup grphashedcontainers
- */
-#define PALUDIS_HAVE_STD_HASHES @HAVE_STD_HASHES@
-
#include <paludis/name.hh>
#include <paludis/util/validated.hh>
#include <paludis/version_spec.hh>
-#if PALUDIS_HAVE_TR1_HASHES
+#ifdef PALUDIS_HASH_IS_STD_TR1_UNORDERED
# include <tr1/unordered_set>
# include <tr1/unordered_map>
-#elif PALUDIS_HAVE_EXT_HASHES
+#elif defined(PALUDIS_HASH_IS_GNU_CXX_HASH)
# include <ext/hash_set>
# include <ext/hash_map>
-#elif PALUDIS_HAVE_STD_HASHES
+#elif defined(PALUDIS_HASH_IS_STD_HASH)
# include <hash_set>
# include <hash_map>
#else
@@ -91,15 +67,15 @@ namespace paludis
template <typename Key_, typename Value_>
struct MakeHashedMap
{
-#if PALUDIS_HAVE_TR1_HASHES
+#ifdef PALUDIS_HASH_IS_STD_TR1_UNORDERED
/// Our map type.
typedef std::tr1::unordered_map<Key_, Value_, CRCHash<Key_> > Type;
-#elif PALUDIS_HAVE_EXT_HASHES
+#elif defined(PALUDIS_HASH_IS_GNU_CXX_HASH)
/// Our map type.
typedef __gnu_cxx::hash_map<Key_, Value_, CRCHash<Key_> > Type;
-#elif PALUDIS_HAVE_STD_HASHES
+#elif defined(PALUDIS_HASH_IS_STD_HASH)
/// Our map type.
typedef std::hash_map<Key_, Value_, CRCHash<Key_> > Type;
@@ -117,15 +93,15 @@ namespace paludis
template <typename Key_, typename Value_>
struct MakeHashedMultiMap
{
-#if PALUDIS_HAVE_TR1_HASHES
+#ifdef PALUDIS_HASH_IS_STD_TR1_UNORDERED
/// Our map type.
typedef std::tr1::unordered_multimap<Key_, Value_, CRCHash<Key_> > Type;
-#elif PALUDIS_HAVE_EXT_HASHES
+#elif defined(PALUDIS_HASH_IS_GNU_CXX_HASH)
/// Our map type.
typedef __gnu_cxx::hash_multimap<Key_, Value_, CRCHash<Key_> > Type;
-#elif PALUDIS_HAVE_STD_HASHES
+#elif defined(PALUDIS_HASH_IS_STD_HASH)
/// Our map type.
typedef std::hash_multimap<Key_, Value_, CRCHash<Key_> > Type;
@@ -143,15 +119,15 @@ namespace paludis
template <typename Key_>
struct MakeHashedSet
{
-#if PALUDIS_HAVE_TR1_HASHES
+#ifdef PALUDIS_HASH_IS_STD_TR1_UNORDERED
/// Our set type.
typedef std::tr1::unordered_set<Key_, CRCHash<Key_> > Type;
-#elif PALUDIS_HAVE_EXT_HASHES
+#elif defined(PALUDIS_HASH_IS_GNU_CXX_HASH)
/// Our set type.
typedef __gnu_cxx::hash_set<Key_, CRCHash<Key_> > Type;
-#elif PALUDIS_HAVE_STD_HASHES
+#elif defined(PALUDIS_HASH_IS_STD_HASH)
/// Our set type.
typedef std::hash_set<Key_, CRCHash<Key_> > Type;
@@ -169,15 +145,15 @@ namespace paludis
template <typename Key_>
struct MakeHashedMultiSet
{
-#if PALUDIS_HAVE_TR1_HASHES
+#ifdef PALUDIS_HASH_IS_STD_TR1_UNORDERED
/// Our set type.
typedef std::tr1::unordered_multiset<Key_, CRCHash<Key_> > Type;
-#elif PALUDIS_HAVE_EXT_HASHES
+#elif defined(PALUDIS_HASH_IS_GNU_CXX_HASH)
/// Our set type.
typedef __gnu_cxx::hash_multiset<Key_, CRCHash<Key_> > Type;
-#elif PALUDIS_HAVE_STD_HASHES
+#elif defined(PALUDIS_HASH_IS_STD_HASH)
/// Our set type.
typedef std::hash_multiset<Key_, CRCHash<Key_> > Type;
@@ -187,7 +163,7 @@ namespace paludis
#endif
};
-#if PALUDIS_HAVE_TR1_HASHES || PALUDIS_HAVE_EXT_HASHES || PALUDIS_HAVE_STD_HASHES
+#if defined(PALUDIS_HASH_IS_STD_TR1_UNORDERED) || defined(PALUDIS_HASH_IS_GNU_CXX_HASH) || defined(PALUDIS_HASH_IS_STD_HASH)
namespace hashed_containers_internals
{
/**
@@ -219,7 +195,7 @@ namespace paludis
/// Hash function.
std::size_t operator() (const QualifiedPackageName & val) const;
-#if (! PALUDIS_HAVE_TR1_HASHES) && (! PALUDIS_HAVE_EXT_HASHES)
+#if (! defined(PALUDIS_HASH_IS_STD_TR1_UNORDERED)) && (! defined(PALUDIS_HASH_IS_GNU_CXX_HASH))
enum
{
min_buckets = 32,
@@ -247,7 +223,7 @@ namespace paludis
/// Hash function.
std::size_t operator() (const Validated<std::string, Validated_> & val) const;
-#if (! PALUDIS_HAVE_TR1_HASHES) && (! PALUDIS_HAVE_EXT_HASHES)
+#if (! defined(PALUDIS_HASH_IS_STD_TR1_UNORDERED)) && (! defined(PALUDIS_HASH_IS_GNU_CXX_HASH))
enum
{
min_buckets = 32,
@@ -277,7 +253,7 @@ namespace paludis
/// Hash function.
std::size_t operator() (const std::string & val) const;
-#if (! PALUDIS_HAVE_TR1_HASHES) && (! PALUDIS_HAVE_EXT_HASHES)
+#if (! defined(PALUDIS_HASH_IS_STD_TR1_UNORDERED)) && (! defined(PALUDIS_HASH_IS_GNU_CXX_HASH))
enum
{
min_buckets = 32,
@@ -305,7 +281,7 @@ namespace paludis
/// Hash function.
std::size_t operator() (const std::pair<QualifiedPackageName, VersionSpec> & val) const;
-#if (! PALUDIS_HAVE_TR1_HASHES) && (! PALUDIS_HAVE_EXT_HASHES)
+#if (! defined(PALUDIS_HASH_IS_STD_TR1_UNORDERED)) && (! defined(PALUDIS_HASH_IS_GNU_CXX_HASH))
enum
{
min_buckets = 32,