LAM/MPI logo

LAM/MPI General User's Mailing List Archives

  |   Home   |   Download   |   Documentation   |   FAQ   |   all just in this list

From: Geoffrey Irving (irving_at_[hidden])
Date: 2005-11-21 12:08:47


On Mon, Nov 21, 2005 at 08:29:52AM -0800, Geoffrey Irving wrote:
> Hello,
>
> Compiling a program using the LAM C++ wrapper classes with gcc 4.0.1 -Wall
> produces a ton of warnings like this:
>
> /solver/adm/lam/include/mpi2cxx/pcomm.h:53: warning: ‘class PMPI::Comm’ has virtual functions but non-virtual destructor
> /solver/adm/lam/include/mpi2cxx/ptopology.h:64: warning: ‘class PMPI::Graphcomm’ has virtual functions but non-virtual destructor
> /solver/adm/lam/include/mpi2cxx/intercomm.h:20: warning: ‘class MPI::Intercomm’ has virtual functions but non-virtual destructor
> ...
>
> The MPI-2 standard appears to specify that destructors should be virtual:
>
> 10.1.4: Except where indicated, all non-static member functions (except
> for constructors and the assignment operator) of MPI member
> classes are virtual functions.
>
> The C++ wrapper classes all have commented out virtual destructors. Is
> there a particular reason these were all commented out?
>
> I'll go ahead and remove these warnings and any other ones I come across,
> and would be happy to submit a patch if you'd like.

Actually, there were only two virtual destructors missing. Here's a patch
if anyone cares:

diff ./comm.h /solver/adm/lam/include/mpi2cxx/comm.h
114a115,117
> // destruction
> virtual ~Comm() { }
>
diff ./pcomm.h /solver/adm/lam/include/mpi2cxx/pcomm.h
79a80,82
> // destruction
> virtual ~Comm() { }
>

The problem was that JGS commented out the virtual destructor in Comm_Null
because Comm_Null doesn't have any virtual functions, and Comm no longer
had one.

Geoffrey