lkml.org 
[lkml]   [2014]   [Dec]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] VERIFY_OCTAL_PERMISSIONS needs <linux/bug.h>
On 12/05/14 16:07, George Spelvin wrote:
> It is possible to include <linux/kernel.h> and try to use
> VERIFY_OCTAL_PERMISSIONS, then puke because BUILD_BUG_ON_ZERO
> isn't defined.
>
> I hit this via:
>
> #include <linux/moduleparam.h>
> module_param(verbose, bool, 0);
>
> IMHO, except in documented special cases, header files should
> #include their own macros' dependencies.

Yes. Documentation/SubmitChecklist #1:

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.


Thanks.

> Signed-off-by: George Spelvin <linux@horizon.com>
> ---
> include/linux/kernel.h | 1 +
> 1 file changed, 1 insertion(+)
>
> I'm not quite sure who to send this via. Rusty, you touched
> VERIFY_OCTAL_PERMISSIONS last. Should I send this via you, or collect
> acks and include it in the patch series I'm working on that wants this?
>
> The workaround is easy enough, but I'd rather fix it than let cruft
> like this accumulate.
>
> diff --git a/include/linux/kernel.h b/include/linux/kernel.h
> index 3d770f55..afb81c1a 100644
> --- a/include/linux/kernel.h
> +++ b/include/linux/kernel.h
> @@ -12,6 +12,7 @@
> #include <linux/typecheck.h>
> #include <linux/printk.h>
> #include <linux/dynamic_debug.h>
> +#include <linux/bug.h>
> #include <asm/byteorder.h>
> #include <uapi/linux/kernel.h>
>
>


--
~Randy


\
 
 \ /
  Last update: 2014-12-06 01:41    [W:0.045 / U:0.208 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site