[LC++]Re: g++ 3.0 warning messages

Bernhard Josef Rieder bernhard at ratte.dhs.org
Sat Jul 28 02:26:06 UTC 2001


On Fri, Jul 27, 2001 at 11:36:49AM -0400, Jack Lloyd wrote:

> The reason I'm saying this is because I have been using gcc3 and get no
> such warnings with "-ansi -W -Wall", which is my usual warning flag
> set.

I use -pedantic -Wall -Wshadow -Wpointer-arith -Wcast-qual
      -Wcast-align -Wwrite-strings -Wconversion
but I thing standard libraries should never cause error messages,
no matter which warning options you use

> Becaues I installed gcc3 into /usr/local/gcc-3.0, the STL code I use is in
> /usr/local/gcc-3.0/include/g++-3 (note that I don't have to set anything
> explicitly with -I or whatever; g++ knows to search there and will include
> those files as long as it doesn't find other ones in /usr/include).

I don not think that is the reason. As you can see the includes are in 
g++-v3. Since I am using debian packages of g++ I think outdated files
are the source of the warnings.


> Could you perhaps be more specific about what the warnings are/what files
> they are from (and also what your system setup is)?

g++-3.0 -D__DEBUG__ -ggdb3  -I./include -I. -pedantic -Wall -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -Wconversion  -c -o VMK_Serial_IO.o VMK_Serial_IO.C 
/usr/include/g++-v3/bits/ostream.tcc: In function `void 
   std::__pad_char(std::basic_ios<_CharT, _Traits>&, _CharT*, const _CharT*, 
   int, int) [with _CharT = char, _Traits = std::char_traits<char>]':
/usr/include/g++-v3/bits/ostream.tcc:701:   instantiated from `std::basic_ostream<char, _Traits>& std::operator<<(std::basic_ostream<char, _Traits>&, const char*) [with _Traits = std::char_traits<char>]'
VMK_Serial_IO.C:72:   instantiated from here
/usr/include/g++-v3/bits/ostream.tcc:490: warning: declaration of `__fmt' 
   shadows previous local
g++-3.0 -D__DEBUG__ -ggdb3  -I./include -I. -pedantic -Wall -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -Wconversion  -c -o VMK_Serial_Client.o VMK_Serial_Client.C 
/usr/include/g++-v3/bits/ostream.tcc: In function `void 
   std::__pad_char(std::basic_ios<_CharT, _Traits>&, _CharT*, const _CharT*, 
   int, int) [with _CharT = char, _Traits = std::char_traits<char>]':
/usr/include/g++-v3/bits/ostream.tcc:701:   instantiated from `std::basic_ostream<char, _Traits>& std::operator<<(std::basic_ostream<char, _Traits>&, const char*) [with _Traits = std::char_traits<char>]'
VMK_Serial_Client.C:95:   instantiated from here
/usr/include/g++-v3/bits/ostream.tcc:490: warning: declaration of `__fmt' 
   shadows previous local


So the messages seem to come only from ostream. I can also remember some
messages from <string> but maybe they have been fixed.

I wrote a little perl script to suppress warnings from standard includes
and to replace "basic_string ......." with "string". I noticed that this
filter also dropped of the messages caused by my program so I removed it.

I didn´t try to compile it recently so I did not notice some of the
errors disappeared since the last upgrade.


-- 
Bernhard Rieder & Nagetiere:  /""\       __    _,-""-.
   bernhard at ratte.dhs.org    / `.o\     (0)),-"    .-.'.
Ratte - Mailingliste:       /o O  o) :-"o  ,__/,__(     :*'^'-.__.-'
   ratte at ratte.dhs.org     /o_.--_(   "^---'---'------'"



More information about the tuxCPProgramming mailing list