[OT] Identifying unused include directives?

Robert Dewar dewar@gnat.com
Sun Aug 31 02:49:00 GMT 2003


> What is "unneeded"?  On some systems, some header files pull in
> others, and are therefore unnecessary from a GCC perspective, but they
> are actually required to make the program portable.

I think the definition of unneeded is pretty clear. A reasonable definition
would be that the removal of the #include would not affect the semantics
of the resulting program. As I pointed out before, this is recursively
undecidable in the general case.

Yes, as you point out, in some cases, you want the #include present even
if this criterion of no semantic effect is met, but that's why this is a
warning, warnings always carry the danger of some false positives (or they
would not be warnings :-)



More information about the Gcc mailing list