http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33255
--- Comment #15 from Dodji Seketeli <dodji at gcc dot gnu.org> 2011-07-24 21:57:47 UTC --- Created attachment 24820 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=24820 Work in progress patch This works only on the C++ FE (not on the C FE yet) for now and has been lightly tested so far. I ran it on libstdc++ and so far it fell short only on the use of PB_DS_STATIC_ASSERT (and friends) which defines a typedef. When this macro is expanded in a function that doesn't use the typedef it defines, the patch warns. Normally, it shouldn't warn b/c the macro is defined in a system header. But with the current (libcpp) infrastructure, we cannot tell the difference between a typedef defined in a system header macro that is expanded in a local function, and a typedef that is directly defined in the function. Normally with the work being done on PR proprocessor/7263 this patch should not warn in those case. At least if my understanding of the issue is correct. The warning option is -Wunused-local-typedefs and is activated by -Wall -Wextra, or -Wunused -Wextra. I am putting it here for now in case someone has interesting test cases to add.