This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC] : Compiling libstdc++ with warnings on


Benjamin Kosnik wrote:
>> 1) There are a small number of bugs in the testsuite headers (all
>> functions without a return statement which don't return void)
>>     
>
> These should be fixed.
>
>   
>> 2) A large number of "unused variables" in various tests (easy to fix
>> with the unused attribute).
>>     
>
> Usually this is the bool test thing, but sometimes you can just
> simplify or remove arguments, etc. More specifics would help here....
> can you post a list from the test results?
>
>   
I attach to this mail my current patch. This isn't final, but it shows
(I believe) all the "trivial" required changes. In the main this is just
removing the names of parameters which are never used, or marking things
__attribute__((unused)).

After that very large, but fairly uninteresting patch, the following
things remain (for -Wall)

1) Almost everything in tr1::array, as tr1::array<int,3> a = {1,2,3}
produces a warning about missing braces, it "should be" {{1,2,3}}. This
is PR25137.

2) Some things using bits/istream_iterator.h, in particular this little
piece of code. The construct on line 63 doesn't construct _M_value (one
of the elements). We've had this kind of thing before (we don't define
something, because it would get defined before it was ever used). I
tried adding a definition for it and can't measure any problem (mainly
as you are dealing with streams here.

3) FAIL: ext/pb_assoc/example/mapping_level.cc (test for excess errors)

/Users/caj/gccdev/trunkobj/powerpc-apple-darwin8.3.0/libstdc++-v3/include/ext/pb_assoc/detail/value_type_adapter/it_value_type_traits.hpp:117:
warning: dereferencing type-punned pointer will break strict-aliasing rules

I have no idea what this piece of code even is.

4) FAIL: tr1/4_metaprogramming/type_properties/is_empty/is_empty.cc
../../../../trunk/libstdc++-v3/testsuite/tr1/4_metaprogramming/type_properties/is_empty/is_empty.cc:40:
warning: 'class NonEmptyClassTwo' has virtual functions but non-virtual
destructor
/Users/caj/gccdev/trunkobj/powerpc-apple-darwin8.3.0/libstdc++-v3/include/tr1/type_traits:
In instantiation of 'std::tr1::__is_empty_helper<NonEmptyClassTwo,
false>::__second<NonEmptyClassTwo>':

Basically is_empty does inheritance from the type it is given, so
inherits the virtual functions from it. I'm not positive how (or if)
this can be fixed, I'm afraid to touch anything in type_traits :)

Pushing on to -Wextra

Many files in 22_locale/time_get & 22_locale/time_put like:
./../../../trunk/libstdc++-v3/testsuite/22_locale/time_put/put/char/1.cc:
In function 'void test01()':
../../../../trunk/libstdc++-v3/testsuite/22_locale/time_put/put/char/1.cc:35:
warning: missing initializer for member 'tm::tm_gmtoff'
../../../../trunk/libstdc++-v3/testsuite/22_locale/time_put/put/char/1.cc:35:
warning: missing initializer for member 'tm::tm_zone'

>From lines like:  tm time1 = { 0, 0, 12, 4, 3, 71, 0, 93, 0 };

and some warning about empty bitsets, which are variants of:
/Users/caj/gccdev/trunkobj/powerpc-apple-darwin8.3.0/libstdc++-v3/include/bitset:1174:
warning: comparison of unsigned expression < 0 is always false

Which may just have to be fixed by specialising some functions in
bitset<0> to not do anything.

Chris



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]