This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [OT] Identifying unused include directives?
- From: dewar at gnat dot com (Robert Dewar)
- To: dkegel at ixiacom dot com, fw at deneb dot enyo dot de
- Cc: gcc at gcc dot gnu dot org
- Date: Sat, 30 Aug 2003 11:35:28 -0400 (EDT)
- Subject: Re: [OT] Identifying unused include directives?
> 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 :-)