Reworked separate file template instantiation code, to use non-template forwarding functions instead - it works on more compilers that way.

[SVN r28295]
This commit is contained in:
John Maddock
2005-04-17 14:44:37 +00:00
parent 1d1fadeb5a
commit 112422adc9
2 changed files with 48 additions and 26 deletions

View File

@ -16,7 +16,6 @@
* DESCRIPTION: entry point for test program. * DESCRIPTION: entry point for test program.
*/ */
#define BOOST_REGEX_TEST_INSTANCES
#include "test.hpp" #include "test.hpp"
#include "test_locale.hpp" #include "test_locale.hpp"
#include <stdarg.h> #include <stdarg.h>
@ -103,3 +102,30 @@ void throw_exception(std::exception const & e)
#endif #endif
void test(const char& c, const test_regex_replace_tag& tag)
{
do_test(c, tag);
}
void test(const char& c, const test_regex_search_tag& tag)
{
do_test(c, tag);
}
void test(const char& c, const test_invalid_regex_tag& tag)
{
do_test(c, tag);
}
#ifndef BOOST_NO_WREGEX
void test(const wchar_t& c, const test_regex_replace_tag& tag)
{
do_test(c, tag);
}
void test(const wchar_t& c, const test_regex_search_tag& tag)
{
do_test(c, tag);
}
void test(const wchar_t& c, const test_invalid_regex_tag& tag)
{
do_test(c, tag);
}
#endif

View File

@ -33,8 +33,29 @@
// define test entry proc, this forwards on to the appropriate // define test entry proc, this forwards on to the appropriate
// real test: // real test:
// //
template <class charT, class tagT>
void do_test(const charT& c, const tagT& tag);
template <class charT, class tagT> template <class charT, class tagT>
void test(const charT& c, const tagT& tag) void test(const charT& c, const tagT& tag)
{
do_test(c, tag);
}
//
// make these non-templates to speed up compilation times:
//
void test(const char&, const test_regex_replace_tag&);
void test(const char&, const test_regex_search_tag&);
void test(const char&, const test_invalid_regex_tag&);
#ifndef BOOST_NO_WREGEX
void test(const wchar_t&, const test_regex_replace_tag&);
void test(const wchar_t&, const test_regex_search_tag&);
void test(const wchar_t&, const test_invalid_regex_tag&);
#endif
template <class charT, class tagT>
void do_test(const charT& c, const tagT& tag)
{ {
#ifndef BOOST_NO_STD_LOCALE #ifndef BOOST_NO_STD_LOCALE
test_info<charT>::set_typename(typeid(boost::basic_regex<charT, boost::cpp_regex_traits<charT> >).name()); test_info<charT>::set_typename(typeid(boost::basic_regex<charT, boost::cpp_regex_traits<charT> >).name());
@ -217,30 +238,5 @@ void test_operators();
void test_overloads(); void test_overloads();
void test_unicode(); void test_unicode();
//
// template instances:
// we pretty much have to instantiate these separately
// otherwise compilation times are really excessive...
// Unfortunately this doesn't work with SunPro:
//
#ifndef __SUNPRO_CC
#ifndef BOOST_REGEX_TEST_INSTANCES
#define template template<>
#endif
template void test<char, test_regex_replace_tag>(const char&, const test_regex_replace_tag&);
template void test<char, test_regex_search_tag>(const char&, const test_regex_search_tag&);
template void test<char, test_invalid_regex_tag>(const char&, const test_invalid_regex_tag&);
#ifndef BOOST_NO_WREGEX
template void test<wchar_t, test_regex_replace_tag>(const wchar_t&, const test_regex_replace_tag&);
template void test<wchar_t, test_regex_search_tag>(const wchar_t&, const test_regex_search_tag&);
template void test<wchar_t, test_invalid_regex_tag>(const wchar_t&, const test_invalid_regex_tag&);
#endif
#ifndef BOOST_REGEX_TEST_INSTANCES
#undef template
#endif
#endif
#endif #endif