[paludis-commits] r4594 - in trunk: . paludis/util
ciaranm at svn.pioto.org
ciaranm at svn.pioto.org
Tue Apr 22 07:04:25 UTC 2008
Author: ciaranm
Date: 2008-04-22 07:04:24 +0000 (Tue, 22 Apr 2008)
New Revision: 4594
Added:
trunk/paludis/util/config_file-fwd.hh
trunk/paludis/util/dir_iterator-fwd.hh
Modified:
trunk/configure.ac
trunk/paludis/util/action_queue.cc
trunk/paludis/util/action_queue.hh
trunk/paludis/util/config_file.cc
trunk/paludis/util/config_file.hh
trunk/paludis/util/damerau_levenshtein.cc
trunk/paludis/util/damerau_levenshtein.hh
trunk/paludis/util/dir_iterator.cc
trunk/paludis/util/dir_iterator.hh
trunk/paludis/util/dir_iterator_TEST.cc
trunk/paludis/util/files.m4
Log:
Start using extern template, where available.
Modified: trunk/configure.ac
===================================================================
--- trunk/configure.ac 2008-04-22 06:59:22 UTC (rev 4593)
+++ trunk/configure.ac 2008-04-22 07:04:24 UTC (rev 4594)
@@ -500,6 +500,21 @@
fi
dnl }}}
+dnl {{{ check whether we can do extern template
+CAN_USE_EXTERN_TEMPLATE=
+AC_MSG_CHECKING([whether we can use extern template])
+AC_COMPILE_IFELSE([
+template <typename T_> struct S { };
+extern template struct S<int>;
+],
+ [AC_MSG_RESULT([yes])
+ CAN_USE_EXTERN_TEMPLATE=yes
+ PALUDIS_CXXFLAGS="${PALUDIS_CXXFLAGS} -DPALUDIS_HAVE_EXTERN_TEMPLATE=1"
+ PALUDIS_PC_CFLAGS="${PALUDIS_PC_CFLAGS} -DPALUDIS_HAVE_EXTERN_TEMPLATE=1"
+ ],
+ [AC_MSG_RESULT([no])])
+dnl }}}
+
dnl {{{ check for cxxflags
if test x = x"$LET_ME_RICE"
then
@@ -590,6 +605,8 @@
CXXFLAGS="$CXXFLAGS $PALUDIS_CXXFLAGS $1 -Werror"
AC_COMPILE_IFELSE([
#include <string>
+template <typename T_> struct S { };
+extern template struct S<int>;
#include <iostream>
int main(int, char **)
{
@@ -653,7 +670,6 @@
if test "x$cxxflag_success" = "xyes" ; then
PALUDIS_CXXFLAGS_NO_WSHADOW=-Wno-shadow
fi
- PALUDIS_CXXFLAGS_WITHOUT_PEDANTIC=$PALUDIS_CXXFLAGS
CHECK_CXXFLAG([-Wlogical-op])
CHECK_CXXFLAG([-Wvla])
CHECK_CXXFLAG([-Wwrite-strings])
@@ -663,11 +679,29 @@
PALUDIS_CXXFLAGS_NO_WWRITE_STRINGS=-Wno-write-strings
fi
CHECK_CXXFLAG([-Wno-ignored-qualifiers])
- CHECK_CXXFLAG([-pedantic])
+ PALUDIS_CXXFLAGS_WITHOUT_PEDANTIC=$PALUDIS_CXXFLAGS
else
CHECK_CXXFLAG([-Wall])
+ PALUDIS_CXXFLAGS_WITHOUT_PEDANTIC=$PALUDIS_CXXFLAGS
fi
AC_MSG_RESULT([${cxxflags_message}])
+
+if test x$CAN_USE_EXTERN_TEMPLATE = xyes ; then
+ AC_MSG_CHECKING([whether -pedantic works if we use extern template])
+ save_CXXFLAGS=$CXXFLAGS
+ CXXFLAGS="$CXXFLAGS -pedantic"
+ AC_COMPILE_IFELSE([
+template <typename T_> struct S { };
+extern template struct S<int>;
+],
+ [AC_MSG_RESULT([yes])
+ CHECK_CXXFLAG([-pedantic])],
+ [AC_MSG_RESULT([no])])
+else
+ CHECK_CXXFLAG([-pedantic])
+fi
+CXXFLAGS=$save_CXXFLAGS
+
AC_SUBST([PALUDIS_CXXFLAGS])
AC_SUBST([PALUDIS_CXXFLAGS_WITHOUT_PEDANTIC])
AC_SUBST([PALUDIS_CXXFLAGS_NO_WOLD_STYLE_CAST])
Modified: trunk/paludis/util/action_queue.cc
===================================================================
--- trunk/paludis/util/action_queue.cc 2008-04-22 06:59:22 UTC (rev 4593)
+++ trunk/paludis/util/action_queue.cc 2008-04-22 07:04:24 UTC (rev 4594)
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2007 Ciaran McCreesh
+ * Copyright (c) 2007, 2008 Ciaran McCreesh
*
* 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
@@ -30,6 +30,8 @@
using namespace paludis;
+template class PrivateImplementationPattern<ActionQueue>;
+
namespace paludis
{
template <>
Modified: trunk/paludis/util/action_queue.hh
===================================================================
--- trunk/paludis/util/action_queue.hh 2008-04-22 06:59:22 UTC (rev 4593)
+++ trunk/paludis/util/action_queue.hh 2008-04-22 07:04:24 UTC (rev 4594)
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2007 Ciaran McCreesh
+ * Copyright (c) 2007, 2008 Ciaran McCreesh
*
* 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
@@ -67,6 +67,11 @@
*/
unsigned number_of_threads() const;
};
+
+#ifdef PALUDIS_HAVE_EXTERN_TEMPLATE
+ extern template class PrivateImplementationPattern<ActionQueue>;
+#endif
+
}
#endif
Added: trunk/paludis/util/config_file-fwd.hh
===================================================================
--- trunk/paludis/util/config_file-fwd.hh (rev 0)
+++ trunk/paludis/util/config_file-fwd.hh 2008-04-22 07:04:24 UTC (rev 4594)
@@ -0,0 +1,31 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2008 Ciaran McCreesh
+ *
+ * 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
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis 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
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef PALUDIS_GUARD_PALUDIS_UTIL_CONFIG_FILE_FWD_HH
+#define PALUDIS_GUARD_PALUDIS_UTIL_CONFIG_FILE_FWD_HH 1
+
+#include <paludis/util/attributes.hh>
+#include <iosfwd>
+
+namespace paludis
+{
+#include <paludis/util/config_file-se.hh>
+}
+
+#endif
Modified: trunk/paludis/util/config_file.cc
===================================================================
--- trunk/paludis/util/config_file.cc 2008-04-22 06:59:22 UTC (rev 4593)
+++ trunk/paludis/util/config_file.cc 2008-04-22 07:04:24 UTC (rev 4594)
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2006, 2007 Ciaran McCreesh
+ * Copyright (c) 2006, 2007, 2008 Ciaran McCreesh
* Copyright (c) 2006 Danny van Dyk
*
* This file is part of the Paludis package manager. Paludis is free software;
@@ -47,6 +47,12 @@
template class WrappedForwardIterator<KeyValueConfigFile::ConstIteratorTag,
const std::pair<const std::string, std::string> >;
+template class InstantiationPolicy<ConfigFile, instantiation_method::NonCopyableTag>;
+template class PrivateImplementationPattern<ConfigFile::Source>;
+template class PrivateImplementationPattern<LineConfigFile>;
+template class PrivateImplementationPattern<KeyValueConfigFile>;
+template class PrivateImplementationPattern<KeyValueConfigFile::Defaults>;
+
ConfigFileError::ConfigFileError(const std::string & f, const std::string & m) throw () :
ConfigurationError("Configuration file error: " + (f.empty() ? m : f + ": " + m))
{
Modified: trunk/paludis/util/config_file.hh
===================================================================
--- trunk/paludis/util/config_file.hh 2008-04-22 06:59:22 UTC (rev 4593)
+++ trunk/paludis/util/config_file.hh 2008-04-22 07:04:24 UTC (rev 4594)
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2006, 2007 Ciaran McCreesh
+ * Copyright (c) 2006, 2007, 2008 Ciaran McCreesh
*
* 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
@@ -20,12 +20,14 @@
#ifndef PALUDIS_GUARD_PALUDIS_CONFIG_FILE_HH
#define PALUDIS_GUARD_PALUDIS_CONFIG_FILE_HH 1
+#include <paludis/util/config_file-fwd.hh>
#include <paludis/util/map-fwd.hh>
#include <paludis/util/exception.hh>
#include <paludis/util/instantiation_policy.hh>
#include <paludis/util/private_implementation_pattern.hh>
#include <paludis/util/options-fwd.hh>
#include <paludis/util/wrapped_forward_iterator-fwd.hh>
+#include <paludis/util/fs_entry-fwd.hh>
#include <iosfwd>
#include <string>
@@ -43,10 +45,6 @@
namespace paludis
{
-#include <paludis/util/config_file-se.hh>
-
- class FSEntry;
-
/**
* Raised if an error is encountered parsing a configuration file.
*
@@ -369,6 +367,15 @@
*/
template<>
KeyValueConfigFile::Defaults::Defaults(tr1::shared_ptr<Map<std::string, std::string> >);
+
+#ifdef PALUDIS_HAVE_EXTERN_TEMPLATE
+ extern template class InstantiationPolicy<ConfigFile, instantiation_method::NonCopyableTag>;
+ extern template class PrivateImplementationPattern<ConfigFile::Source>;
+ extern template class PrivateImplementationPattern<LineConfigFile>;
+ extern template class PrivateImplementationPattern<KeyValueConfigFile>;
+ extern template class PrivateImplementationPattern<KeyValueConfigFile::Defaults>;
+#endif
+
}
#endif
Modified: trunk/paludis/util/damerau_levenshtein.cc
===================================================================
--- trunk/paludis/util/damerau_levenshtein.cc 2008-04-22 06:59:22 UTC (rev 4593)
+++ trunk/paludis/util/damerau_levenshtein.cc 2008-04-22 07:04:24 UTC (rev 4594)
@@ -24,6 +24,8 @@
using namespace paludis;
+template class PrivateImplementationPattern<DamerauLevenshtein>;
+
namespace paludis
{
template <>
Modified: trunk/paludis/util/damerau_levenshtein.hh
===================================================================
--- trunk/paludis/util/damerau_levenshtein.hh 2008-04-22 06:59:22 UTC (rev 4593)
+++ trunk/paludis/util/damerau_levenshtein.hh 2008-04-22 07:04:24 UTC (rev 4594)
@@ -53,6 +53,10 @@
///\}
};
+
+#ifdef PALUDIS_HAVE_EXTERN_TEMPLATE
+ extern template class PrivateImplementationPattern<DamerauLevenshtein>;
+#endif
}
#endif
Added: trunk/paludis/util/dir_iterator-fwd.hh
===================================================================
--- trunk/paludis/util/dir_iterator-fwd.hh (rev 0)
+++ trunk/paludis/util/dir_iterator-fwd.hh 2008-04-22 07:04:24 UTC (rev 4594)
@@ -0,0 +1,43 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2008 Ciaran McCreesh
+ *
+ * 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
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis 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
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef PALUDIS_GUARD_PALUDIS_UTIL_DIR_ITERATOR_FWD_HH
+#define PALUDIS_GUARD_PALUDIS_UTIL_DIR_ITERATOR_FWD_HH 1
+
+#include <paludis/util/attributes.hh>
+#include <paludis/util/options-fwd.hh>
+#include <iosfwd>
+
+namespace paludis
+{
+#include <paludis/util/dir_iterator-se.hh>
+
+ /**
+ * Options for a DirIterator.
+ *
+ * \see DirIteratorOption
+ * \see DirIterator
+ */
+ typedef Options<DirIteratorOption> DirIteratorOptions;
+
+ class DirOpenError;
+ class DirIterator;
+}
+
+#endif
Modified: trunk/paludis/util/dir_iterator.cc
===================================================================
--- trunk/paludis/util/dir_iterator.cc 2008-04-22 06:59:22 UTC (rev 4593)
+++ trunk/paludis/util/dir_iterator.cc 2008-04-22 07:04:24 UTC (rev 4594)
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2005, 2006, 2007 Ciaran McCreesh
+ * Copyright (c) 2005, 2006, 2007, 2008 Ciaran McCreesh
* Copyright (c) 2008 Fernando J. Pereda
*
* This file is part of the Paludis package manager. Paludis is free software;
@@ -36,6 +36,7 @@
#include <paludis/util/dir_iterator-se.cc>
typedef std::multiset<std::pair<ino_t, FSEntry>, tr1::function<bool (std::pair<ino_t, FSEntry>, std::pair<ino_t, FSEntry>)> > EntrySet;
+template class PrivateImplementationPattern<DirIterator>;
namespace paludis
{
Modified: trunk/paludis/util/dir_iterator.hh
===================================================================
--- trunk/paludis/util/dir_iterator.hh 2008-04-22 06:59:22 UTC (rev 4593)
+++ trunk/paludis/util/dir_iterator.hh 2008-04-22 07:04:24 UTC (rev 4594)
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2005, 2006, 2007 Ciaran McCreesh
+ * Copyright (c) 2005, 2006, 2007, 2008 Ciaran McCreesh
*
* 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
@@ -20,10 +20,11 @@
#ifndef PALUDIS_GUARD_PALUDIS_DIR_ITERATOR_HH
#define PALUDIS_GUARD_PALUDIS_DIR_ITERATOR_HH 1
-#include <iterator>
+#include <paludis/util/dir_iterator-fwd.hh>
#include <paludis/util/fs_entry.hh>
#include <paludis/util/options.hh>
#include <paludis/util/private_implementation_pattern.hh>
+#include <iterator>
#ifdef PALUDIS_HAVE_CONCEPTS
# include <concepts>
@@ -60,17 +61,7 @@
///\}
};
-#include <paludis/util/dir_iterator-se.hh>
-
/**
- * Options for a DirIterator.
- *
- * \see DirIteratorOption
- * \see DirIterator
- */
- typedef Options<DirIteratorOption> DirIteratorOptions;
-
- /**
* An iterator that iterates over the contents of a directory.
*
* \ingroup g_fs
@@ -142,6 +133,10 @@
///\}
};
+
+#ifdef PALUDIS_HAVE_EXTERN_TEMPLATE
+ extern template class PrivateImplementationPattern<DirIterator>;
+#endif
}
#ifdef PALUDIS_HAVE_CONCEPTS
Modified: trunk/paludis/util/dir_iterator_TEST.cc
===================================================================
--- trunk/paludis/util/dir_iterator_TEST.cc 2008-04-22 06:59:22 UTC (rev 4593)
+++ trunk/paludis/util/dir_iterator_TEST.cc 2008-04-22 07:04:24 UTC (rev 4594)
@@ -18,6 +18,7 @@
*/
#include <paludis/util/dir_iterator.hh>
+#include <paludis/util/options.hh>
#include <test/test_framework.hh>
#include <test/test_runner.hh>
Modified: trunk/paludis/util/files.m4
===================================================================
--- trunk/paludis/util/files.m4 2008-04-22 06:59:22 UTC (rev 4593)
+++ trunk/paludis/util/files.m4 2008-04-22 07:04:24 UTC (rev 4594)
@@ -11,14 +11,14 @@
add(`action_queue', `hh', `cc', `test')
add(`attributes', `hh')
add(`byte_swap', `hh', `test')
-add(`config_file', `hh', `cc', `se', `test', `testscript')
+add(`config_file', `hh', `cc', `fwd', `se', `test', `testscript')
add(`clone', `hh', `impl')
add(`condition_variable', `hh', `cc', `test')
add(`cookie', `hh', `cc')
add(`create_iterator', `hh', `fwd', `impl', `test')
add(`damerau_levenshtein', `hh', `cc', `test')
add(`destringify', `hh', `cc', `test')
-add(`dir_iterator', `hh', `cc', `se', `test', `testscript')
+add(`dir_iterator', `hh', `cc', `fwd', `se', `test', `testscript')
add(`exception', `hh', `cc')
add(`fast_unique_copy', `hh', `test')
add(`fd_output_stream', `hh')
More information about the paludis-commits
mailing list