move BOOST_SPIRIT_DEFINE into separate headers + use across all grammar defs (#3573)

This commit is contained in:
artemp 2016-12-14 16:35:24 +01:00
parent 8327905aba
commit 81cfa721db
17 changed files with 66 additions and 31 deletions

View file

@ -28,7 +28,7 @@
#include <mapnik/css_color_grammar_x3.hpp>
#include <mapnik/util/hsl.hpp>
#include <mapnik/safe_cast.hpp>
#include <mapnik/util/windows_c2995.hpp>
#pragma GCC diagnostic push
#include <mapnik/warning_ignore.hpp>
#include <boost/spirit/home/x3.hpp>

View file

@ -20,6 +20,7 @@
*
*****************************************************************************/
#include <mapnik/util/windows_c2995.hpp>
#pragma GCC diagnostic push
#include <mapnik/warning_ignore.hpp>
#include <mapnik/csv/csv_grammar_x3.hpp>

View file

@ -23,6 +23,7 @@
#ifndef MAPNIK_EXPRESSIONS_GRAMMAR_X3_DEF_HPP
#define MAPNIK_EXPRESSIONS_GRAMMAR_X3_DEF_HPP
#include <mapnik/util/windows_c2995.hpp>
#include <mapnik/expression_grammar_x3.hpp>
#include <mapnik/expression_node.hpp>
#include <mapnik/function_call.hpp>

View file

@ -23,10 +23,10 @@
#ifndef MAPNIK_IMAGE_FILTER_GRAMMAR_X3_DEF_HPP
#define MAPNIK_IMAGE_FILTER_GRAMMAR_X3_DEF_HPP
#include <mapnik/image_filter_grammar_x3.hpp>
#include <mapnik/image_filter_types.hpp>
#include <mapnik/css_color_grammar_x3.hpp>
#include <mapnik/util/windows_c2995.hpp>
#pragma GCC diagnostic push
#include <mapnik/warning_ignore.hpp>

View file

@ -32,6 +32,7 @@
#include <mapnik/json/create_geometry.hpp>
#include <mapnik/util/conversions.hpp>
#include <mapnik/util/windows_c2995.hpp>
#include <mapnik/value.hpp>
#include <mapnik/geometry/geometry_types.hpp>

View file

@ -26,6 +26,7 @@
#include <boost/fusion/include/std_pair.hpp>
#include <mapnik/json/generic_json_grammar_x3.hpp>
#include <mapnik/json/unicode_string_grammar_x3.hpp>
#include <mapnik/util/windows_c2995.hpp>
namespace mapnik { namespace json { namespace grammar {

View file

@ -27,6 +27,7 @@
#include <mapnik/json/geojson_grammar_x3.hpp>
#include <mapnik/json/unicode_string_grammar_x3.hpp>
#include <mapnik/json/positions_grammar_x3.hpp>
#include <mapnik/util/windows_c2995.hpp>
#include <boost/fusion/include/std_pair.hpp>
namespace mapnik { namespace json { namespace grammar {

View file

@ -129,33 +129,6 @@ using feature_context_const_type = x3::with_context<feature_tag,
, Context const& context, boost::spirit::x3::unused_type const& ); \
/***/
#ifdef _WINDOWS
// VC++ C2995 fix
#undef BOOST_SPIRIT_DEFINE_
#undef BOOST_SPIRIT_DEFINE
#define BOOST_SPIRIT_DEFINE_(r, data, rule_name) \
using BOOST_PP_CAT(rule_name, _synonym) = decltype(rule_name); \
template <typename Iterator, typename Context, typename Attribute> \
inline bool parse_rule( \
BOOST_PP_CAT(rule_name, _synonym) rule_ \
, Iterator& first, Iterator const& last \
, Context const& context, Attribute& attr) \
{ \
using boost::spirit::x3::unused; \
static auto const def_ = (rule_name = BOOST_PP_CAT(rule_name, _def)); \
return def_.parse(first, last, context, unused, attr); \
} \
/***/
#define BOOST_SPIRIT_DEFINE(...) BOOST_PP_SEQ_FOR_EACH( \
BOOST_SPIRIT_DEFINE_, _, BOOST_PP_VARIADIC_TO_SEQ(__VA_ARGS__)) \
/***/
#endif
}}}
#endif // MAPNIK_JSON_GRAMMAR_CONFIG_HPP

View file

@ -25,6 +25,7 @@
#include <mapnik/json/positions_grammar_x3.hpp>
#include <mapnik/geometry/fusion_adapted.hpp>
#include <mapnik/util/windows_c2995.hpp>
namespace mapnik { namespace json { namespace grammar {

View file

@ -24,6 +24,7 @@
#define MAPNIK_JSON_UNICODE_STRING_GRAMMAR_X3_DEF_HPP
#include <mapnik/json/unicode_string_grammar_x3.hpp>
#include <mapnik/util/windows_c2995.hpp>
#include <iostream>
namespace mapnik { namespace json { namespace grammar {

View file

@ -25,6 +25,7 @@
// mapnik
#include <mapnik/path_expression_grammar_x3.hpp>
#include <mapnik/attribute.hpp>
#include <mapnik/util/windows_c2995.hpp>
namespace mapnik { namespace grammar {

View file

@ -26,6 +26,7 @@
#include <mapnik/transform_expression.hpp>
#include <mapnik/transform_expression_grammar_x3.hpp>
#include <mapnik/expression_grammar_x3.hpp>
#include <mapnik/util/windows_c2995.hpp>
#pragma GCC diagnostic push
#include <mapnik/warning_ignore.hpp>

View file

@ -0,0 +1,51 @@
/*****************************************************************************
*
* This file is part of Mapnik (c++ mapping toolkit)
*
* Copyright (C) 2016 Artem Pavlenko
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*****************************************************************************/
#ifndef MAPNIK_UTIL_WINDOWS_C2995_HPP
#define MAPNIK_UTIL_WINDOWS_C2995_HPP
#ifdef _WINDOWS
// VC++ C2995 fix
#undef BOOST_SPIRIT_DEFINE_
#undef BOOST_SPIRIT_DEFINE
#define BOOST_SPIRIT_DEFINE_(r, data, rule_name) \
using BOOST_PP_CAT(rule_name, _synonym) = decltype(rule_name); \
template <typename Iterator, typename Context, typename Attribute> \
inline bool parse_rule( \
BOOST_PP_CAT(rule_name, _synonym) rule_ \
, Iterator& first, Iterator const& last \
, Context const& context, Attribute& attr) \
{ \
using boost::spirit::x3::unused; \
static auto const def_ = (rule_name = BOOST_PP_CAT(rule_name, _def)); \
return def_.parse(first, last, context, unused, attr); \
} \
/***/
#define BOOST_SPIRIT_DEFINE(...) BOOST_PP_SEQ_FOR_EACH( \
BOOST_SPIRIT_DEFINE_, _, BOOST_PP_VARIADIC_TO_SEQ(__VA_ARGS__)) \
/***/
#endif
#endif //MAPNIK_UTIL_WINDOWS_C2995_HPP

View file

@ -25,7 +25,7 @@
#include <mapnik/wkt/wkt_grammar_x3.hpp>
#include <mapnik/geometry/fusion_adapted.hpp>
#include <mapnik/util/windows_c2995.hpp>
#ifdef __GNUC__
// instantiate `is_substitute` for reference T and reference Attribute
// fixes gcc6 compilation issue

View file

@ -21,7 +21,7 @@
*****************************************************************************/
#include <mapnik/image_options.hpp>
#include <mapnik/util/windows_c2995.hpp>
#pragma GCC diagnostic push
#include <mapnik/warning_ignore.hpp>
#include <boost/spirit/home/x3.hpp>

View file

@ -27,6 +27,7 @@
#include <mapnik/json/geojson_grammar_x3.hpp>
#include <mapnik/json/unicode_string_grammar_x3.hpp>
#include <mapnik/json/positions_grammar_x3.hpp>
#include <mapnik/util/windows_c2995.hpp>
namespace mapnik { namespace json {

View file

@ -31,6 +31,7 @@
#include <mapnik/util/utf_conv_win.hpp>
#include <mapnik/util/dasharray_parser.hpp>
#include <mapnik/json/json_grammar_config.hpp>
#include <mapnik/util/windows_c2995.hpp>
#pragma GCC diagnostic push
#include <mapnik/warning_ignore_agg.hpp>
#include "agg_ellipse.h"