From patchwork Mon May 4 11:15:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dodji Seketeli X-Patchwork-Id: 39195 From: dodji@seketeli.org (Dodji Seketeli) Date: Mon, 04 May 2020 13:15:35 +0200 Subject: [PATCH] Fix compilation with g++ 4.8.5 on el7 Message-ID: <86y2q8hrxk.fsf@seketeli.org> 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): Wrap this specialization in the namespace sptr_utils and do away with the sptr_utils qualifier. * include/abg-regex.h (build_sptr): Likewise. Signed-off-by: Dodji Seketeli --- include/abg-libxml-utils.h | 8 ++++++-- include/abg-regex.h | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) 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 *p); +build_sptr(xmlTextReader *p); /// Specialization of build_str for xmlChar. template<> -xml::xml_char_sptr sptr_utils::build_sptr(xmlChar *p); +xml::xml_char_sptr +build_sptr(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& 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& strs); /// @return the shared_ptr that wraps @p p. template<> regex::regex_t_sptr -sptr_utils::build_sptr(regex_t *p); +build_sptr(regex_t *p); /// Specialization of sptr_utils::build_sptr for regex_t. /// @@ -82,7 +84,9 @@ sptr_utils::build_sptr(regex_t *p); /// @return the shared_ptr wrapping the newly created regex_t* template<> regex::regex_t_sptr -sptr_utils::build_sptr(); +build_sptr(); + +}// end namespace sptr_utils }// end namespace abigail