From f617c73e9a5a4a92baf4def9568f70e5aa0ff128 Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Tue, 6 Oct 2015 12:46:09 +0100 Subject: [PATCH] Fix some GCC and clang warnings introduced by the new code --- include/boost/regex/v4/instances.hpp | 9 ++++++++- include/boost/regex/v4/perl_matcher_non_recursive.hpp | 8 ++++---- include/boost/regex/v4/perl_matcher_recursive.hpp | 4 ++-- include/boost/regex/v4/regex_traits_defaults.hpp | 6 +++++- include/boost/regex/v4/states.hpp | 4 ++-- 5 files changed, 21 insertions(+), 10 deletions(-) diff --git a/include/boost/regex/v4/instances.hpp b/include/boost/regex/v4/instances.hpp index 87447dea..f66b237c 100644 --- a/include/boost/regex/v4/instances.hpp +++ b/include/boost/regex/v4/instances.hpp @@ -119,6 +119,11 @@ template class BOOST_REGEX_TEMPLATE_DECL ::boost::BOOST_REGEX_DETAIL_NS::perl_ma #elif (defined(__GNUC__) && (__GNUC__ >= 3)) || !defined(BOOST_NO_CXX11_EXTERN_TEMPLATE) +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wkeyword-macro" +#endif + # ifndef BOOST_REGEX_INSTANTIATE # ifdef __GNUC__ # define template __extension__ extern template @@ -205,7 +210,9 @@ template BOOST_REGEX_DECL bool perl_matcher::match_then() } template -bool perl_matcher::skip_until_paren(int index, bool match) +bool perl_matcher::skip_until_paren(int index, bool have_match) { while(pstate) { @@ -1081,7 +1081,7 @@ bool perl_matcher::skip_until_paren(int index, { if(static_cast(pstate)->index == index) { - if(match) + if(have_match) return this->match_endmark(); pstate = pstate->next.p; return true; @@ -1102,9 +1102,9 @@ bool perl_matcher::skip_until_paren(int index, return true; else if(pstate->type == syntax_element_startmark) { - int index = static_cast(pstate)->index; + int idx = static_cast(pstate)->index; pstate = pstate->next.p; - skip_until_paren(index, false); + skip_until_paren(idx, false); continue; } pstate = pstate->next.p; diff --git a/include/boost/regex/v4/perl_matcher_recursive.hpp b/include/boost/regex/v4/perl_matcher_recursive.hpp index 1e17d0a2..3893837d 100644 --- a/include/boost/regex/v4/perl_matcher_recursive.hpp +++ b/include/boost/regex/v4/perl_matcher_recursive.hpp @@ -1037,7 +1037,7 @@ bool perl_matcher::match_then() } template -bool perl_matcher::skip_until_paren(int index, bool match) +bool perl_matcher::skip_until_paren(int index, bool have_match) { while(pstate) { @@ -1045,7 +1045,7 @@ bool perl_matcher::skip_until_paren(int index, { if(static_cast(pstate)->index == index) { - if(match) + if(have_match) return this->match_endmark(); pstate = pstate->next.p; return true; diff --git a/include/boost/regex/v4/regex_traits_defaults.hpp b/include/boost/regex/v4/regex_traits_defaults.hpp index 6a0783c7..18218837 100644 --- a/include/boost/regex/v4/regex_traits_defaults.hpp +++ b/include/boost/regex/v4/regex_traits_defaults.hpp @@ -38,6 +38,7 @@ #ifndef BOOST_REGEX_ERROR_TYPE_HPP #include #endif +#include #ifdef BOOST_NO_STDC_NAMESPACE namespace std{ @@ -53,7 +54,10 @@ namespace boost{ namespace BOOST_REGEX_DETAIL_NS{ // template inline bool is_extended(charT c) -{ return c >= 256u; } +{ + typedef typename make_unsigned::type unsigned_type; + return (sizeof(charT) > 1) && (static_cast(c) >= 256u); +} inline bool is_extended(char) { return false; } diff --git a/include/boost/regex/v4/states.hpp b/include/boost/regex/v4/states.hpp index a621420f..b56d0134 100644 --- a/include/boost/regex/v4/states.hpp +++ b/include/boost/regex/v4/states.hpp @@ -125,7 +125,7 @@ enum syntax_element_type syntax_element_fail = syntax_element_recurse + 1, syntax_element_accept = syntax_element_fail + 1, syntax_element_commit = syntax_element_accept + 1, - syntax_element_then = syntax_element_commit + 1, + syntax_element_then = syntax_element_commit + 1 }; #ifdef BOOST_REGEX_DEBUG @@ -269,7 +269,7 @@ enum commit_type { commit_prune, commit_skip, - commit_commit, + commit_commit }; struct re_commit : public re_syntax_base {