[Bug 606] New: PeerParser and PropertyParser fail to compile using boost 1.37

For more infomation about this bug, visit
Summary: PeerParser and PropertyParser fail to compile using
boost 1.37
Product: RTT
Version: rtt-trunk
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: P3
Component: Scripting
AssignedTo: orocos-dev [..] ...
ReportedBy: ruben [dot] smits [..] ...
CC: orocos-dev [..] ...
Estimated Hours: 0.0

When compiling PeerParser i get the following error when i use boost 1.37:

/Users/rubensmits/Software/development/eclipse_workspace/rtt/Debug/src &&
/usr/bin/c++ -DRTT_DLL_EXPORT -g -fPIC
-I/Users/rubensmits/Software/development/eclipse_workspace/rtt/src
-I/Users/rubensmits/Software/development/eclipse_workspace/rtt/Debug/src
-I/Users/rubensmits/Software/development/eclipse_workspace/rtt/Debug/src/os
-I/Users/rubensmits/Software/development/eclipse_workspace/rtt/Debug/src/os/macosx
-Wall -I/opt/local/include -DOROCOS_TARGET=macosx -g1 -O2 -o
CMakeFiles/orocos-rtt-dynamic_macosx.dir/scripting/PeerParser.o -c
/Users/rubensmits/Software/development/eclipse_workspace/rtt/src/scripting/PeerParser.cpp
/opt/local/include/boost/iterator/iterator_adaptor.hpp: In function 'void
boost::detail::iterator_adaptor_assert_traversal() [with Tr1 =
boost::forward_traversal_tag, Tr2 = boost::random_access_traversal_tag]':
/opt/local/include/boost/iterator/iterator_adaptor.hpp:335: instantiated from
'void boost::iterator_adaptor Difference>::advance(typename boost::detail::iterator_adaptor_base Base, Value, Traversal, Reference, Difference>::type::difference_type) [with
Derived = boost::spirit::position_iterator boost::spirit::file_position_base, boost::spirit::nil_t>, Base =
RTT::our_iterator_t, Value = const char, Traversal =
boost::forward_traversal_tag, Reference = boost::use_default, Difference =
boost::use_default]'
/opt/local/include/boost/iterator/iterator_facade.hpp:546: instantiated from
'static void boost::iterator_core_access::advance(Facade&, typename
Facade::difference_type) [with Facade =
boost::spirit::position_iterator boost::spirit::file_position_base, boost::spirit::nil_t>]'
/opt/local/include/boost/iterator/iterator_facade.hpp:694: instantiated from
'Derived& boost::iterator_facade::operator+=(Difference) [with
Derived = boost::spirit::position_iterator boost::spirit::file_position_base, boost::spirit::nil_t>, Value =
const char, CategoryOrTraversal = boost::forward_traversal_tag, Reference =
const char&, Difference = ptrdiff_t]'
/Users/rubensmits/Software/development/eclipse_workspace/rtt/src/scripting/PeerParser.cpp:68:
instantiated from here
/opt/local/include/boost/iterator/iterator_adaptor.hpp:230: error: invalid
application of 'sizeof' to incomplete type
'boost::STATIC_ASSERTION_FAILURE'
"/Applications/CMake 2.6-2.app/Contents/bin/cmake" -E cmake_progress_report
/Users/rubensmits/Software/development/eclipse_workspace/rtt/Debug/CMakeFiles
[ 88%] Building CXX object
src/CMakeFiles/orocos-rtt-dynamic_macosx.dir/scripting/ProgramGraphParser.o
cd /Users/rubensmits/Software/development/eclipse_workspace/rtt/Debug/src &&
/usr/bin/c++ -DRTT_DLL_EXPORT -g -fPIC
-I/Users/rubensmits/Software/development/eclipse_workspace/rtt/src
-I/Users/rubensmits/Software/development/eclipse_workspace/rtt/Debug/src
-I/Users/rubensmits/Software/development/eclipse_workspace/rtt/Debug/src/os
-I/Users/rubensmits/Software/development/eclipse_workspace/rtt/Debug/src/os/macosx
-Wall -I/opt/local/include -DOROCOS_TARGET=macosx -g1 -O2 -o
CMakeFiles/orocos-rtt-dynamic_macosx.dir/scripting/ProgramGraphParser.o -c
/Users/rubensmits/Software/development/eclipse_workspace/rtt/src/scripting/ProgramGraphParser.cpp
make[2]: ***
[src/CMakeFiles/orocos-rtt-dynamic_macosx.dir/scripting/PeerParser.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [src/CMakeFiles/orocos-rtt-dynamic_macosx.dir/all] Error 2
make: *** [all] Error 2

When compiling the PropertyParser i get the following error:

/home/rsmits/orocos/boost_1_37_0/boost/iterator/iterator_adaptor.hpp: In
function ‘void boost::detail::iterator_adaptor_assert_traversal() [with Tr1 =
boost::forward_traversal_tag, Tr2 = boost::random_access_traversal_tag]’:
/home/rsmits/orocos/boost_1_37_0/boost/iterator/iterator_adaptor.hpp:335:
instantiated from ‘void boost::iterator_adaptor Traversal, Reference, Difference>::advance(typename
boost::detail::iterator_adaptor_base Reference, Difference>::type::difference_type) [with Derived =
boost::spirit::position_iterator<__gnu_cxx::__normal_iterator std::basic_string, std::allocator > >,
boost::spirit::file_position_base std::char_traits, std::allocator > >, boost::spirit::nil_t>, Base =
__gnu_cxx::__normal_iterator std::char_traits, std::allocator > >, Value = const char, Traversal
= boost::forward_traversal_tag, Reference = boost::use_default, Difference =
boost::use_default]’
/home/rsmits/orocos/boost_1_37_0/boost/iterator/iterator_facade.hpp:546:
instantiated from ‘static void boost::iterator_core_access::advance(Facade&,
typename Facade::difference_type) [with Facade =
boost::spirit::position_iterator<__gnu_cxx::__normal_iterator std::basic_string, std::allocator > >,
boost::spirit::file_position_base std::char_traits, std::allocator > >, boost::spirit::nil_t>]’
/home/rsmits/orocos/boost_1_37_0/boost/iterator/iterator_facade.hpp:694:
instantiated from ‘Derived& boost::iterator_facade D>::operator+=(Difference) [with Derived =
boost::spirit::position_iterator<__gnu_cxx::__normal_iterator std::basic_string, std::allocator > >,
boost::spirit::file_position_base std::char_traits, std::allocator > >, boost::spirit::nil_t>, Value
= const char, CategoryOrTraversal = boost::forward_traversal_tag, Reference =
const char&, Difference = long int]’
/home/rsmits/orocos/rtt/src/scripting/PropertyParser.cpp:70: instantiated
from here
/home/rsmits/orocos/boost_1_37_0/boost/iterator/iterator_adaptor.hpp:230:
error: invalid application of ‘sizeof’ to incomplete type
‘boost::STATIC_ASSERTION_FAILURE
/home/rsmits/orocos/boost_1_37_0/boost/iterator/iterator_adaptor.hpp:230:
error: invalid application of ‘sizeof’ to incomplete type
‘boost::STATIC_ASSERTION_FAILURE
make[2]: ***
[src/CMakeFiles/orocos-rtt-dynamic_gnulinux.dir/scripting/PropertyParser.o]
Error 1
make[1]: *** [src/CMakeFiles/orocos-rtt-dynamic_gnulinux.dir/all] Error 2
make: *** [all] Error 2

in both files the compilation fails on the line:

scan.first += advance_on_error;

there is something wrong with this addition, i have no idea what.

Ruben

[Bug 606] PeerParser and PropertyParser fail to compile using bo

For more infomation about this bug, visit <https://www.fmtc.be/bugzilla/orocos/show_bug.cgi?id=606>

Peter Soetens <peter [dot] soetens [..] ...> changed:

What |Removed |Added
--------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED

--- Comment #10 from Peter Soetens <peter [dot] soetens [..] ...> 2009-02-01 00:11:35 ---
Both patches applied and fixed on trunk in r29889.

[Bug 606] PeerParser and PropertyParser fail to compile using bo

For more infomation about this bug, visit <https://www.fmtc.be/bugzilla/orocos/show_bug.cgi?id=606>

--- Comment #9 from Peter Soetens <peter [dot] soetens [..] ...> 2009-01-29 22:41:12 ---
Correction, correct patch is:
&#10;diff --git a/src/scripting/PeerParser.cpp b/src/scripting/PeerParser.cpp&#10;index 0c9e801..2cca1ce 100644&#10;--- a/src/scripting/PeerParser.cpp&#10;+++ b/src/scripting/PeerParser.cpp&#10;@@ -65,7 +65,7 @@ namespace RTT&#10;     error_status&lt;&gt; handle_no_peer(scanner_t const&amp; scan,&#10;parser_error&lt;PeerErrors, iter_t&gt;&amp;e )&#10;     {&#10;         //std::cerr&lt;&lt;&quot;Returning accept, advance&#10;&quot;&lt;&lt;advance_on_error&lt;&lt;std::endl;&#10;-        scan.first += advance_on_error;&#10;+        //scan.first += advance_on_error;&#10;         int length = advance_on_error;&#10;         advance_on_error = 0;&#10;         // ok, got as far as possible, _peer contains the furthest we got.&#10;diff --git a/src/scripting/PropertyParser.cpp&#10;b/src/scripting/PropertyParser.cpp&#10;index a4c00af..c95fac8 100644&#10;--- a/src/scripting/PropertyParser.cpp&#10;+++ b/src/scripting/PropertyParser.cpp&#10;@@ -67,7 +67,7 @@ namespace RTT&#10;     {&#10;         //std::cerr&lt;&lt;&quot;Returning accept&quot;&lt;&lt;std::endl;&#10;         // ok, got as far as possible, _property contains the furthest we got.&#10;-        scan.first += advance_on_error;&#10;+        //scan.first += advance_on_error;&#10;         return error_status&lt;&gt;( error_status&lt;&gt;::accept, advance_on_error );&#10;     }&#10;&#10;

All unit tests pass.

[Bug 606] PeerParser and PropertyParser fail to compile using bo

For more infomation about this bug, visit <https://www.fmtc.be/bugzilla/orocos/show_bug.cgi?id=606>

--- Comment #8 from Peter Soetens <peter [dot] soetens [..] ...> 2009-01-29 22:37:37 ---
I just ran the unit tests with
&#10;diff --git a/src/scripting/PeerParser.cpp b/src/scripting/PeerParser.cpp&#10;index 0c9e801..2cca1ce 100644&#10;--- a/src/scripting/PeerParser.cpp&#10;+++ b/src/scripting/PeerParser.cpp&#10;@@ -65,7 +65,7 @@ namespace RTT&#10;     error_status&lt;&gt; handle_no_peer(scanner_t const&amp; scan,&#10;parser_error&lt;PeerErrors, iter_t&gt;&amp;e )&#10;     {&#10;         //std::cerr&lt;&lt;&quot;Returning accept, advance&#10;&quot;&lt;&lt;advance_on_error&lt;&lt;std::endl;&#10;-        scan.first += advance_on_error;&#10;+        //scan.first += advance_on_error;&#10;         int length = advance_on_error;&#10;         advance_on_error = 0;&#10;         // ok, got as far as possible, _peer contains the furthest we got.&#10;

and it passed all unit tests. It's possible that the removed line didn't
actually
have any impact on actual execution. Could the boost 1.37.0 people confirm
that removing this line fixes the complete issue ?

Peter

[Bug 606] PeerParser and PropertyParser fail to compile using bo

On Jan 29, 2009, at 16:37 , Peter Soetens wrote:

> For more infomation about this bug, visit <https://www.fmtc.be/bugzilla/orocos/show_bug.cgi?id=606
> >
>
>
>
> --- Comment #8 from Peter Soetens <peter [dot] soetens [..] ...>
> 2009-01-29 22:37:37 ---
> I just ran the unit tests with
> &#10;&gt; diff --git a/src/scripting/PeerParser.cpp b/src/scripting/ &#10;&gt; PeerParser.cpp&#10;&gt; index 0c9e801..2cca1ce 100644&#10;&gt; --- a/src/scripting/PeerParser.cpp&#10;&gt; +++ b/src/scripting/PeerParser.cpp&#10;&gt; @@ -65,7 +65,7 @@ namespace RTT&#10;&gt;     error_status&lt;&gt; handle_no_peer(scanner_t const&amp; scan,&#10;&gt; parser_error&lt;PeerErrors, iter_t&gt;&amp;e )&#10;&gt;     {&#10;&gt;         //std::cerr&lt;&lt;&quot;Returning accept, advance&#10;&gt; &quot;&lt;&lt;advance_on_error&lt;&lt;std::endl;&#10;&gt; -        scan.first += advance_on_error;&#10;&gt; +        //scan.first += advance_on_error;&#10;&gt;         int length = advance_on_error;&#10;&gt;         advance_on_error = 0;&#10;&gt;         // ok, got as far as possible, _peer contains the furthest  &#10;&gt; we got.&#10;&gt;
>
> and it passed all unit tests. It's possible that the removed line
> didn't
> actually
> have any impact on actual execution. Could the boost 1.37.0 people
> confirm
> that removing this line fixes the complete issue ?

Confirm that everything compiles and that all tests pass under boost
v1.37.0.
S

[Bug 606] PeerParser and PropertyParser fail to compile using bo

For more infomation about this bug, visit <https://www.fmtc.be/bugzilla/orocos/show_bug.cgi?id=606>

S Roderick <kiwi [dot] net [..] ...> changed:

What |Removed |Added
--------------------------------------------------------------------------
Attachment #359 is|0 |1
obsolete| |

--- Comment #7 from S Roderick <kiwi [dot] net [..] ...> 2009-01-21 19:10:32 ---
Created an attachment (id=370)
--> (https://www.fmtc.be/bugzilla/orocos/attachment.cgi?id=370)
Use base() to difference iterators

Changes iterator difference type, and fixes differencing operations.

[Bug 606] PeerParser and PropertyParser fail to compile using bo

For more infomation about this bug, visit <https://www.fmtc.be/bugzilla/orocos/show_bug.cgi?id=606>

--- Comment #6 from Peter Soetens <peter [dot] soetens [..] ...> 2009-01-21 18:03:04 ---
(In reply to comment #5)
> From the boost developers ... are we safe to use the `base` method as he
> advises?
>

Yes we are. The iterators are 'cleanly' constructed and point to the same
buffer. So we'd get
advance_on_error += end.base() - begin.base();

Peter

[Bug 606] PeerParser and PropertyParser fail to compile using bo

On Jan 21, 2009, at 12:03 , Peter Soetens wrote:

> For more infomation about this bug, visit <https://www.fmtc.be/bugzilla/orocos/show_bug.cgi?id=606
> >
>
> --- Comment #6 from Peter Soetens <peter [dot] soetens [..] ...>
> 2009-01-21 18:03:04 ---
> (In reply to comment #5)
>> From the boost developers ... are we safe to use the `base` method
>> as he
>> advises?
>>
>
> Yes we are. The iterators are 'cleanly' constructed and point to the
> same
> buffer. So we'd get
> advance_on_error += end.base() - begin.base();

Does indeed fix most issues, but I still can't get this one to go away
(scan.first += ...). It's a const issue ... I'll keep trying ...

error_status<> handle_no_property(scanner_t const& scan,
parser_error<PropertyErrors, iter_t>&e )
{
//std::cerr<<"Returning accept"<<std::endl;
// ok, got as far as possible, _property contains the
furthest we got.
scan.first += advance_on_error;
return error_status<>( error_status<>::accept,
advance_on_error );
}

[Bug 606] PeerParser and PropertyParser fail to compile using bo

On Jan 21, 2009, at 12:26 , S Roderick wrote:

> On Jan 21, 2009, at 12:03 , Peter Soetens wrote:
>
>> For more infomation about this bug, visit <https://www.fmtc.be/bugzilla/orocos/show_bug.cgi?id=606
>> >
>>
>> --- Comment #6 from Peter Soetens <peter [dot] soetens [..] ...>
>> 2009-01-21 18:03:04 ---
>> (In reply to comment #5)
>>> From the boost developers ... are we safe to use the `base` method
>>> as he
>>> advises?
>>>
>>
>> Yes we are. The iterators are 'cleanly' constructed and point to
>> the same
>> buffer. So we'd get
>> advance_on_error += end.base() - begin.base();
>
> Does indeed fix most issues, but I still can't get this one to go
> away (scan.first += ...). It's a const issue ... I'll keep trying ...
>
>
> error_status<> handle_no_property(scanner_t const& scan,
> parser_error<PropertyErrors, iter_t>&e )
> {
> //std::cerr<<"Returning accept"<<std::endl;
> // ok, got as far as possible, _property contains the
> furthest we got.
> scan.first += advance_on_error;
> return error_status<>( error_status<>::accept,
> advance_on_error );
> }

I'm not sure we can fix the last bug. There appears to be no public
method to advance a `spirit::position_iterator`, neither directly nor
through it's `base()` style functions. We would need
`position_iterator::increment()` or
`position_iterator::base_reference()` to be public: the first is
private in the immediate class, and the second is protected in a
parent class (`iterator_adaptor`).

It appears to me that the `scan.first += advance` code is only to aid
in error recovery? If so, and if my analysis is correct and hence this
will continue to be illegal in the future, can we just turn it off for
now? (or with boost v1.37 builds?)

S

[Bug 606] PeerParser and PropertyParser fail to compile using bo

On Wednesday 21 January 2009 19:05:50 S Roderick wrote:
> On Jan 21, 2009, at 12:26 , S Roderick wrote:
> > error_status<> handle_no_property(scanner_t const& scan,
> > parser_error<PropertyErrors, iter_t>&e )
> > {
> > //std::cerr<<"Returning accept"<<std::endl;
> > // ok, got as far as possible, _property contains the
> > furthest we got.
> > scan.first += advance_on_error;
> > return error_status<>( error_status<>::accept,
> > advance_on_error );
> > }
>
> I'm not sure we can fix the last bug. There appears to be no public
> method to advance a `spirit::position_iterator`, neither directly nor
> through it's `base()` style functions. We would need
> `position_iterator::increment()` or
> `position_iterator::base_reference()` to be public: the first is
> private in the immediate class, and the second is protected in a
> parent class (`iterator_adaptor`).

I'll take a look at it. A position iterator you can't increment looks
completely meaningless to me. Although it could be that the iterator_adaptor
is playing with us...

>
> It appears to me that the `scan.first += advance` code is only to aid
> in error recovery? If so, and if my analysis is correct and hence this
> will continue to be illegal in the future, can we just turn it off for
> now? (or with boost v1.37 builds?)

The code is fragile. I wouldn't dare to touch it, especially since it modifies
the scanner. Some parsers rely on the fact that some sub-parsers fail in a
particular way and leave the scanner in a particular state.

Peter

[Bug 606] PeerParser and PropertyParser fail to compile using bo

For more infomation about this bug, visit <https://www.fmtc.be/bugzilla/orocos/show_bug.cgi?id=606>

--- Comment #5 from S Roderick <kiwi [dot] net [..] ...> 2009-01-21 16:48:00 ---
>From the boost developers ... are we safe to use the `base` method as he
advises?

#2669: Boost 1.37 breaks spirit iterator differencing
--------------------------------------------+-------------------------------
Reporter: S Roderick <kiwi [dot] net [..] ...> | Owner: djowel
Type: Bugs | Status: new
Milestone: Boost 1.38.0 | Component: spirit
Version: Boost 1.37.0 | Severity: Problem
Resolution: | Keywords:
--------------------------------------------+-------------------------------

Comment(by danieljames):

`position_iterator` was always meant to be a forward iterator and only had
a difference operator by mistake, which didn't work in many cases (I've
just attached an example which gives an incorrect result with boost 1.35,
operator- also gives incorrect results if the string contains windows
newlines). There are two possible fixes: the safe, but slow way, is to use
std::difference, or if you're sure that both iterators contain a valid
iterator (they haven't been default constructed, and have been constructed
with an iterator from the same container) then you can access the
underlying iterator using the `base` method - `end.base() - begin.base()`.

[Bug 606] PeerParser and PropertyParser fail to compile using bo

For more infomation about this bug, visit <https://www.fmtc.be/bugzilla/orocos/show_bug.cgi?id=606>

--- Comment #4 from S Roderick <kiwi [dot] net [..] ...> 2009-01-21 16:07:33 ---
I submitted a bug report to boost.

https://svn.boost.org/trac/boost/ticket/2669

[Bug 606] PeerParser and PropertyParser fail to compile using bo

For more infomation about this bug, visit <https://www.fmtc.be/bugzilla/orocos/show_bug.cgi?id=606>

S Roderick <kiwi [dot] net [..] ...> changed:

What |Removed |Added
--------------------------------------------------------------------------
CC| |kiwi [dot] net [..] ...

--- Comment #3 from S Roderick <kiwi [dot] net [..] ...> 2009-01-20 23:13:51 ---
The above patch doesn't work for boost 1.37 (Macports v1.7) with gcc 4.0.1
(Apple).

I looked at it ... and now my head really hurts. :-( Did anyone ever come to a
resolution on this?

Thanks
S

Ruben Smits's picture

[Bug 606] PeerParser and PropertyParser fail to compile using bo

For more infomation about this bug, visit

--- Comment #2 from Ruben Smits <ruben [dot] smits [..] ...> 2008-12-17 16:41:12 ---
I still get the same error (but because there are so many templates i'll print
the new one here, just to make sure i didn't miss anything):

opt/local/include/boost/iterator/iterator_adaptor.hpp: In function 'void
boost::detail::iterator_adaptor_assert_traversal() [with Tr1 =
boost::forward_traversal_tag, Tr2 = boost::random_access_traversal_tag]':
/opt/local/include/boost/iterator/iterator_adaptor.hpp:335: instantiated from
'void boost::iterator_adaptor Difference>::advance(typename boost::detail::iterator_adaptor_base Base, Value, Traversal, Reference, Difference>::type::difference_type) [with
Derived = boost::spirit::position_iterator boost::spirit::file_position_base, boost::spirit::nil_t>, Base =
RTT::our_iterator_t, Value = const char, Traversal =
boost::forward_traversal_tag, Reference = boost::use_default, Difference =
boost::use_default]'
/opt/local/include/boost/iterator/iterator_facade.hpp:546: instantiated from
'static void boost::iterator_core_access::advance(Facade&, typename
Facade::difference_type) [with Facade =
boost::spirit::position_iterator boost::spirit::file_position_base, boost::spirit::nil_t>]'
/opt/local/include/boost/iterator/iterator_facade.hpp:694: instantiated from
'Derived& boost::iterator_facade::operator+=(Difference) [with
Derived = boost::spirit::position_iterator boost::spirit::file_position_base, boost::spirit::nil_t>, Value =
const char, CategoryOrTraversal = boost::forward_traversal_tag, Reference =
const char&, Difference = ptrdiff_t]'
/Users/rubensmits/Software/development/eclipse_workspace/rtt/src/scripting/PeerParser.cpp:70:
instantiated from here
/opt/local/include/boost/iterator/iterator_adaptor.hpp:230: error: invalid
application of 'sizeof' to incomplete type
'boost::STATIC_ASSERTION_FAILURE'
make[2]: ***
[src/CMakeFiles/orocos-rtt-dynamic_macosx.dir/scripting/PeerParser.o] Error 1
make[1]: *** [src/CMakeFiles/orocos-rtt-dynamic_macosx.dir/all] Error 2
make: *** [all] Error 2

Ruben

[Bug 606] PeerParser and PropertyParser fail to compile using bo

For more infomation about this bug, visit

Peter Soetens

<peter [dot] soetens [..] ...> changed:

What |Removed |Added
--------------------------------------------------------------------------
Status|NEW |ASSIGNED
AssignedTo|orocos- |peter [dot] soetens [..] ...
|dev [..] ... |

--- Comment #1 from Peter Soetens

<peter [dot] soetens [..] ...> 2008-12-17 16:27:49 ---
Created an attachment (id=359)
--> (https://www.fmtc.be/bugzilla/orocos/attachment.cgi?id=359)
Replaces ptrdiff with a boost iterator type

Could you try the attached patch ? I don't have boost 1.37.0 to test this,
but it works on older versions :-)