Fix some GCC and clang warnings introduced by the new code

This commit is contained in:
jzmaddock
2015-10-06 12:46:09 +01:00
parent 2a5a5f3825
commit f617c73e9a
5 changed files with 21 additions and 10 deletions

View File

@ -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<std::basic_string<BOOST_REGEX_CHAR_T
# undef template
# endif
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif
} // namespace boost

View File

@ -1073,7 +1073,7 @@ bool perl_matcher<BidiIterator, Allocator, traits>::match_then()
}
template <class BidiIterator, class Allocator, class traits>
bool perl_matcher<BidiIterator, Allocator, traits>::skip_until_paren(int index, bool match)
bool perl_matcher<BidiIterator, Allocator, traits>::skip_until_paren(int index, bool have_match)
{
while(pstate)
{
@ -1081,7 +1081,7 @@ bool perl_matcher<BidiIterator, Allocator, traits>::skip_until_paren(int index,
{
if(static_cast<const re_brace*>(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<BidiIterator, Allocator, traits>::skip_until_paren(int index,
return true;
else if(pstate->type == syntax_element_startmark)
{
int index = static_cast<const re_brace*>(pstate)->index;
int idx = static_cast<const re_brace*>(pstate)->index;
pstate = pstate->next.p;
skip_until_paren(index, false);
skip_until_paren(idx, false);
continue;
}
pstate = pstate->next.p;

View File

@ -1037,7 +1037,7 @@ bool perl_matcher<BidiIterator, Allocator, traits>::match_then()
}
template <class BidiIterator, class Allocator, class traits>
bool perl_matcher<BidiIterator, Allocator, traits>::skip_until_paren(int index, bool match)
bool perl_matcher<BidiIterator, Allocator, traits>::skip_until_paren(int index, bool have_match)
{
while(pstate)
{
@ -1045,7 +1045,7 @@ bool perl_matcher<BidiIterator, Allocator, traits>::skip_until_paren(int index,
{
if(static_cast<const re_brace*>(pstate)->index == index)
{
if(match)
if(have_match)
return this->match_endmark();
pstate = pstate->next.p;
return true;

View File

@ -38,6 +38,7 @@
#ifndef BOOST_REGEX_ERROR_TYPE_HPP
#include <boost/regex/v4/error_type.hpp>
#endif
#include <boost/type_traits/make_unsigned.hpp>
#ifdef BOOST_NO_STDC_NAMESPACE
namespace std{
@ -53,7 +54,10 @@ namespace boost{ namespace BOOST_REGEX_DETAIL_NS{
//
template <class charT>
inline bool is_extended(charT c)
{ return c >= 256u; }
{
typedef typename make_unsigned<charT>::type unsigned_type;
return (sizeof(charT) > 1) && (static_cast<unsigned_type>(c) >= 256u);
}
inline bool is_extended(char)
{ return false; }

View File

@ -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
{