ksummit.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [Ksummit-discuss] Should we force include <linux/err.h> when compiling all .c files?
@ 2014-07-25 12:39 David Howells
  2014-07-25 23:24 ` Josh Triplett
  0 siblings, 1 reply; 11+ messages in thread
From: David Howells @ 2014-07-25 12:39 UTC (permalink / raw)
  To: ksummit-discuss

Should we forcibly include <linux/err.h> from the gcc command line when
compiling all .c files?  Note:

	warthog>git grep -l '#.*include.*<linux/err[.]h>' -- \*.c | wc -l
	1797

vs:

	warthog>git grep -l 'IS_ERR\|ERR_PTR\|PTR_ERR\|ERR_CAST' -- \*.c | wc -l
	4472

So a lot fewer .c files include it than use it, but according to:

	1: If you use a facility then #include the file that defines/declares
	   that facility.  Don't depend on other header files pulling in ones
	   that you use.

as pointed out to me by Stephen, it shouldn't be assumed that it's available.


However, passing errors in pointers is so very common within the kernel, it
might worth be adding linux/err.h to the automatically included stuff.

David

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2014-07-30 14:31 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-25 12:39 [Ksummit-discuss] Should we force include <linux/err.h> when compiling all .c files? David Howells
2014-07-25 23:24 ` Josh Triplett
2014-07-28 18:52   ` H. Peter Anvin
2014-07-28 20:16     ` Julia Lawall
2014-07-28 22:53       ` H. Peter Anvin
2014-07-29 14:35         ` Josh Triplett
2014-07-29 15:17           ` Luck, Tony
2014-07-29 16:50             ` Hugh Dickins
2014-07-29 19:06               ` Hugh Dickins
2014-07-29 14:24     ` Josh Triplett
2014-07-30 14:30       ` H. Peter Anvin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox