Share

CppUnit - C++ port of JUnit

Tracker: Patches

5 Patch to quell g++ warnings while building cppunit - ID: 1898225
Last Update: Comment added ( smr99 )

Please find enclosed a patch which allows cppunit-1.12.1 to build without
warnings when using gcc-4.1 with "-ansi -W -Wall -Werror".

The patch fixes several files and deals almost entirely with unused
variable warnings (which I tend to fix through the use of anonymous
parameters) although there is also one change to call a default constructor
in an initialization list. The only really critical
patch is the one for

cppunit/include/cppunit/extensions/ExceptionTestCaseDecorator.h

which is the single public header involved.



To test the patch I did the following:

------------------------------------
$ cvs -z3 -d:pserver:anonymous@cppunit.cvs.sourceforge.net:/cvsroot/cppunit
co -P cppunit

$ cd cppunit

$ patch -p0 < ../../cppunit/cppunit-1.12.1-nowarn.patch
[...bunch of messages...]

$ ./autogen.sh
[... some messages...]

$ ./configure
[... more messages...]

$ make CXXFLAGS="-W -Wall -Werror -ansi $CXXFLAGS"
[... lots of messages...]

$ make CXXFLAGS="-W -Wall -Werror -ansi $CXXFLAGS" check
[... and even more messages ...]
------------------------------------

where the -Werror flag ensures that had there been a warning from g++ then
the compiler would have stopped there.


I changed the flags on the "make" command line, but I would have preferred
to do it in the automake/autoconf structure. Unfortunately, it wasn't
obvious how to set compiler specific flags (e.g. "if you're using g++ then
set CXXFLAGS as above, otherwise don't") and I didn't want to delay the
patch for that. Perhaps someone with more experience with the GNU
autotools can set that up.


dpk ( dpkatz ) - 2008-02-20 22:22

5

Closed

Accepted

Nobody/Anonymous

compilation/portability

None

Public


Comment ( 1 )

Date: 2008-02-21 03:20
Sender: smr99


Applied the patch, thanks!

As for the flags setting: that is traditionally left up to the installer,
so it is just as well that you don't spend time trying to get "configure"
to do it for you. Instead, the installer may choose to do so at configure
time using "./configure CXXFLAGS='-Wall -W ...'".




Attached File ( 1 )

Filename Description Download
cppunit-1.12.1-nowarn.patch Patches to stop warnings while building cppunit Download

Changes ( 4 )

Field Old Value Date By
status_id Open 2008-02-21 03:20 smr99
resolution_id None 2008-02-21 03:20 smr99
close_date - 2008-02-21 03:20 smr99
File Added 267255: cppunit-1.12.1-nowarn.patch 2008-02-20 22:22 dpkatz