Enforce global variables initialisation order via __attribute__((init_priority(<priority>))) (#3821)

This commit is contained in:
Artem Pavlenko 2018-01-04 12:22:04 +00:00
parent a67f5abb67
commit 50169e95b2
5 changed files with 7 additions and 7 deletions

View file

@ -73,7 +73,7 @@ namespace { auto const& json_string = mapnik::json::unicode_string_grammar(); }
// exported rules
// start
generic_json_grammar_type const value("JSON Value");
generic_json_grammar_type const value __attribute__((init_priority(102))) ("JSON Value");
generic_json_key_value_type const key_value("JSON Object element");
// rules
x3::rule<class json_object_tag, json_object> const object("JSON Object");

View file

@ -89,8 +89,8 @@ struct geometry_type_ : x3::symbols<mapnik::geometry::geometry_types>
// exported rules
// start
geojson_grammar_type const value("JSON Value");
key_value_type const key_value("JSON key/value");
geojson_grammar_type const value __attribute__((init_priority(106))) ("JSON Value");
key_value_type const key_value __attribute__((init_priority(107))) ("JSON key/value");
// rules
x3::rule<class json_object_tag, geojson_object> const object("JSON Object");
x3::rule<class json_array_tag, geojson_array> const array("JSON Array");

View file

@ -42,7 +42,7 @@ auto assign_helper = [](auto const& ctx)
} // anonymous ns
// start rule
positions_grammar_type const positions("Positions");
positions_grammar_type const positions __attribute__((init_priority(103))) ("Positions");
// rules
x3::rule<class point_class, point> const point("Position");
x3::rule<class ring_class, ring> const ring("Ring");

View file

@ -304,7 +304,7 @@ struct topojson_geometry_type_ : x3::symbols<int>
} topojson_geometry_type;
// start rule
topojson_grammar_type const topology = "Topology";
topojson_grammar_type const topology __attribute__((init_priority(104))) ("Topology");
// rules
x3::rule<class transform_tag, mapnik::topojson::transform> const transform = "Transform";
x3::rule<class bbox_tag, mapnik::topojson::bounding_box> const bbox = "Bounding Box";
@ -373,7 +373,7 @@ auto const geometry_tuple_def =
|
properties[assign_properties]
|
(omit[json_string] > lit(':') > omit[json_value])) % lit(',')
omit[json_string] > lit(':') > omit[json_value]) % lit(',')
;
auto const geometry_def = lit("{") > geometry_tuple[create_geometry] > lit("}");

View file

@ -109,7 +109,7 @@ x3::uint_parser<std::uint16_t, 16, 4, 4> const hex4 {};
x3::uint_parser<uchar, 16, 8, 8> const hex8 {};
// start rule
unicode_string_grammar_type const unicode_string("Unicode String");
unicode_string_grammar_type const unicode_string __attribute__((init_priority(101))) ("Unicode String");
// rules
x3::rule<class double_quoted_tag, std::string> const double_quoted("Double-quoted string");
x3::rule<class escaped_tag, std::string> const escaped("Escaped Character");