|
|
ef6a0a |
From 2b4c331e70f1f8eaae33537df12c5744dd8e8b09 Mon Sep 17 00:00:00 2001
|
|
|
ef6a0a |
From: Hartmut Kaiser <hartmut.kaiser@gmail.com>
|
|
|
ef6a0a |
Date: Sat, 16 Mar 2013 14:39:51 +0000
|
|
|
ef6a0a |
Subject: [PATCH] Fix #8291: Lexer fails to work on ARM
|
|
|
ef6a0a |
|
|
|
ef6a0a |
[SVN r83462]
|
|
|
ef6a0a |
---
|
|
|
ef6a0a |
include/boost/spirit/home/support/detail/lexer/generator.hpp | 3 ++-
|
|
|
ef6a0a |
include/boost/spirit/home/support/detail/lexer/string_token.hpp | 3 ++-
|
|
|
ef6a0a |
2 files changed, 4 insertions(+), 2 deletions(-)
|
|
|
ef6a0a |
|
|
|
ef6a0a |
diff --git a/include/boost/spirit/home/support/detail/lexer/generator.hpp b/include/boost/spirit/home/support/detail/lexer/generator.hpp
|
|
|
ef6a0a |
index 49bea2f..9541f6f 100644
|
|
|
ef6a0a |
--- a/include/boost/spirit/home/support/detail/lexer/generator.hpp
|
|
|
ef6a0a |
+++ b/include/boost/spirit/home/support/detail/lexer/generator.hpp
|
|
|
ef6a0a |
@@ -12,6 +12,7 @@
|
|
|
ef6a0a |
#include "partition/charset.hpp"
|
|
|
ef6a0a |
#include "partition/equivset.hpp"
|
|
|
ef6a0a |
#include <memory>
|
|
|
ef6a0a |
+#include <limits>
|
|
|
ef6a0a |
#include "parser/tree/node.hpp"
|
|
|
ef6a0a |
#include "parser/parser.hpp"
|
|
|
ef6a0a |
#include "containers/ptr_list.hpp"
|
|
|
ef6a0a |
@@ -560,7 +561,7 @@ class basic_generator
|
|
|
ef6a0a |
|
|
|
ef6a0a |
if (token_._negated)
|
|
|
ef6a0a |
{
|
|
|
ef6a0a |
- CharT curr_char_ = sizeof (CharT) == 1 ? -128 : 0;
|
|
|
ef6a0a |
+ CharT curr_char_ = (std::numeric_limits<CharT>::min)();
|
|
|
ef6a0a |
std::size_t i_ = 0;
|
|
|
ef6a0a |
|
|
|
ef6a0a |
while (curr_ < chars_end_)
|
|
|
ef6a0a |
diff --git a/include/boost/spirit/home/support/detail/lexer/string_token.hpp b/include/boost/spirit/home/support/detail/lexer/string_token.hpp
|
|
|
ef6a0a |
index 6bfa6ff..e972a95 100644
|
|
|
ef6a0a |
--- a/include/boost/spirit/home/support/detail/lexer/string_token.hpp
|
|
|
ef6a0a |
+++ b/include/boost/spirit/home/support/detail/lexer/string_token.hpp
|
|
|
ef6a0a |
@@ -10,6 +10,7 @@
|
|
|
ef6a0a |
#include "size_t.hpp"
|
|
|
ef6a0a |
#include "consts.hpp" // num_chars, num_wchar_ts
|
|
|
ef6a0a |
#include <string>
|
|
|
ef6a0a |
+#include <limits>
|
|
|
ef6a0a |
|
|
|
ef6a0a |
namespace boost
|
|
|
ef6a0a |
{
|
|
|
ef6a0a |
@@ -71,7 +72,7 @@ struct basic_string_token
|
|
|
ef6a0a |
{
|
|
|
ef6a0a |
const std::size_t max_chars_ = sizeof (CharT) == 1 ?
|
|
|
ef6a0a |
num_chars : num_wchar_ts;
|
|
|
ef6a0a |
- CharT curr_char_ = sizeof (CharT) == 1 ? -128 : 0;
|
|
|
ef6a0a |
+ CharT curr_char_ = (std::numeric_limits<CharT>::min)();
|
|
|
ef6a0a |
string temp_;
|
|
|
ef6a0a |
const CharT *curr_ = _charset.c_str ();
|
|
|
ef6a0a |
const CharT *chars_end_ = curr_ + _charset.size ();
|
|
|
ef6a0a |
|
|
|
ef6a0a |
From c480d6c7fcadf3cb5fbaad756ac370275a75e601 Mon Sep 17 00:00:00 2001
|
|
|
ef6a0a |
From: Joel de Guzman <djowel@gmail.com>
|
|
|
ef6a0a |
Date: Sat, 19 Jul 2014 08:12:53 +0800
|
|
|
ef6a0a |
Subject: [PATCH] workaround for lexertl bug on platforms where wchar_t is
|
|
|
ef6a0a |
signed (can be negative).
|
|
|
ef6a0a |
|
|
|
ef6a0a |
---
|
|
|
ef6a0a |
include/boost/spirit/home/support/detail/lexer/generator.hpp | 7 ++++++-
|
|
|
ef6a0a |
1 file changed, 6 insertions(+), 1 deletion(-)
|
|
|
ef6a0a |
|
|
|
ef6a0a |
diff --git a/include/boost/spirit/home/support/detail/lexer/generator.hpp b/include/boost/spirit/home/support/detail/lexer/generator.hpp
|
|
|
ef6a0a |
index a3b7290..daa06e7 100644
|
|
|
ef6a0a |
--- a/include/boost/spirit/home/support/detail/lexer/generator.hpp
|
|
|
ef6a0a |
+++ b/include/boost/spirit/home/support/detail/lexer/generator.hpp
|
|
|
ef6a0a |
@@ -561,7 +561,12 @@ class basic_generator
|
|
|
ef6a0a |
|
|
|
ef6a0a |
if (token_._negated)
|
|
|
ef6a0a |
{
|
|
|
ef6a0a |
- CharT curr_char_ = (std::numeric_limits<CharT>::min)();
|
|
|
ef6a0a |
+ // $$$ FIXME JDG July 2014 $$$
|
|
|
ef6a0a |
+ // this code is problematic on platforms where wchar_t is signed
|
|
|
ef6a0a |
+ // with min generating negative numbers. This crashes with BAD_ACCESS
|
|
|
ef6a0a |
+ // because of the vector index below:
|
|
|
ef6a0a |
+ // ptr_[static_cast<typename Traits::index_type>(curr_char_)]
|
|
|
ef6a0a |
+ CharT curr_char_ = 0; // (std::numeric_limits<CharT>::min)();
|
|
|
ef6a0a |
std::size_t i_ = 0;
|
|
|
ef6a0a |
|
|
|
ef6a0a |
while (curr_ < chars_end_)
|