[mpl] mpl::string, help needed (vacpp, sun, borland)

A few days ago, I added mpl::string (a compile-time string class template) to trunk. I expected horrific portability problems with my use of multi-character literals, but it's not as bad as all that judging from the test results. There are only a few failures on compilers I don't have access to: vacpp, sun and borland. I invite anybody with access to these compilers to "bjam string" in the libs/mpl/test directory, try their hand at fixing the problems and submitting a patch. Thanks! -- Eric Niebler BoostPro Computing http://www.boostpro.com

Eric Niebler wrote:
A few days ago, I added mpl::string (a compile-time string class template) to trunk. I expected horrific portability problems with my use of multi-character literals, but it's not as bad as all that judging from the test results. There are only a few failures on compilers I don't have access to: vacpp, sun and borland. I invite anybody with access to these compilers to "bjam string" in the libs/mpl/test directory, try their hand at fixing the problems and submitting a patch.
Thanks!
I ported mpl::string to sun c++ 5.9 (sunos_sparc) and made sure all tests in libs/mpl/test/string.cpp pass. Also verified that gcc-4.3.3 passes all tests on linux with the patch applied. Please, find the patch in the attachment. BR, Dmitry

(Sorry for the delayed response. I've been away.) Dmitry Goncharov wrote:
I ported mpl::string to sun c++ 5.9 (sunos_sparc) and made sure all tests in libs/mpl/test/string.cpp pass. Also verified that gcc-4.3.3 passes all tests on linux with the patch applied. Please, find the patch in the attachment.
Terrific, thanks. A few observations ... your change to libs/mpl/test/string.cpp looks spurious. Can you comment? Also, your change to string.hpp causes extra template instantiations for all platforms, instead of just for sun where it's needed. Can you put your change under a #ifdef BOOST_WORKAROUND? That would be ideal. (Also, using BOOST_WORKAROUND helps compiler devs find their bugs, but an even better way is to file them directly if you know how.) -- Eric Niebler BoostPro Computing http://www.boostpro.com

Eric Niebler wrote:
(Sorry for the delayed response. I've been away.)
Dmitry Goncharov wrote:
I ported mpl::string to sun c++ 5.9 (sunos_sparc) and made sure all tests in libs/mpl/test/string.cpp pass. Also verified that gcc-4.3.3 passes all tests on linux with the patch applied. Please, find the patch in the attachment.
Terrific, thanks. A few observations ... your change to libs/mpl/test/string.cpp looks spurious. Can you comment? The patch uses mpl::empty in order to implement push_front. So, it is a good idea to test mpl::empty on mpl::string before testing push_front.
Also, your change to string.hpp causes extra template instantiations for all platforms, instead of just for sun where it's needed. Can you put your change under a #ifdef BOOST_WORKAROUND? That would be ideal. (Also, using BOOST_WORKAROUND helps compiler devs find their bugs, but an even better way is to file them directly if you know how.)
I'll send a new patch a bit later. BR, Dmitry

Eric Niebler wrote:
Dmitry Goncharov wrote:
I ported mpl::string to sun c++ 5.9 (sunos_sparc) and made sure all tests in libs/mpl/test/string.cpp pass. Also verified that gcc-4.3.3 passes all tests on linux with the patch applied. Please, find the patch in the attachment.
Terrific, thanks. A few observations ... your change to libs/mpl/test/string.cpp looks spurious. Can you comment? Also, your change to string.hpp causes extra template instantiations for all platforms, instead of just for sun where it's needed. Can you put your change under a #ifdef BOOST_WORKAROUND? That would be ideal. (Also, using BOOST_WORKAROUND helps compiler devs find their bugs, but an even better way is to file them directly if you know how.)
This version uses BOOST_WORKAROUND. Please, have a look. Tested on sun c++ 5.9 and gcc4.3.3. The same modifications of libs/mpl/test/string.cpp. The patch adds #include <boost/mpl/empty.hpp> and #include <boost/mpl/if.hpp> to boost/mpl/string.hpp on all platforms. This can also be made only for sun. Do you think it's needed? BR, Dmitry

Dmitry Goncharov wrote:
Eric Niebler wrote:
Dmitry Goncharov wrote:
I ported mpl::string to sun c++ 5.9 (sunos_sparc) and made sure all tests in libs/mpl/test/string.cpp pass. <snip> This version uses BOOST_WORKAROUND. Please, have a look. Tested on sun c++ 5.9 and gcc4.3.3.
Thanks. I've merged this patch to trunk after making a few small edits myself, and I've given you credit for the port.
The patch adds #include <boost/mpl/empty.hpp> and #include <boost/mpl/if.hpp> to boost/mpl/string.hpp on all platforms. This can also be made only for sun. Do you think it's needed?
No, I think that's fine. Thanks again. -- Eric Niebler BoostPro Computing http://www.boostpro.com

Eric Niebler wrote:
Dmitry Goncharov wrote:
This version uses BOOST_WORKAROUND. Please, have a look. Tested on sun c++ 5.9 and gcc4.3.3.
Thanks. I've merged this patch to trunk after making a few small edits myself, and I've given you credit for the port.
We have a very interesting problem with the Sun compiler. I see from the regression reports that the mpl::string test is passing now with sun-5.9 on SunOS, but it's failing on Linux. The nature of the failure there is fascinating, and reveals our first true portability problem with multichar literals. Look at the error: assertion_failed<mpl_::C>(mpl_::failed************boost::is_same< boost::mpl::string<24930, 0, 0, 0, 0, 0, 0, 0>, boost::mpl::string<25185, 0, 0, 0, 0, 0, 0, 0>>::************) 24930 is 0x6162 or 'ab' and 25185 is 0x6261 or 'ba'. The first test that is failing is a push_back of 'b' into a string that contains 'a'. This looks like an endian problem. I'm not sure how to proceed. I have no hope of fixing this without access to the failing platform. Anyone care to submit a patch? -- Eric Niebler BoostPro Computing http://www.boostpro.com

Eric Niebler wrote:
We have a very interesting problem with the Sun compiler. I see from the regression reports that the mpl::string test is passing now with sun-5.9 on SunOS, but it's failing on Linux. The nature of the failure there is fascinating, and reveals our first true portability problem with multichar literals. Look at the error: <snip>
For anybody interested in tackling this programming challenge, I have made it easier by isolating the implementation-defined bit-twiddling to some macros in boost/mpl/string.hpp. With appropriate definitions of the BOOST_MPL_MULTICHAR_* macros, mpl::string should work on the sun-5.9/Linux toolset. Any takers? -- Eric Niebler BoostPro Computing http://www.boostpro.com

Eric Niebler wrote:
Eric Niebler wrote:
We have a very interesting problem with the Sun compiler. I see from the regression reports that the mpl::string test is passing now with sun-5.9 on SunOS, but it's failing on Linux. The nature of the failure there is fascinating, and reveals our first true portability problem with multichar literals. Look at the error: <snip>
For anybody interested in tackling this programming challenge, I have made it easier by isolating the implementation-defined bit-twiddling to some macros in boost/mpl/string.hpp. With appropriate definitions of the BOOST_MPL_MULTICHAR_* macros, mpl::string should work on the sun-5.9/Linux toolset. Any takers? A patch in the attachment. Verified with sun c++ 5.9 on sparc, sun c++ 5.10 on linux and gcc 4.3.3 on linux.
Br, Dmitry

Dmitry Goncharov wrote:
Eric Niebler wrote:
We have a very interesting problem with the Sun compiler. I see from the regression reports that the mpl::string test is passing now with sun-5.9 on SunOS, but it's failing on Linux. The nature of the failure there is fascinating, and reveals our first true portability problem with multichar literals. Look at the error: <snip>
A patch in the attachment. Verified with sun c++ 5.9 on sparc, sun c++ 5.10 on linux and gcc 4.3.3 on linux.
Awesome! The PP conditional you have is: #if defined(BOOST_LITTLE_ENDIAN) && BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x590)) As this isn't a workaround for a compiler bug, I'll change this to: #if defined(BOOST_LITTLE_ENDIAN) && defined(__SUNPRO_CC) ... and commit it. A million thanks! -- Eric Niebler BoostPro Computing http://www.boostpro.com

Dmitry Goncharov wrote:
Eric Niebler wrote:
We have a very interesting problem with the Sun compiler. I see from the regression reports that the mpl::string test is passing now with sun-5.9 on SunOS, but it's failing on Linux. The nature of the failure there is fascinating, and reveals our first true portability problem with multichar literals. Look at the error:
A patch in the attachment. Verified with sun c++ 5.9 on sparc, sun c++ 5.10 on linux and gcc 4.3.3 on linux.
Tests have cycled on Main and the results look good. Thanks for all your help, Dmitry. vacpp and borland still don't like mpl::string. Patches welcome. -- Eric Niebler BoostPro Computing http://www.boostpro.com
participants (3)
-
Dmitry Goncharov
-
Eric Niebler
-
Eric Niebler