|
|
|
Re: Detect unused header files? | |
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] | |
On Tue, 28 Jul 2009, Christopher Li wrote:
> But a lot of case we have the header file is used in *another*
> file.
>
> >
> > Sample:
> >
> > cat foo.h:
> > #include <linux/types.h>
> > #include <linux/swab.h>
> >
> > struct foo {
> > __u32 bar;
> > __u32 baz;
> > };
> >
> > EOF
> >
> >
> > Here <linux/swab.h> is obviously not used.
> > And I would like sparse to flag this...
>
> I don't think it is can be turn on by default. What if some user
> space program want to include foo.h and use the definitional inside
> "swab.h"? In that case it will be OK. I don't think we can ban this
> kind of the usage case.
sure you can. no one should be counting on the inclusion of header
files by other header files (except possibly in unusual situations,
which i can't even think of at the moment). if your program needs the
contents of a header file, it's your responsibility to include it.
rday
--
========================================================================
Robert P. J. Day Waterloo, Ontario, CANADA
Linux Consulting, Training and Annoying Kernel Pedantry.
Web page: http://crashcourse.ca
Twitter: http://twitter.com/rpjday
"Kernel Newbie Corner" column @ linux.com: http://cli.gs/WG6WYX
========================================================================
[Newbies FAQ] [Kernel List] [Site Home] [IETF Annouce] [DCCP] [Netdev] [Networking] [Security] [Bugtraq] [Photo] [Yosemite] [MIPS Linux] [ARM Linux] [Linux Security] [Linux RAID] [Linux SCSI] [DDR & Rambus] [Trinity Fuzzer Tool]