[test][gcc] return value support broken with "-pedantic"

Hi ! The latest changes to Boost.Test broke compilation with gcc in "pedantic" mode. This seems to be: http://svn.boost.org/trac/boost/changeset/47153 Just add "<toolset>gcc:<cxxflags>-pedantic" to libs/test/test/Jamfile.v2 and recompile. This will bail out with: gcc.compile.c++ /build/bjam/boost_1.36.0/libs/test/test/output_test_stream_test.test/gcc-4.2/debug/output_test_stream_test.o output_test_stream_test.cpp: In member function 'void test_constructor::test_method()': output_test_stream_test.cpp:30: error: ISO C++ forbids braced-groups within expressions I've disabled "return value support" locally (by commenting out test_tools.hpp line 86) but would like to have a conformant solution. Should we rise the warning level by _always_ activating "-pedantic" at least for the test suite ? Yours, Jürgen -- * Dipl.-Math. Jürgen Hunold ! Ingenieurgesellschaft für * voice: ++49 511 262926 57 ! Verkehrs- und Eisenbahnwesen mbH * fax : ++49 511 262926 99 ! Lister Straße 15 * juergen.hunold@ivembh.de ! www.ivembh.de * * Geschäftsführer: ! Sitz des Unternehmens: Hannover * Prof. Dr.-Ing. Thomas Siefer ! Amtsgericht Hannover, HRB 56965 * PD Dr.-Ing. Alfons Radtke !

Hi Steven ! On Monday 07 July 2008 18:20:33 Steven Watanabe wrote:
Juergen Hunold wrote:
Should we rise the warning level by _always_ activating "-pedantic" at least for the test suite ?
The gcc stdcxx tests fail with -pedantic, because the standard library uses long long without protecting it.
Yes, and some "extra ;" (which is -ansi, I think). That would be hard, except we can trick gcc with #pragma system or "system- include" paths... Times short on my side, so I fear this have to stay as it is :-(( Yours, Jürgen -- * Dipl.-Math. Jürgen Hunold ! Ingenieurgesellschaft für * voice: ++49 511 262926 57 ! Verkehrs- und Eisenbahnwesen mbH * fax : ++49 511 262926 99 ! Lister Straße 15 * juergen.hunold@ivembh.de ! www.ivembh.de * * Geschäftsführer: ! Sitz des Unternehmens: Hannover * Prof. Dr.-Ing. Thomas Siefer ! Amtsgericht Hannover, HRB 56965 * PD Dr.-Ing. Alfons Radtke !

Juergen Hunold <juergen.hunold <at> ivembh.de> writes:
Hi !
The latest changes to Boost.Test broke compilation with gcc in "pedantic" mode. This seems to be:
...
output_test_stream_test.cpp: In member function 'void test_constructor::test_method()': output_test_stream_test.cpp:30: error: ISO C++ forbids braced-groups within expressions
A-ha. No wonder no other compiler agreed to compile it ;)
I've disabled "return value support" locally (by commenting out test_tools.hpp line 86) but would like to have a conformant solution.
Didn't really find any alternatives. Have any suggestions? Can I keep it only in non-pedantic mode? Or is it going to go as well? Gennadiy

Hi Gennadiy ! On Monday 07 July 2008 18:39:15 Gennadiy Rozental wrote:
Juergen Hunold <juergen.hunold <at> ivembh.de> writes:
output_test_stream_test.cpp: In member function 'void test_constructor::test_method()': output_test_stream_test.cpp:30: error: ISO C++ forbids braced-groups within expressions
A-ha. No wonder no other compiler agreed to compile it ;)
*ouch* Well, gcc should report _way_ ealier, then :-((
I've disabled "return value support" locally (by commenting out test_tools.hpp line 86) but would like to have a conformant solution.
Didn't really find any alternatives. Have any suggestions?
No, I fear I'm missing the rationale and some background on this.
Can I keep it only in non-pedantic mode? Or is it going to go as well?
At least with gcc-4.2.3 (Kubuntu Hardy) it works. I'll check gcc-4.3.1 (OpenSuSE 10.3 repository upgrade) at work tomorrow. But given the fact that no other compiler did allow this, I would rather not have it in. With a better regression reporting system we could perhaps set up some "code testing" build-sandbox for testing "dark corner" code ;-)) And read "better" as "shorter response and turnaround time". Yours, Jürgen -- * Dipl.-Math. Jürgen Hunold ! Ingenieurgesellschaft für * voice: ++49 511 262926 57 ! Verkehrs- und Eisenbahnwesen mbH * fax : ++49 511 262926 99 ! Lister Straße 15 * juergen.hunold@ivembh.de ! www.ivembh.de * * Geschäftsführer: ! Sitz des Unternehmens: Hannover * Prof. Dr.-Ing. Thomas Siefer ! Amtsgericht Hannover, HRB 56965 * PD Dr.-Ing. Alfons Radtke !

Hi Gennadiy ! An'n Monday 07 July 2008 hett Juergen Hunold schreven:
At least with gcc-4.2.3 (Kubuntu Hardy) it works. I'll check gcc-4.3.1 (OpenSuSE 10.3 repository upgrade) at work tomorrow.
gcc-4.3 shows the same behaviour :-(( Seems to be some kind of backward compatibility.
But given the fact that no other compiler did allow this, I would rather not have it in.
But this is still true ;-)) Yours, Jürgen -- * Dipl.-Math. Jürgen Hunold ! Ingenieurgesellschaft für * voice: ++49 511 262926 57 ! Verkehrs- und Eisenbahnwesen mbH * fax : ++49 511 262926 99 ! Lister Straße 15 * juergen.hunold@ivembh.de ! www.ivembh.de * * Geschäftsführer: ! Sitz des Unternehmens: Hannover * Prof. Dr.-Ing. Thomas Siefer ! Amtsgericht Hannover, HRB 56965 * PD Dr.-Ing. Alfons Radtke !

Jürgen Hunold <juergen.hunold <at> ivembh.de> writes:
But given the fact that no other compiler did allow this, I would rather not have it in.
But this is still true )
I've removed this misguided attempt from source. The idea was to enable usage like this: if( BOOST_CHECK(...) ) { ... do more checks here } Unfortunately all Testing tools internally are implemented using do while statement like this: do { ... tool implementation here } while( false ) It doesn't look like we can enable above use case for now. Gennadiy
participants (4)
-
Gennadiy Rozental
-
Juergen Hunold
-
Jürgen Hunold
-
Steven Watanabe