I am trying to emerge sys-libs/libstdc++-v3-3.3.6. My system is using gcc-4.3.1, and CFLAGS which are valid for gcc-4.3.1. Some of the flags are not supported by gcc-3.3.6. As libstdc++ is built with xgcc (a gcc-3.3.6) after it has been built, some flags must not be passed to xgcc, or the build will break. The current libstdc++-3.3.6 ebuild does a good job in filtering out/replacing flags already. Nevertheless, it needs to be extended a bit. My build fails with: configure:2076: checking for object suffix configure:2082: /var/tmp/portage/sys-libs/libstdc++-v3-3.3.6/work/build/gcc/xgcc -B/var/tmp/portage/sys-libs/libstdc++-v3-3.3.6/work/build/gcc/ -B/usr/i686-pc-linux-gnu/bin/ -B/usr/i686-pc-linux-gnu/lib/ -isystem /usr/i686-pc-linux-gnu/include -c -O2 -O2 -pipe -Wall -Wextra -Wformat-y2k -Wformat-security -Winit-self -Wfloat-equal -Wundef -Wcast-align -Wconversion -Winline -Wvolatile-register-var -Wcast-qual -Wwrite-strings -Wpacked -Wswitch-enum -Wshadow -Wmissing-include-dirs -Winvalid-pch -Wdisabled-optimization -Wbad-function-cast -Wstrict-prototypes conftest.c 1>&5 cc1: error: unrecognized option `-Wextra' cc1: error: unrecognized option `-Winit-self' cc1: error: unrecognized option `-Wvolatile-register-var' cc1: error: unrecognized option `-Wmissing-include-dirs' cc1: error: unrecognized option `-Winvalid-pch' IMO, filtering out warning flags is the right way to fix the problem in this special case. The flag ‘-Wextra’ should not be filtered out, but be replaced by ‘-W’. Please note that the above list contains just a few warning flags which happen to be set on my system. It does not list all warning flags which have been added to recent versions of gcc, but were not present in gcc-3.x.
Not unlikely your bug will be closed by the maintainer. That you can play with your compiler flags at will, that doesn't mean everything is supported.
We aren't going to filter out every warning flag that isn't supported as well, which it seems you put in your CFLAGS.