Regex instantiation
Tim Shen
timshen91@gmail.com
Thu Jan 9 02:03:00 GMT 2014
I've made several <regex> instantiations (see attach), but I'm not
sure how to export them to the target object file correctly.
Are there documented steps about exporting?
Thanks!
--
Regards,
Tim Shen
-------------- next part --------------
commit d6f1ad6ffb544ca35a96a563cb3b25e324dd6e94
Author: tim <timshen91@gmail.com>
Date: Wed Jan 8 21:01:44 2014 -0500
Not a formal patch.
diff --git a/libstdc++-v3/include/bits/regex.tcc b/libstdc++-v3/include/bits/regex.tcc
index 1ceac60..8021983 100644
--- a/libstdc++-v3/include/bits/regex.tcc
+++ b/libstdc++-v3/include/bits/regex.tcc
@@ -132,6 +132,26 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
return __ret;
}
+#if _GLIBCXX_EXTERN_TEMPLATE > 0
+#define __REGEX_INST(__c, __iter)\
+ extern template bool __regex_algo_impl<__iter, allocator<sub_match<__iter>>,\
+ __c, regex_traits<__c>, _RegexExecutorPolicy::_S_auto, false>\
+ (__iter, __iter, match_results<__iter>&, const basic_regex<__c>&,\
+ regex_constants::match_flag_type);\
+ extern template bool __regex_algo_impl<__iter, allocator<sub_match<__iter>>,\
+ __c, regex_traits<__c>, _RegexExecutorPolicy::_S_auto, true>\
+ (__iter, __iter, match_results<__iter>&, const basic_regex<__c>&,\
+ regex_constants::match_flag_type);
+
+ __REGEX_INST(char, const char*)
+ __REGEX_INST(char, basic_string<char>::const_iterator)
+#ifdef _GLIBCXX_USE_WCHAR_T
+ __REGEX_INST(wchar_t, const wchar_t*)
+ __REGEX_INST(wchar_t, basic_string<wchar_t>::const_iterator)
+#endif
+#undef __REGEX_INST
+#endif
+
_GLIBCXX_END_NAMESPACE_VERSION
}
@@ -704,6 +724,21 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_M_result = nullptr;
}
+#if _GLIBCXX_EXTERN_TEMPLATE > 0
+ extern template class regex_iterator<const char*>;
+ extern template class regex_iterator<basic_string<char>::const_iterator>;
+ extern template class regex_token_iterator<const char*>;
+ extern template class
+ regex_token_iterator<basic_string<char>::const_iterator>;
+#ifdef _GLIBCXX_USE_WCHAR_T
+ extern template class regex_iterator<const wchar_t*>;
+ extern template class regex_iterator<basic_string<wchar_t>::const_iterator>;
+ extern template class regex_token_iterator<const wchar_t*>;
+ extern template class
+ regex_token_iterator<basic_string<wchar_t>::const_iterator>;
+#endif
+#endif
+
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
diff --git a/libstdc++-v3/include/bits/regex_compiler.tcc b/libstdc++-v3/include/bits/regex_compiler.tcc
index 9ff538d..08c3662 100644
--- a/libstdc++-v3/include/bits/regex_compiler.tcc
+++ b/libstdc++-v3/include/bits/regex_compiler.tcc
@@ -528,6 +528,17 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
return __ret;
}
+#if _GLIBCXX_EXTERN_TEMPLATE > 0
+ extern template class _Compiler<const char*, regex_traits<char>>;
+ extern template class _Compiler<basic_string<char>::const_iterator,
+ regex_traits<char>>;
+#ifdef _GLIBCXX_USE_WCHAR_T
+ extern template class _Compiler<const wchar_t*, regex_traits<wchar_t>>;
+ extern template class _Compiler<basic_string<wchar_t>::const_iterator,
+ regex_traits<wchar_t>>;
+#endif
+#endif
+
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace __detail
} // namespace
diff --git a/libstdc++-v3/src/c++11/regex-inst.cc b/libstdc++-v3/src/c++11/regex-inst.cc
new file mode 100644
index 0000000..a65b0c5
--- /dev/null
+++ b/libstdc++-v3/src/c++11/regex-inst.cc
@@ -0,0 +1,68 @@
+// regex -*- C++ -*-
+
+// Copyright (C) 2011-2014 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+#include <regex>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+namespace __detail
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+#define __REGEX_INST(__c, __iter)\
+ extern template bool __regex_algo_impl<__iter, allocator<sub_match<__iter>>,\
+ __c, regex_traits<__c>, _RegexExecutorPolicy::_S_auto, false>\
+ (__iter, __iter, match_results<__iter>&, const basic_regex<__c>&,\
+ regex_constants::match_flag_type);\
+ extern template bool __regex_algo_impl<__iter, allocator<sub_match<__iter>>,\
+ __c, regex_traits<__c>, _RegexExecutorPolicy::_S_auto, true>\
+ (__iter, __iter, match_results<__iter>&, const basic_regex<__c>&,\
+ regex_constants::match_flag_type);
+
+ __REGEX_INST(char, const char*)
+ __REGEX_INST(char, basic_string<char>::const_iterator)
+ __REGEX_INST(wchar_t, const wchar_t*)
+ __REGEX_INST(wchar_t, basic_string<wchar_t>::const_iterator)
+#undef __REGEX_INST
+ extern template class _Compiler<const char*, regex_traits<char>>;
+ extern template class _Compiler<basic_string<char>::const_iterator,
+ regex_traits<char>>;
+ extern template class _Compiler<const wchar_t*, regex_traits<wchar_t>>;
+ extern template class _Compiler<basic_string<wchar_t>::const_iterator,
+ regex_traits<wchar_t>>;
+_GLIBCXX_END_NAMESPACE_VERSION
+}
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+ extern template class regex_iterator<const char*>;
+ extern template class regex_iterator<basic_string<char>::const_iterator>;
+ extern template class regex_token_iterator<const char*>;
+ extern template class
+ regex_token_iterator<basic_string<char>::const_iterator>;
+
+ extern template class regex_iterator<const wchar_t*>;
+ extern template class regex_iterator<basic_string<wchar_t>::const_iterator>;
+ extern template class regex_token_iterator<const wchar_t*>;
+ extern template class
+ regex_token_iterator<basic_string<wchar_t>::const_iterator>;
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace std
More information about the Libstdc++
mailing list