-Wshadow -Werror

Loren James Rittle rittle@latour.rsch.comm.mot.com
Mon Jan 28 09:30:00 GMT 2002


Jens Rehsack reported to a FreeBSD mailing list (and David O'Brien
forwarded it to me) that these CXXFLAGS settings:

-W -Wall -Wbad-function-cast -Wcast-align -Wcast-qual -Wchar-subscripts
-Winline -Wmissing-prototypes -Wnested-externs -Wpointer-arith
-Wredundant-decls -Wshadow -Wstrict-prototypes -Wwrite-strings -Werror

causes this simple test case to fail against gcc 3.0.2 as built from
the FreeBSD ports system:

#include <iostream>

int main()
{
  std::cout << "Hello world" << std::endl;
}

The issue was fixed on the mainline (due to random source reworking)
but still exists on the 3.0.X branch as built with plain FSF sources.

It appears that being marked as code within a system header does not
affect template instantiation that is actually triggered outside the
header.  If this issue only arose when one was compiling libstdc++-v3
(as I first thought), then we could just say, "don't compile
libstdc++-v3 with both flags" but this issue impacts building user
code outside the library with strict warning flags.

Here is the original report with patch:

http://docs.freebsd.org/cgi/getmsg.cgi?fetch=1973092+0+archive/2002/freebsd-ports/20020127.freebsd-ports

I have reviewed the patch he provided and believe that it is
straightforward.  It merely changes the inner use of the variable name
which is contained to a small localized scope.

Permission to synth a ChangeLog entry; perform required testing and
install on 3.0.X branch before 3.0.4 lockdown?

Regards,
Loren



More information about the Libstdc++ mailing list