[iterator, test] Patches for PA_RISC HP-UX 11.11 compatibility

[I am repeating this post as no one replied to it and I guess it could have gotten overlooked in the original thread.] Hi. I'm attaching two patches - one for the Boost test and one for the Boost iterator library to make them compatible with HP-UX PA_RISC 11.11 system headers. These headers define global preprocessor macros R1, R2, ... so the patches rename similarly named identifiers in Boost code. Patches have been prepared based on SVN revision 41987. They are simple local variable and template parameter renames which should not cause any problems. New names are a bit more verbose to eliminate possible conflicts with headers on other system. Could someone please apply them? And could they be applied to the 1.35 branch as well? These patches in additional to two slight tweaks inside Boost ASIO will allow Boost ASIO to compile and pass all tests on this platform. Hope this helps. Best regards, Jurko Gospodnetić --- C:\Documents and Settings\Jurko\Desktop\SVN_41987\boost\iterator\iterator_facade.hpp 2007-12-12 11:50:30.000000000 +-0100 +++ C:\Documents and Settings\Jurko\Desktop\Modified\boost\iterator\iterator_facade.hpp 2007-12-12 12:13:51.000000000 +-0100 @@ -428,34 +428,34 @@ }; } // namespace detail // Macros which describe the declarations of binary operators # ifdef BOOST_NO_STRICT_ITERATOR_INTEROPERABILITY -# define BOOST_ITERATOR_FACADE_INTEROP_HEAD(prefix, op, result_type) \ - template < \ - class Derived1, class V1, class TC1, class R1, class D1 \ - , class Derived2, class V2, class TC2, class R2, class D2 \ - > \ - prefix typename mpl::apply2<result_type,Derived1,Derived2>::type \ - operator op( \ - iterator_facade<Derived1, V1, TC1, R1, D1> const& lhs \ - , iterator_facade<Derived2, V2, TC2, R2, D2> const& rhs) +# define BOOST_ITERATOR_FACADE_INTEROP_HEAD(prefix, op, result_type) \ + template < \ + class Derived1, class V1, class TC1, class Reference1, class Difference1 \ + , class Derived2, class V2, class TC2, class Reference2, class Difference2 \ + > \ + prefix typename mpl::apply2<result_type,Derived1,Derived2>::type \ + operator op( \ + iterator_facade<Derived1, V1, TC1, Reference1, Difference1> const& lhs \ + , iterator_facade<Derived2, V2, TC2, Reference2, Difference2> const& rhs) # else -# define BOOST_ITERATOR_FACADE_INTEROP_HEAD(prefix, op, result_type) \ - template < \ - class Derived1, class V1, class TC1, class R1, class D1 \ - , class Derived2, class V2, class TC2, class R2, class D2 \ - > \ - prefix typename boost::detail::enable_if_interoperable< \ - Derived1, Derived2 \ - , typename mpl::apply2<result_type,Derived1,Derived2>::type \ - >::type \ - operator op( \ - iterator_facade<Derived1, V1, TC1, R1, D1> const& lhs \ - , iterator_facade<Derived2, V2, TC2, R2, D2> const& rhs) +# define BOOST_ITERATOR_FACADE_INTEROP_HEAD(prefix, op, result_type) \ + template < \ + class Derived1, class V1, class TC1, class Reference1, class Difference1 \ + , class Derived2, class V2, class TC2, class Reference2, class Difference2 \ + > \ + prefix typename boost::detail::enable_if_interoperable< \ + Derived1, Derived2 \ + , typename mpl::apply2<result_type,Derived1,Derived2>::type \ + >::type \ + operator op( \ + iterator_facade<Derived1, V1, TC1, Reference1, Difference1> const& lhs \ + , iterator_facade<Derived2, V2, TC2, Reference2, Difference2> const& rhs) # endif # define BOOST_ITERATOR_FACADE_PLUS_HEAD(prefix,args) \ template <class Derived, class V, class TC, class R, class D> \ prefix Derived operator+ args --- C:\Documents and Settings\Jurko\Desktop\SVN_41987\boost\test\test_tools.hpp 2007-12-12 11:49:19.000000000 +-0100 +++ C:\Documents and Settings\Jurko\Desktop\Modified\boost\test\test_tools.hpp 2007-12-12 12:27:50.000000000 +-0100 @@ -643,24 +643,24 @@ //____________________________________________________________________________// template <class Left, class Right> inline predicate_result bitwise_equal_impl( Left const& left, Right const& right ) { - predicate_result res( true ); + predicate_result res( true ); std::size_t left_bit_size = sizeof(Left)*CHAR_BIT; std::size_t right_bit_size = sizeof(Right)*CHAR_BIT; - static Left const L1( 1 ); - static Right const R1( 1 ); + static Left const leftOne ( 1 ); + static Right const rightOne( 1 ); std::size_t total_bits = left_bit_size < right_bit_size ? left_bit_size : right_bit_size; for( std::size_t counter = 0; counter < total_bits; ++counter ) { - if( ( left & ( L1 << counter ) ) != ( right & ( R1 << counter ) ) ) { + if( ( left & ( leftOne << counter ) ) != ( right & ( rightOne << counter ) ) ) { res = false; res.message() << "\nMismatch in a position " << counter; } } if( left_bit_size != right_bit_size ) {

