summaryrefslogtreecommitdiff
path: root/boost/spirit/home/x3
diff options
context:
space:
mode:
authorDongHun Kwak <dh0128.kwak@samsung.com>2017-09-13 11:24:46 +0900
committerDongHun Kwak <dh0128.kwak@samsung.com>2017-09-13 11:25:39 +0900
commit4fadd968fa12130524c8380f33fcfe25d4de79e5 (patch)
treefd26a490cd15388d42fc6652b3c5c13012e7f93e /boost/spirit/home/x3
parentb5c87084afaef42b2d058f68091be31988a6a874 (diff)
downloadboost-upstream/1.65.0.tar.gz
boost-upstream/1.65.0.tar.bz2
boost-upstream/1.65.0.zip
Imported Upstream version 1.65.0upstream/1.65.0
Change-Id: Icf8400b375482cb11bcf77440a6934ba360d6ba4 Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
Diffstat (limited to 'boost/spirit/home/x3')
-rw-r--r--boost/spirit/home/x3/auxiliary/attr.hpp8
-rw-r--r--boost/spirit/home/x3/auxiliary/eps.hpp2
-rw-r--r--boost/spirit/home/x3/char/char.hpp6
-rw-r--r--boost/spirit/home/x3/char/char_class.hpp2
-rw-r--r--boost/spirit/home/x3/char/char_set.hpp2
-rw-r--r--boost/spirit/home/x3/core/call.hpp2
-rw-r--r--boost/spirit/home/x3/core/detail/parse_into_container.hpp10
-rw-r--r--boost/spirit/home/x3/core/parser.hpp27
-rw-r--r--boost/spirit/home/x3/nonterminal/detail/rule.hpp16
-rw-r--r--boost/spirit/home/x3/nonterminal/rule.hpp10
-rw-r--r--boost/spirit/home/x3/numeric.hpp2
-rw-r--r--boost/spirit/home/x3/numeric/bool.hpp2
-rw-r--r--boost/spirit/home/x3/operator/detail/alternative.hpp2
-rw-r--r--boost/spirit/home/x3/string/literal_string.hpp6
-rw-r--r--boost/spirit/home/x3/string/symbols.hpp2
-rw-r--r--boost/spirit/home/x3/support/context.hpp6
-rw-r--r--boost/spirit/home/x3/support/traits/container_traits.hpp4
17 files changed, 79 insertions, 30 deletions
diff --git a/boost/spirit/home/x3/auxiliary/attr.hpp b/boost/spirit/home/x3/auxiliary/attr.hpp
index 5b3c7a5d85..6471bd90df 100644
--- a/boost/spirit/home/x3/auxiliary/attr.hpp
+++ b/boost/spirit/home/x3/auxiliary/attr.hpp
@@ -40,8 +40,8 @@ namespace boost { namespace spirit { namespace x3
template <typename Iterator, typename Context
, typename RuleContext, typename Attribute>
- bool parse(Iterator& first, Iterator const& last
- , Context const& context, RuleContext&, Attribute& attr_) const
+ bool parse(Iterator& /* first */, Iterator const& /* last */
+ , Context const& /* context */, RuleContext&, Attribute& attr_) const
{
// $$$ Change to copy_to once we have it $$$
traits::move_to(value_, attr_);
@@ -76,8 +76,8 @@ namespace boost { namespace spirit { namespace x3
template <typename Iterator, typename Context
, typename RuleContext, typename Attribute>
- bool parse(Iterator& first, Iterator const& last
- , Context const& context, RuleContext&, Attribute& attr_) const
+ bool parse(Iterator& /* first */, Iterator const& /* last */
+ , Context const& /* context */, RuleContext&, Attribute& attr_) const
{
// $$$ Change to copy_to once we have it $$$
traits::move_to(value_ + 0, value_ + N, attr_);
diff --git a/boost/spirit/home/x3/auxiliary/eps.hpp b/boost/spirit/home/x3/auxiliary/eps.hpp
index 816eea7b0f..3d4ae9a57d 100644
--- a/boost/spirit/home/x3/auxiliary/eps.hpp
+++ b/boost/spirit/home/x3/auxiliary/eps.hpp
@@ -45,7 +45,7 @@ namespace boost { namespace spirit { namespace x3
template <typename Iterator, typename Context, typename Attribute>
bool parse(Iterator& first, Iterator const& last
- , Context const& context, unused_type, Attribute& attr) const
+ , Context const& context, unused_type, Attribute& /* attr */) const
{
x3::skip_over(first, last, context);
return f(x3::get<rule_context_tag>(context));
diff --git a/boost/spirit/home/x3/char/char.hpp b/boost/spirit/home/x3/char/char.hpp
index 5cfd720152..8cd213a2bc 100644
--- a/boost/spirit/home/x3/char/char.hpp
+++ b/boost/spirit/home/x3/char/char.hpp
@@ -38,6 +38,7 @@ namespace boost { namespace spirit { namespace x3
using standard::char_;
using standard::lit;
+#ifndef BOOST_SPIRIT_NO_STANDARD_WIDE
namespace standard_wide
{
typedef any_char<char_encoding::standard_wide> char_type;
@@ -49,6 +50,7 @@ namespace boost { namespace spirit { namespace x3
return { ch };
}
}
+#endif
namespace ascii
{
@@ -103,6 +105,7 @@ namespace boost { namespace spirit { namespace x3
}
};
+#ifndef BOOST_SPIRIT_NO_STANDARD_WIDE
template <>
struct as_parser<wchar_t>
{
@@ -117,6 +120,7 @@ namespace boost { namespace spirit { namespace x3
return { ch };
}
};
+#endif
template <>
struct as_parser<char [2]>
@@ -133,6 +137,7 @@ namespace boost { namespace spirit { namespace x3
}
};
+#ifndef BOOST_SPIRIT_NO_STANDARD_WIDE
template <>
struct as_parser<wchar_t [2]>
{
@@ -147,6 +152,7 @@ namespace boost { namespace spirit { namespace x3
return { ch[0] };
}
};
+#endif
}
diff --git a/boost/spirit/home/x3/char/char_class.hpp b/boost/spirit/home/x3/char/char_class.hpp
index 7fae90fdcd..0af6f01d9f 100644
--- a/boost/spirit/home/x3/char/char_class.hpp
+++ b/boost/spirit/home/x3/char/char_class.hpp
@@ -93,7 +93,9 @@ namespace boost { namespace spirit { namespace x3
/***/
BOOST_SPIRIT_X3_CHAR_CLASSES(standard)
+#ifndef BOOST_SPIRIT_NO_STANDARD_WIDE
BOOST_SPIRIT_X3_CHAR_CLASSES(standard_wide)
+#endif
BOOST_SPIRIT_X3_CHAR_CLASSES(ascii)
BOOST_SPIRIT_X3_CHAR_CLASSES(iso8859_1)
diff --git a/boost/spirit/home/x3/char/char_set.hpp b/boost/spirit/home/x3/char/char_set.hpp
index 3a8f986456..1bff83ec6b 100644
--- a/boost/spirit/home/x3/char/char_set.hpp
+++ b/boost/spirit/home/x3/char/char_set.hpp
@@ -115,7 +115,7 @@ namespace boost { namespace spirit { namespace x3
struct get_info<char_set<Encoding, Attribute>>
{
typedef std::string result_type;
- std::string operator()(char_set<Encoding, Attribute> const& p) const
+ std::string operator()(char_set<Encoding, Attribute> const& /* p */) const
{
return "char-set";
}
diff --git a/boost/spirit/home/x3/core/call.hpp b/boost/spirit/home/x3/core/call.hpp
index 9674c93efe..8a5deedb73 100644
--- a/boost/spirit/home/x3/core/call.hpp
+++ b/boost/spirit/home/x3/core/call.hpp
@@ -52,7 +52,7 @@ namespace boost { namespace spirit { namespace x3
}
template <typename F, typename Context>
- auto call(F f, Context const& context, mpl::false_)
+ auto call(F f, Context const& /* context */, mpl::false_)
{
return f();
}
diff --git a/boost/spirit/home/x3/core/detail/parse_into_container.hpp b/boost/spirit/home/x3/core/detail/parse_into_container.hpp
index 96424a4278..45ecc41ae0 100644
--- a/boost/spirit/home/x3/core/detail/parse_into_container.hpp
+++ b/boost/spirit/home/x3/core/detail/parse_into_container.hpp
@@ -202,7 +202,7 @@ namespace boost { namespace spirit { namespace x3 { namespace detail
static bool call(
Parser const& parser
, Iterator& first, Iterator const& last, Context const& context
- , RContext& rcontext, Attribute& attr, mpl::false_)
+ , RContext& rcontext, Attribute& /* attr */, mpl::false_)
{
return parser.parse(first, last, context, rcontext, unused);
}
@@ -251,7 +251,13 @@ namespace boost { namespace spirit { namespace x3 { namespace detail
, Iterator& first, Iterator const& last
, Context const& context, RContext& rcontext, Attribute& attr, mpl::true_)
{
- return parser.parse(first, last, context, rcontext, attr);
+ if (attr.empty())
+ return parser.parse(first, last, context, rcontext, attr);
+ Attribute rest;
+ bool r = parser.parse(first, last, context, rcontext, rest);
+ if (r)
+ attr.insert(attr.end(), rest.begin(), rest.end());
+ return r;
}
template <typename Iterator, typename Attribute>
diff --git a/boost/spirit/home/x3/core/parser.hpp b/boost/spirit/home/x3/core/parser.hpp
index 0df69304e0..27115b8de4 100644
--- a/boost/spirit/home/x3/core/parser.hpp
+++ b/boost/spirit/home/x3/core/parser.hpp
@@ -18,6 +18,8 @@
#include <boost/spirit/home/x3/support/context.hpp>
#include <boost/spirit/home/x3/support/traits/has_attribute.hpp>
#include <boost/spirit/home/x3/support/utility/sfinae.hpp>
+#include <boost/core/ignore_unused.hpp>
+#include <boost/assert.hpp>
#include <string>
#if !defined(BOOST_SPIRIT_X3_NO_RTTI)
@@ -63,6 +65,23 @@ namespace boost { namespace spirit { namespace x3
}
};
+ namespace detail {
+ template <typename Parser>
+ static void assert_initialized_rule(Parser const& p) {
+ boost::ignore_unused(p);
+
+ // Assert that we are not copying an unitialized static rule. If
+ // the static is in another TU, it may be initialized after we copy
+ // it. If so, its name member will be nullptr.
+ //
+ // Rather than hardcoding behaviour for rule-type subject parsers,
+ // we simply allow get_info<> to do the check in debug builds.
+#ifndef NDEBUG
+ what(p); // note: allows get_info<> to diagnose the issue
+#endif
+ }
+ }
+
struct unary_category;
struct binary_category;
@@ -74,7 +93,7 @@ namespace boost { namespace spirit { namespace x3
static bool const has_action = Subject::has_action;
unary_parser(Subject const& subject)
- : subject(subject) {}
+ : subject(subject) { detail::assert_initialized_rule(subject); }
unary_parser const& get_unary() const { return *this; }
@@ -91,7 +110,11 @@ namespace boost { namespace spirit { namespace x3
left_type::has_action || right_type::has_action;
binary_parser(Left const& left, Right const& right)
- : left(left), right(right) {}
+ : left(left), right(right)
+ {
+ detail::assert_initialized_rule(left);
+ detail::assert_initialized_rule(right);
+ }
binary_parser const& get_binary() const { return *this; }
diff --git a/boost/spirit/home/x3/nonterminal/detail/rule.hpp b/boost/spirit/home/x3/nonterminal/detail/rule.hpp
index e07b067718..dda44e1f50 100644
--- a/boost/spirit/home/x3/nonterminal/detail/rule.hpp
+++ b/boost/spirit/home/x3/nonterminal/detail/rule.hpp
@@ -7,6 +7,7 @@
#if !defined(BOOST_SPIRIT_X3_DETAIL_RULE_JAN_08_2012_0326PM)
#define BOOST_SPIRIT_X3_DETAIL_RULE_JAN_08_2012_0326PM
+#include <boost/core/ignore_unused.hpp>
#include <boost/spirit/home/x3/auxiliary/guard.hpp>
#include <boost/spirit/home/x3/core/parser.hpp>
#include <boost/spirit/home/x3/core/skip_over.hpp>
@@ -138,7 +139,7 @@ namespace boost { namespace spirit { namespace x3 { namespace detail
template <typename ID, typename RHS, typename Context>
Context const&
- make_rule_context(RHS const& rhs, Context const& context
+ make_rule_context(RHS const& /* rhs */, Context const& context
, mpl::false_ /* is_default_parse_rule */)
{
return context;
@@ -156,8 +157,8 @@ namespace boost { namespace spirit { namespace x3 { namespace detail
{
template <typename Iterator, typename Context, typename ActualAttribute>
static bool call_on_success(
- Iterator& first, Iterator const& last
- , Context const& context, ActualAttribute& attr
+ Iterator& /* first */, Iterator const& /* last */
+ , Context const& /* context */, ActualAttribute& /* attr */
, mpl::false_ /* No on_success handler */ )
{
return true;
@@ -285,7 +286,7 @@ namespace boost { namespace spirit { namespace x3 { namespace detail
static bool parse_rhs(
RHS const& rhs
, Iterator& first, Iterator const& last
- , Context const& context, RContext& rcontext, ActualAttribute& attr
+ , Context const& context, RContext& rcontext, ActualAttribute& /* attr */
, mpl::true_)
{
return parse_rhs_main(rhs, first, last, context, rcontext, unused);
@@ -300,6 +301,8 @@ namespace boost { namespace spirit { namespace x3 { namespace detail
, Context const& context, ActualAttribute& attr
, ExplicitAttrPropagation)
{
+ boost::ignore_unused(rule_name);
+
typedef traits::make_attribute<Attribute, ActualAttribute> make_attribute;
// do down-stream transformation, provides attribute for
@@ -325,9 +328,8 @@ namespace boost { namespace spirit { namespace x3 { namespace detail
// traits::post_transform when, for example,
// ActualAttribute is a recursive variant).
#if defined(BOOST_SPIRIT_X3_DEBUG)
- typedef typename make_attribute::type dbg_attribute_type;
- context_debug<Iterator, dbg_attribute_type>
- dbg(rule_name, first, last, dbg_attribute_type(attr_), ok_parse);
+ context_debug<Iterator, transform_attr>
+ dbg(rule_name, first, last, attr_, ok_parse);
#endif
ok_parse = parse_rhs(rhs, first, last, context, attr_, attr_
, mpl::bool_
diff --git a/boost/spirit/home/x3/nonterminal/rule.hpp b/boost/spirit/home/x3/nonterminal/rule.hpp
index 56075f34d7..ffed1fe965 100644
--- a/boost/spirit/home/x3/nonterminal/rule.hpp
+++ b/boost/spirit/home/x3/nonterminal/rule.hpp
@@ -20,15 +20,12 @@
namespace boost { namespace spirit { namespace x3
{
- template <typename ID>
- struct identity {};
-
// default parse_rule implementation
template <typename ID, typename Attribute, typename Iterator
, typename Context, typename ActualAttribute>
inline detail::default_parse_rule_result
parse_rule(
- rule<ID, Attribute> rule_
+ rule<ID, Attribute> /* rule_ */
, Iterator& first, Iterator const& last
, Context const& context, ActualAttribute& attr)
{
@@ -137,7 +134,8 @@ namespace boost { namespace spirit { namespace x3
typedef std::string result_type;
std::string operator()(T const& r) const
{
- return r.name;
+ BOOST_ASSERT_MSG(r.name, "uninitialized rule"); // static initialization order fiasco
+ return r.name? r.name : "uninitialized";
}
};
@@ -156,7 +154,7 @@ namespace boost { namespace spirit { namespace x3
#define BOOST_SPIRIT_DEFINE_(r, data, rule_name) \
template <typename Iterator, typename Context, typename Attribute> \
inline bool parse_rule( \
- decltype(rule_name) rule_ \
+ decltype(rule_name) /* rule_ */ \
, Iterator& first, Iterator const& last \
, Context const& context, Attribute& attr) \
{ \
diff --git a/boost/spirit/home/x3/numeric.hpp b/boost/spirit/home/x3/numeric.hpp
index ae4d9caa26..3acff052d1 100644
--- a/boost/spirit/home/x3/numeric.hpp
+++ b/boost/spirit/home/x3/numeric.hpp
@@ -10,6 +10,8 @@
#include <boost/spirit/home/x3/numeric/bool.hpp>
#include <boost/spirit/home/x3/numeric/int.hpp>
#include <boost/spirit/home/x3/numeric/uint.hpp>
+#ifndef BOOST_SPIRIT_NO_REAL_NUMBERS
#include <boost/spirit/home/x3/numeric/real.hpp>
+#endif
#endif
diff --git a/boost/spirit/home/x3/numeric/bool.hpp b/boost/spirit/home/x3/numeric/bool.hpp
index 1fd7018b0f..d5c53c0474 100644
--- a/boost/spirit/home/x3/numeric/bool.hpp
+++ b/boost/spirit/home/x3/numeric/bool.hpp
@@ -114,6 +114,7 @@ namespace boost { namespace spirit { namespace x3
false_type const false_ = { false };
}
+#ifndef BOOST_SPIRIT_NO_STANDARD_WIDE
namespace standard_wide
{
typedef bool_parser<bool, char_encoding::standard_wide> bool_type;
@@ -125,6 +126,7 @@ namespace boost { namespace spirit { namespace x3
typedef literal_bool_parser<bool, char_encoding::standard_wide> false_type;
false_type const false_ = { false };
}
+#endif
namespace ascii
{
diff --git a/boost/spirit/home/x3/operator/detail/alternative.hpp b/boost/spirit/home/x3/operator/detail/alternative.hpp
index 9fbc4f4dc4..0043710320 100644
--- a/boost/spirit/home/x3/operator/detail/alternative.hpp
+++ b/boost/spirit/home/x3/operator/detail/alternative.hpp
@@ -226,7 +226,7 @@ namespace boost { namespace spirit { namespace x3 { namespace detail
struct move_if_not_alternative
{
template<typename T1, typename T2>
- static void call(T1& attr_, T2& attr) {}
+ static void call(T1& /* attr_ */, T2& /* attr */) {}
};
template <>
diff --git a/boost/spirit/home/x3/string/literal_string.hpp b/boost/spirit/home/x3/string/literal_string.hpp
index 5066fe18a9..486dc807b3 100644
--- a/boost/spirit/home/x3/string/literal_string.hpp
+++ b/boost/spirit/home/x3/string/literal_string.hpp
@@ -77,6 +77,7 @@ namespace boost { namespace spirit { namespace x3
}
}
+#ifndef BOOST_SPIRIT_NO_STANDARD_WIDE
namespace standard_wide
{
inline literal_string<wchar_t const*, char_encoding::standard_wide>
@@ -103,6 +104,7 @@ namespace boost { namespace spirit { namespace x3
return { s };
}
}
+#endif
namespace ascii
{
@@ -162,8 +164,10 @@ namespace boost { namespace spirit { namespace x3
using standard::string;
using standard::lit;
+#ifndef BOOST_SPIRIT_NO_STANDARD_WIDE
using standard_wide::string;
using standard_wide::lit;
+#endif
namespace extension
{
@@ -185,6 +189,7 @@ namespace boost { namespace spirit { namespace x3
template <int N>
struct as_parser<char const[N]> : as_parser<char[N]> {};
+#ifndef BOOST_SPIRIT_NO_STANDARD_WIDE
template <int N>
struct as_parser<wchar_t[N]>
{
@@ -202,6 +207,7 @@ namespace boost { namespace spirit { namespace x3
template <int N>
struct as_parser<wchar_t const[N]> : as_parser<wchar_t[N]> {};
+#endif
template <>
struct as_parser<char const*>
diff --git a/boost/spirit/home/x3/string/symbols.hpp b/boost/spirit/home/x3/string/symbols.hpp
index 1846c57bad..f9ba4cd392 100644
--- a/boost/spirit/home/x3/string/symbols.hpp
+++ b/boost/spirit/home/x3/string/symbols.hpp
@@ -343,11 +343,13 @@ namespace boost { namespace spirit { namespace x3
using standard::symbols;
+#ifndef BOOST_SPIRIT_NO_STANDARD_WIDE
namespace standard_wide
{
template <typename T = unused_type>
using symbols = symbols_parser<char_encoding::standard_wide, T>;
}
+#endif
namespace ascii
{
diff --git a/boost/spirit/home/x3/support/context.hpp b/boost/spirit/home/x3/support/context.hpp
index 592ce3ff76..9b24a3397c 100644
--- a/boost/spirit/home/x3/support/context.hpp
+++ b/boost/spirit/home/x3/support/context.hpp
@@ -74,12 +74,12 @@ namespace boost { namespace spirit { namespace x3
{
return { val };
}
-
+
namespace detail
{
template <typename ID, typename T, typename Next, typename FoundVal>
inline Next const&
- make_unique_context(T& val, Next const& next, FoundVal&)
+ make_unique_context(T& /* val */, Next const& next, FoundVal&)
{
return next;
}
@@ -91,7 +91,7 @@ namespace boost { namespace spirit { namespace x3
return { val, next };
}
}
-
+
template <typename ID, typename T, typename Next>
inline auto
make_unique_context(T& val, Next const& next)
diff --git a/boost/spirit/home/x3/support/traits/container_traits.hpp b/boost/spirit/home/x3/support/traits/container_traits.hpp
index b05764969c..7dcf798958 100644
--- a/boost/spirit/home/x3/support/traits/container_traits.hpp
+++ b/boost/spirit/home/x3/support/traits/container_traits.hpp
@@ -159,7 +159,7 @@ namespace boost { namespace spirit { namespace x3 { namespace traits
{
private:
template <typename Iterator>
- static void reserve(Container& c, Iterator first, Iterator last, mpl::false_)
+ static void reserve(Container& /* c */, Iterator /* first */, Iterator /* last */, mpl::false_)
{
// Not all containers have "reserve"
}
@@ -199,7 +199,7 @@ namespace boost { namespace spirit { namespace x3 { namespace traits
}
template <typename Iterator>
- inline bool append(unused_type, Iterator first, Iterator last)
+ inline bool append(unused_type, Iterator /* first */, Iterator /* last */)
{
return true;
}