[pypy-commit] pypy cppyy-packaging: remove (now unnecessary) explicit instantiations

wlav pypy.commits at gmail.com
Fri Aug 4 18:51:04 EDT 2017


Author: Wim Lavrijsen <WLavrijsen at lbl.gov>
Branch: cppyy-packaging
Changeset: r92078:1b6feb53dfb7
Date: 2017-08-04 09:58 -0700
http://bitbucket.org/pypy/pypy/changeset/1b6feb53dfb7/

Log:	remove (now unnecessary) explicit instantiations

diff --git a/pypy/module/_cppyy/test/stltypes.cxx b/pypy/module/_cppyy/test/stltypes.cxx
--- a/pypy/module/_cppyy/test/stltypes.cxx
+++ b/pypy/module/_cppyy/test/stltypes.cxx
@@ -1,15 +1,5 @@
 #include "stltypes.h"
 
-#define STLTYPES_EXPLICIT_INSTANTIATION_WITH_COMPS(STLTYPE, TTYPE)              \
-namespace __gnu_cxx {                                                           \
-template bool operator==(const std::STLTYPE< TTYPE >::iterator&,                \
-                         const std::STLTYPE< TTYPE >::iterator&);               \
-template bool operator!=(const std::STLTYPE< TTYPE >::iterator&,                \
-                         const std::STLTYPE< TTYPE >::iterator&);               \
-}
-
-//- explicit instantiations of used comparisons
-STLTYPES_EXPLICIT_INSTANTIATION_WITH_COMPS(vector, int)
 
 //- class with lots of std::string handling
 stringy_class::stringy_class(const char* s) : m_string(s) {}
diff --git a/pypy/module/_cppyy/test/stltypes.h b/pypy/module/_cppyy/test/stltypes.h
--- a/pypy/module/_cppyy/test/stltypes.h
+++ b/pypy/module/_cppyy/test/stltypes.h
@@ -37,62 +37,3 @@
    std::string operator[](double) { return "double"; }
    std::string operator[](const std::string&) { return "string"; }
 };      
-
-
-#define STLTYPE_INSTANTIATION(STLTYPE, TTYPE, N)                             \
-   std::STLTYPE<TTYPE > STLTYPE##_##N;                                       \
-   std::STLTYPE<TTYPE >::iterator STLTYPE##_##N##_i;                         \
-   std::STLTYPE<TTYPE >::const_iterator STLTYPE##_##N##_ci
-
-#define STLTYPE_INSTANTIATION2(STLTYPE, TTYPE1, TTYPE2, N)                   \
-   std::STLTYPE<TTYPE1, TTYPE2 > STLTYPE##_##N;                              \
-   std::pair<TTYPE1, TTYPE2 > STLTYPE##_##N##_p;                             \
-   std::pair<const TTYPE1, TTYPE2 > STLTYPE##_##N##_cp;                      \
-   std::STLTYPE<TTYPE1, TTYPE2 >::iterator STLTYPE##_##N##_i;                \
-   std::STLTYPE<TTYPE1, TTYPE2 >::const_iterator STLTYPE##_##N##_ci
-
-
-//- instantiations of used STL types
-namespace {
-
-    struct _CppyyVectorInstances {
-
-        STLTYPE_INSTANTIATION(vector, int,          1);
-        STLTYPE_INSTANTIATION(vector, float,        2);
-        STLTYPE_INSTANTIATION(vector, double,       3);
-        STLTYPE_INSTANTIATION(vector, just_a_class, 4);
-
-    };
-
-    struct _CppyyListInstances {
-
-        STLTYPE_INSTANTIATION(list, int,    1);
-        STLTYPE_INSTANTIATION(list, float,  2);
-        STLTYPE_INSTANTIATION(list, double, 3);
-
-    };
-
-    struct _CppyyMapInstances {
-
-        STLTYPE_INSTANTIATION2(map, int,         int,           1);
-        STLTYPE_INSTANTIATION2(map, std::string, int,           2);
-        STLTYPE_INSTANTIATION2(map, std::string, unsigned int,  3);
-        STLTYPE_INSTANTIATION2(map, std::string, unsigned long, 4);
-
-    };
-
-    stl_like_class<int> stlc_1;
-
-} // unnamed namespace
-
-#define STLTYPES_EXPLICIT_INSTANTIATION_DECL_COMPS(STLTYPE, TTYPE)           \
-namespace __gnu_cxx {                                                        \
-extern template bool operator==(const std::STLTYPE< TTYPE >::iterator&,      \
-                         const std::STLTYPE< TTYPE >::iterator&);            \
-extern template bool operator!=(const std::STLTYPE< TTYPE >::iterator&,      \
-                         const std::STLTYPE< TTYPE >::iterator&);            \
-}
-
-// comps for int only to allow testing: normal use of vector is looping over a
-// range-checked version of __getitem__
-STLTYPES_EXPLICIT_INSTANTIATION_DECL_COMPS(vector, int)
diff --git a/pypy/module/_cppyy/test/stltypes.xml b/pypy/module/_cppyy/test/stltypes.xml
--- a/pypy/module/_cppyy/test/stltypes.xml
+++ b/pypy/module/_cppyy/test/stltypes.xml
@@ -2,30 +2,9 @@
 
   <namespace name="std" />
 
-  <class pattern="std::vector<*>" />
-  <!-- <class pattern="std::vector<*>::iterator" />
-  <class pattern="std::vector<*>::const_iterator" /> -->
-
-  <class pattern="std::list<*>" />
-  <!-- <class pattern="std::list<*>::iterator" />
-  <class pattern="std::list<*>::const_iterator" />
-  <class name="std::__detail::_List_node_base" /> -->
-
-  <class pattern="std::map<*>" />
-  <!-- <class pattern="std::pair<*>" /> -->
-  <!-- <class pattern="std::map<*>::iterator" />
-  <class pattern="std::map<*>::const_iterator" /> -->
-
-  <!-- <class pattern="__gnu_cxx::__normal_iterator<*>" /> -->
-
-  <!-- the following are for testing, not for iteration -->
-  <function name="__gnu_cxx::operator=="/>
-  <function name="__gnu_cxx::operator!="/>
-
   <class name="just_a_class" />
 
   <class name="std::string" />
   <class name="stringy_class" />
-  <class pattern="stl_like_class<*>" />
 
 </lcgdict>


More information about the pypy-commit mailing list