Jurko Gospodnetic wrote:
Actually, I've replied right away -- search <http://lists.boost.org/Archives/boost/2007/12/subject.php> for "pa-risc" (lowercase). And today Beman Dawes replied, but his reply does not show up in the archive yet. I'll apply patches to the trunk later today or tomorrow. If they don't cause any regression, I'll merge them to release branch. Btw, what compiler are you using? Thanks, Boris

Hi Boris.
Hmmm... I see it there but it seems my Thunderbird does not display it on gmane.comp.lib.boost.devel. :-((( Strange... every other post is there... Thank you and sorry for bothering...
Btw, what compiler are you using?
Tried it with GCC 4.2.1 and GCC 4.2.2. Both worked fine. Thank you again for replying. Best regards, Jurko Gospodnetić

Gennadiy Rozental wrote:
You can go ahead. No need to hide it under ifdef either.
Just to be sure I understand it correctly: even though the fix is safe, I was going to conditionalize it with '#ifdef __hpux'. Are you saying that there is no need for this conditionalization? (just replacing existing code would be fine with me) Thanks, Boris

Hi Boris.
Applied patches to trunk: iterator/iterator_facade.hpp - changeset/42064
Hmmm... I do not think this got applied correctly as the the current revision 42117 (see http://svn.boost.org/svn/boost/trunk/boost/iterator/) does not contain this patch and still uses R1 identifiers for template parameters. Best regards, Jurko Gospodnetić

Hi Jurko, as you can see from the attached, trunk HEAD does have the patch: bash-3.00$ svn co -r HEAD http://svn.boost.org/svn/boost/trunk/boost/iterator/ A iterator/interoperable.hpp ... A iterator/iterator_concepts.hpp Checked out revision 42118. bash-3.00$ grep R1 iterator/*.hpp bash-3.00$ And, accordingly, http://svn.boost.org/svn/boost/trunk/boost/iterator/iterator_facade.hpp does not have any R1. I'm not sure why you think the patch has not been applied. If you mean release branch, then, yes: I have not merged those fixes to release branch yet: I was waiting to see if they are causing any regression on the trunk. Thanks, Boris ----- Original Message ----- From: "Jurko Gospodnetić" <jurko.gospodnetic@docte.hr> To: <boost@lists.boost.org> Sent: Monday, December 17, 2007 6:32 AM Subject: Re: [boost] [iterator,test] Patches for PA_RISC HP-UX 11.11 compatibility

Jurko Gospodnetić <jurko.gospodnetic <at> docte.hr> writes:
[I am repeating this post as no one replied to it and I guess it could have gotten overlooked in the original thread.]
Sorry, for the delay. I did see your patch and I am not sure I understand it. How removing somespaces and some variable name change helps this compiler?
- predicate_result res( true ); + predicate_result res( true );
Gennadiy

On Dec 13, 2007 5:15 PM, Gennadiy Rozental <rogeeff@gmail.com> wrote:
I would assume that the whitespace update was extraneous and not meaningful. I would also assume that L1 is one of those macros defined by the system's header files. The OP already said that R1 is a macro, so obviously naming a function as such would be a compiler error. Jason

Hi. Thank you for the reply.
That change is not strictly needed but only seemed the right cosmetic 'thing to do' a few lines above. And since it was 'only whitespace' we did not remove it.
HP-UX pa-risc 11.11 system headers define a macro R1 to mean 1 so local variables named R1 in boost code cause a compilation error. L1 was changed to keep it in sync with its R1 counterpart. Thanks again. Best regards, Jurko Gospodnetić
participants (4)
-
Boris Gubenko
-
Gennadiy Rozental
-
Jason Roelofs
-
Jurko Gospodnetić