Fix compilation with g++ 4.8.5 on el7
Commit Message
Hello,
G++ 4.8.5 doesn't allow a function template specialization to appear
in a namespace that is different from the namespace where the function
template was declared. Also, in that namespace, the name of the
specialized function template must be non-fully-qualified.
Fixed thus and applied to master.
Note that this fixes the compilation error raised by the builder at
https://builder.wildebeest.org/buildbot/#/builders/18/builds/298/steps/7/logs/stdio.
* include/abg-libxml-utils.h (build_sptr<xmlTextReader>): Wrap
this specialization in the namespace sptr_utils and do away with
the sptr_utils qualifier.
* include/abg-regex.h (build_sptr<regex_t>): Likewise.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
---
include/abg-libxml-utils.h | 8 ++++++--
include/abg-regex.h | 8 ++++++--
2 files changed, 12 insertions(+), 4 deletions(-)
@@ -129,14 +129,18 @@ unescape_xml_comment(const std::string& str);
}//end namespace xml
+namespace sptr_utils
+{
/// Specialization of sptr_utils::build_sptr for xmlTextReader
template<>
xml::reader_sptr
-sptr_utils::build_sptr<xmlTextReader>(xmlTextReader *p);
+build_sptr<xmlTextReader>(xmlTextReader *p);
/// Specialization of build_str for xmlChar.
template<>
-xml::xml_char_sptr sptr_utils::build_sptr<xmlChar>(xmlChar *p);
+xml::xml_char_sptr
+build_sptr<xmlChar>(xmlChar *p);
+}// end namespace sptr_utils
}//end namespace abigail
#endif //__ABG_LIBXML_UTILS_H__
@@ -63,6 +63,8 @@ generate_from_strings(const std::vector<std::string>& strs);
}// end namespace regex
+namespace sptr_utils
+{
/// Specialization of sptr_utils::build_sptr for regex_t.
///
/// This is used to wrap a pointer to regex_t into a
@@ -73,7 +75,7 @@ generate_from_strings(const std::vector<std::string>& strs);
/// @return the shared_ptr<regex_t> that wraps @p p.
template<>
regex::regex_t_sptr
-sptr_utils::build_sptr<regex_t>(regex_t *p);
+build_sptr<regex_t>(regex_t *p);
/// Specialization of sptr_utils::build_sptr for regex_t.
///
@@ -82,7 +84,9 @@ sptr_utils::build_sptr<regex_t>(regex_t *p);
/// @return the shared_ptr<regex_t> wrapping the newly created regex_t*
template<>
regex::regex_t_sptr
-sptr_utils::build_sptr<regex_t>();
+build_sptr<regex_t>();
+
+}// end namespace sptr_utils
}// end namespace abigail