lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Fri, 20 Dec 2013 09:40:01 -0000
From:	"David Laight" <David.Laight@...LAB.COM>
To:	"Josh Triplett" <josh@...htriplett.org>
Cc:	"Greg Kroah-Hartman" <gregkh@...uxfoundation.org>,
	"Rashika Kheria" <rashika.kheria@...il.com>,
	"Linux-Kernel" <linux-kernel@...r.kernel.org>,
	"Alan Stern" <stern@...land.harvard.edu>,
	"Matthias Beyer" <mail@...ermatthias.de>,
	"Sarah Sharp" <sarah.a.sharp@...ux.intel.com>,
	"Hans de Goede" <hdegoede@...hat.com>,
	"linux-usb" <linux-usb@...r.kernel.org>
Subject: RE: [PATCH 1/7] drivers: usb: Include appropriate header file in hcd.c

> From: Josh Triplett
> On Thu, Dec 19, 2013 at 05:33:09PM -0000, David Laight wrote:
> > OTOH just including extra headers isn't ideal - it can considerably
> > slow down the compilation time. There are many subsystems that don't
> > really separate their internal headers from their external ones.
> 
> There's a benefit to doing so, though: it ensures that the prototypes in
> the header stay in sync with the definition.

I think you misunderstood what I was saying.
The header with the function prototypes has to be included when the
driver itself is built - there is a gcc warning for that as well.

The 'problem' is that if I only have:
    void foo(struct foo *);
then the C language (uselessly) scopes the declaration of 'struct foo'
to the inside of the functions - making it almost impossible to call.

All you need is an outer declaration:
    struct foo;
    void foo(struct foo *);
what you don't need is the actual definition of 'struct foo'.
Source files that need to look at the members of the structure
should be directly including the header that defines the structure.

Adding nested includes just makes it more likely that code will fail
to directly include the headers that define the structures it uses.

	David



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