diff mbox series

Fix compilation with g++ 4.8.5 on el7

Message ID 86y2q8hrxk.fsf@seketeli.org
State Committed
Headers show
Series Fix compilation with g++ 4.8.5 on el7 | expand

Commit Message

Dodji Seketeli May 4, 2020, 11:15 a.m. UTC
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(-)
diff mbox series

Patch

diff --git a/include/abg-libxml-utils.h b/include/abg-libxml-utils.h
index 1e46d95..cf167b8 100644
--- a/include/abg-libxml-utils.h
+++ b/include/abg-libxml-utils.h
@@ -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__
diff --git a/include/abg-regex.h b/include/abg-regex.h
index 2f638ef..d39ada4 100644
--- a/include/abg-regex.h
+++ b/include/abg-regex.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