[Bug c/87806] Option -Wall should warn about unused structs, typdefs, enums, etc
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87806 --- Comment #8 from Ulrich Windl --- (In reply to Jonathan Wakely from comment #6) > I don't think there are any, only for local typedefs. That's already enabled > by -Wall so I assumed this was a request to add a new warning *and* enable > it in -Wall. In gcc 8.2.1 I do not get a warning about an unused typedef (at file scope) with -Wall.
[Bug c/87806] Option -Wall should warn about unused structs, typdefs, enums, etc
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87806 --- Comment #7 from Ulrich Windl --- (In reply to Tavian Barnes from comment #4) > Perhaps this is reasonable for types that are defined in the file itself, > not in an included header? That's what I was thinking about. However it seems the compiler does not know automatically what is an include file and what is a normal compilation unit (C file). Therefore I had suggested pragmas for the include files.
[Bug c/87806] Option -Wall should warn about unused structs, typdefs, enums, etc
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87806 --- Comment #6 from Jonathan Wakely --- I don't think there are any, only for local typedefs. That's already enabled by -Wall so I assumed this was a request to add a new warning *and* enable it in -Wall.
[Bug c/87806] Option -Wall should warn about unused structs, typdefs, enums, etc
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87806 Martin Sebor changed: What|Removed |Added CC||msebor at gcc dot gnu.org --- Comment #5 from Martin Sebor --- I agree that focusing the warning on definitions in .c files and avoiding those in headers would be necessary to make the fallout manageable. But I'm not sure -Wall or even -Wextra is a good fit even for this relaxed version of the warning. GCC (and many other GNU projects, including Glibc) has a policy of compiling cleanly with -Wall and -Wextra so enabling such a warning by either would likely mean a lot of work cleaning up GCC itself (and the other projects). Building some of these projects with the warnings explicitly enabled would give us an idea of the scope of the cleanup. I could give that a try but I can't find any options that control warnings about unused non-local types and enums. What are they?
[Bug c/87806] Option -Wall should warn about unused structs, typdefs, enums, etc
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87806 Tavian Barnes changed: What|Removed |Added CC||tavianator at gmail dot com --- Comment #4 from Tavian Barnes --- Perhaps this is reasonable for types that are defined in the file itself, not in an included header?
[Bug c/87806] Option -Wall should warn about unused structs, typdefs, enums, etc
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87806 --- Comment #3 from Jonathan Wakely --- (In reply to Ulrich Windl from comment #0) > BTW: With having option -Wmissing-field-initializers I could even imagine to > warn about single fields that are never used. Again, this seems like a bad idea. I shouldn't have to use every member of a struct in every file to avoid warnings from -Wall.
[Bug c/87806] Option -Wall should warn about unused structs, typdefs, enums, etc
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87806 Jonathan Wakely changed: What|Removed |Added Severity|normal |enhancement --- Comment #2 from Jonathan Wakely --- (In reply to Ulrich Windl from comment #0) > Is it due to the fact that many #include files define a lot of such (and > most of those are not used)? Yes. You'd get a warning from every header unless every file that includes the header uses *everything* in that header. It should not be necessary to add pragmas to every header to avoid warnings with -Wall, so this seems like a bad idea.
[Bug c/87806] Option -Wall should warn about unused structs, typdefs, enums, etc
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87806 --- Comment #1 from Ulrich Windl --- This is an enhancement request (cant't set it in Bugzilla)