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