Re: Horrible compiletimes and memory usage while compiling a parser with X3
Larry Evans <[email protected]>
| Newsgroups | gmane.comp.parsers.spirit.general |
|---|---|
| Message-ID | <[email protected]> |
On 11/13/2016 07:50 AM, Larry Evans wrote: > On 11/07/2016 02:44 AM, Peter Gerell wrote: >> On 07/11/2016 12:38 PM , Joel de Guzman wrote: >>> On 07/11/2016 1:26 AM, Mikael Asplund wrote: >>>> This is the reason we're still on 1.60 (with a small >>>> const-patch from 1.61), since later version have link problems which are just too hard >>>> to debug. >> >>> It would be great if you post a test file that exhibits this problem you mention. >>> This linking problem doesn't look good and must be fixed. >> >> Hi Joel. >> This is the problem Mikael is referring to. >> http://melpon.org/wandbox/permlink/X8Awj4wIZ2JqMWIw >> >> If KEEP_CHAR is defined the code builds with both boost 1.60 and 1.61. >> Without KEEP_CHAR it fails with 1.61. >> >> The following commit introduced the problem. >> https://github.com/boostorg/spirit/commit/a8e391bd99dddb3f9ece84bdb1bb9236b0a37cf7 >> >> The problem seems to be that the attribute types are short-circuited for sequences of one >> even though we explicitly request a specific binding using FUSION_DEFINE_FOR_STRUCT(ast::Start, count); > [snip] > > More specifically, the change on line 178 causes the > problem. That change caused r_pass on line 303 to be > derived from pass_through_sequence_attribute instead of > pass_sequence_attribute_front, as was the case with > boost_1_60_0. That change, in turn, caused r_attr on line > 303 to just copy attr, which was type ast::Start, instead of > the type type of the boost_1_60_0 r_attr which was type > ast::Count. > > Since parser.right has type: > > rule<count_class, ast::Count, false> > > the call on line 312 of detail/sequence.hpp: > > && parser.right.parse(first, last, context, rcontext, > r_attr)) > > will, ultimately, cause parse_rule to be called with the > wrong r_attr(the one with type ast::Start instead of > ast::Count), and, since the expression.cpp only has: > > BOOST_SPIRIT_INSTANTIATE(count_type, iterator_type, > x3::unused_type); > > which only instantiates (according to the definition of that > macro in rule.hpp:173) the parse_rule specializaton for > attr=ast::Count, the link error happens. > > Why not revert the change on detail/sequence.hpp:178 to > solve the problem? > > -regards, > Larry Otherwise, as a workaround, one could simply add to the specialization produced by BOOST_SPIRIT_INSTANTIATE, ans done in the attached. ------------------------------------------------------------------------------ Developer Access Program for Intel Xeon Phi Processors Access to Intel Xeon Phi processor-based developer platforms. With one year of Intel Parallel Studio XE. Training and support from Colfax. Order your platform today. http://sdm.link/xeonphi _______________________________________________ Spirit-general mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/spirit-general
expression.cpp
(text/x-c++src, 568 B)
// The adapted include must be among the first (before any file that may include ast.hpp)
#include "ast_adapted.hpp"
#include "expression_def.hpp"
BOOST_SPIRIT_INSTANTIATE(count_type, iterator_type, x3::unused_type);
#if 1
//Workaround the link problem:
template bool parse_rule<iterator_type, x3::unused_type, ast::Start>(
count_type rule_
, iterator_type& first, iterator_type const& last
, x3::unused_type const& context, ast::Start& attr);
#endif