summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2014-10-19 20:22:58 (GMT)
committerTobias Markmann <tm@ayena.de>2014-10-20 13:49:33 (GMT)
commit6b22dfcf59474dd016a0355a3102a1dd3692d92c (patch)
tree2b1fd33be433a91e81fee84fdc2bf1b52575d934 /3rdParty/Boost/src/boost/regex/v4/cpp_regex_traits.hpp
parent38b0cb785fea8eae5e48fae56440695fdfd10ee1 (diff)
downloadswift-6b22dfcf59474dd016a0355a3102a1dd3692d92c.zip
swift-6b22dfcf59474dd016a0355a3102a1dd3692d92c.tar.bz2
Update Boost in 3rdParty to version 1.56.0.
This updates Boost in our 3rdParty directory to version 1.56.0. Updated our update.sh script to stop on error. Changed error reporting in SwiftTools/CrashReporter.cpp to SWIFT_LOG due to missing include of <iostream> with newer Boost. Change-Id: I4b35c77de951333979a524097f35f5f83d325edc
Diffstat (limited to '3rdParty/Boost/src/boost/regex/v4/cpp_regex_traits.hpp')
-rw-r--r--3rdParty/Boost/src/boost/regex/v4/cpp_regex_traits.hpp61
1 files changed, 53 insertions, 8 deletions
diff --git a/3rdParty/Boost/src/boost/regex/v4/cpp_regex_traits.hpp b/3rdParty/Boost/src/boost/regex/v4/cpp_regex_traits.hpp
index bcae455..106ffcb 100644
--- a/3rdParty/Boost/src/boost/regex/v4/cpp_regex_traits.hpp
+++ b/3rdParty/Boost/src/boost/regex/v4/cpp_regex_traits.hpp
@@ -20,6 +20,8 @@
#define BOOST_CPP_REGEX_TRAITS_HPP_INCLUDED
#include <boost/config.hpp>
+#include <boost/integer.hpp>
+#include <boost/type_traits/make_unsigned.hpp>
#ifndef BOOST_NO_STD_LOCALE
@@ -107,12 +109,14 @@ template<class charT, class traits>
typename parser_buf<charT, traits>::pos_type
parser_buf<charT, traits>::seekoff(off_type off, ::std::ios_base::seekdir way, ::std::ios_base::openmode which)
{
+ typedef typename boost::int_t<sizeof(way) * CHAR_BIT>::least cast_type;
+
if(which & ::std::ios_base::out)
return pos_type(off_type(-1));
std::ptrdiff_t size = this->egptr() - this->eback();
std::ptrdiff_t pos = this->gptr() - this->eback();
charT* g = this->eback();
- switch(way)
+ switch(static_cast<cast_type>(way))
{
case ::std::ios_base::beg:
if((off < 0) || (off > size))
@@ -504,8 +508,18 @@ typename cpp_regex_traits_implementation<charT>::string_type
// we adhere to gcc's (buggy) preconditions...
//
BOOST_ASSERT(*p2 == 0);
-
string_type result;
+#if defined(_CPPLIB_VER)
+ //
+ // A bug in VC11 and 12 causes the program to hang if we pass a null-string
+ // to std::collate::transform, but only for certain locales :-(
+ // Probably effects Intel and Clang or any compiler using the VC std library (Dinkumware).
+ //
+ if(*p1 == 0)
+ {
+ return string_type(1, charT(0));
+ }
+#endif
//
// swallowing all exceptions here is a bad idea
// however at least one std lib will always throw
@@ -579,7 +593,18 @@ typename cpp_regex_traits_implementation<charT>::string_type
// however at least one std lib will always throw
// std::bad_alloc for certain arguments...
//
- string_type result;
+ string_type result, result2;
+#if defined(_CPPLIB_VER)
+ //
+ // A bug in VC11 and 12 causes the program to hang if we pass a null-string
+ // to std::collate::transform, but only for certain locales :-(
+ // Probably effects Intel and Clang or any compiler using the VC std library (Dinkumware).
+ //
+ if(*p1 == 0)
+ {
+ return result;
+ }
+#endif
#ifndef BOOST_NO_EXCEPTIONS
try{
#endif
@@ -598,14 +623,36 @@ typename cpp_regex_traits_implementation<charT>::string_type
while(result.size() && (charT(0) == *result.rbegin()))
result.erase(result.size() - 1);
#endif
- BOOST_ASSERT(std::find(result.begin(), result.end(), charT(0)) == result.end());
+ //
+ // We may have NULL's used as separators between sections of the collate string,
+ // an example would be Boost.Locale. We have no way to detect this case via
+ // #defines since this can be used with any compiler/platform combination.
+ // Unfortunately our state machine (which was devised when all implementations
+ // used underlying C language API's) can't cope with that case. One workaround
+ // is to replace each character with 2, fortunately this code isn't used that
+ // much as this is now slower than before :-(
+ //
+ typedef typename make_unsigned<charT>::type uchar_type;
+ result2.reserve(result.size() * 2 + 2);
+ for(unsigned i = 0; i < result.size(); ++i)
+ {
+ if(static_cast<uchar_type>(result[i]) == (std::numeric_limits<uchar_type>::max)())
+ {
+ result2.append(1, charT((std::numeric_limits<uchar_type>::max)())).append(1, charT('b'));
+ }
+ else
+ {
+ result2.append(1, static_cast<charT>(1 + static_cast<uchar_type>(result[i]))).append(1, charT('b') - 1);
+ }
+ }
+ BOOST_ASSERT(std::find(result2.begin(), result2.end(), charT(0)) == result2.end());
#ifndef BOOST_NO_EXCEPTIONS
}
catch(...)
{
}
#endif
- return result;
+ return result2;
}
@@ -621,7 +668,6 @@ typename cpp_regex_traits_implementation<charT>::string_type
return pos->second;
}
#if !defined(BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS)\
- && !BOOST_WORKAROUND(BOOST_MSVC, < 1300)\
&& !BOOST_WORKAROUND(__BORLANDC__, <= 0x0551)
std::string name(p1, p2);
#else
@@ -632,7 +678,6 @@ typename cpp_regex_traits_implementation<charT>::string_type
#endif
name = lookup_default_collate_name(name);
#if !defined(BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS)\
- && !BOOST_WORKAROUND(BOOST_MSVC, < 1300)\
&& !BOOST_WORKAROUND(__BORLANDC__, <= 0x0551)
if(name.size())
return string_type(name.begin(), name.end());
@@ -854,7 +899,7 @@ bool cpp_regex_traits_implementation<charT>::isctype(const charT c, char_class_t
template <class charT>
-inline boost::shared_ptr<const cpp_regex_traits_implementation<charT> > create_cpp_regex_traits(const std::locale& l BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(charT))
+inline boost::shared_ptr<const cpp_regex_traits_implementation<charT> > create_cpp_regex_traits(const std::locale& l)
{
cpp_regex_traits_base<charT> key(l);
return ::boost::object_cache<cpp_regex_traits_base<charT>, cpp_regex_traits_implementation<charT> >::get(key, 5);