Boost logo

Boost Testing :

From: Robert Ramey (ramey_at_[hidden])
Date: 2005-10-20 11:21:52


ahhh, now we're getting somewhere.

"-Wnon-virtual-dtor (C++ only)

So the motivation of the warning is more or less as I had originally
interpreted it. I take as an indicator of "likely" erroneous code that
should be examined for correctness - which I have done.

"-Wctor-dtor-privacy (C++ only)
and I like this too. What I'm doing here IS unusual. The serialization
library creates a couple of global static singleton for each type that
needs to be serialized as a pointer. These datums are instances of
classes which contain functions required for serialization of the specific
type. They are created at pre-runtime and destroyed at post end time.

I access these singleton through static local variables in public member
functions so there was no need for the constructor to be public.
When people started to include serialization of types
defined and declared in dynamically loaded DLLS, sometimes
multiple entries for the same type would turn up and I very much
wanted to trap and prohibit that. I also wanted to trap and prohibit the
destruction of any of these instances through the base class
pointer. So that is how things came to be the way they are.

When people started to include serialization of types declared and
defined in DLLS (something I never considered while making the library),
I discovered that these singletons are also constructed
at DLL load time and DLL unload time. So it wasn't just pre and
post run time anymore. That added a whole new layer of considerations.

So I take these warnings as advice that one is likely doing something
wrong except in some special cases. In this context the serialization
IS special.

So I would recommend turning off these warnings for modules
which include the serialization library headers.

Once I did look at the signed/unsigned warnings. I must have
concluded that they weren't a problem.

Warnings in general vary
quite a bit from compiler to compiler. Attempting alter code
to address them all results in a lot more #if/#endif sprinkled
throughout the code. Given the number of compilers that
boost supports this creates another problem.

When possible, I've made changes so that things work with
the "widest common denominator" of compilers.

Robert Ramey

Jim Douglas wrote:
> Robert Ramey wrote:
>> Boost Compiler Status Error Log
>> "Jim Douglas" <jim_at_[hidden]> wrote in message
>> news:divu90$hv2$1_at_sea.gmane.org...
>>
>>> ...AFAIK there is not an option to suppress this warning in gcc
>>> version 3.3.5 (or indeed any version of gcc).
>>
>> I've wondered about this myself.
>
> OK I can stop complaining. I found the relevent section in the g++
> manual to supress this warning. It is listed as a 'Dialect' option and
> not a 'Warning Message' option which is why I missed to the first
> time:
>
> "-Wnon-virtual-dtor (C++ only)
> Warn when a class appears to be polymorphic, thereby requiring a
> virtual destructor, yet it declares a non-virtual one. This warning is
> enabled by -Wall."
>
> [and turned off by -Wno-non-virtual-dtor]
>
> Having done that I got a couple of warnings from this department:
>
> "-Wctor-dtor-privacy (C++ only)
> Warn when a class seems unusable because all the constructors or
> destructors in that class are private, and it has neither friends nor
> public static member functions. This warning is enabled by default."
>
> And I also saw some signed/unsigned comparison warnings.
>
> Any comments?
>
> [PS Rene - is bjam flexible enough to allow suppression of these
> warnings on a per-library basis?]
>
> Jim


Boost-testing list run by mbergal at meta-comm.com