Re: [PATCH v2] bug: fix problem including <linux/bug.h> from linux/kernel.h

From: kbuild test robot
Date: Wed May 24 2017 - 19:53:34 EST


Hi Ian,

[auto build test ERROR on linus/master]
[also build test ERROR on v4.12-rc2 next-20170524]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/Ian-Abbott/bug-fix-problem-including-linux-bug-h-from-linux-kernel-h/20170525-063508
config: x86_64-acpi-redef (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64

All error/warnings (new ones prefixed by >>):

In file included from arch/x86/include/asm/bug.h:81:0,
from include/linux/bug.h:4,
from include/linux/jump_label.h:184,
from arch/x86/include/asm/string_64.h:5,
from arch/x86/include/asm/string.h:4,
from include/linux/string.h:18,
from include/uapi/linux/uuid.h:21,
from include/linux/uuid.h:19,
from include/linux/mod_devicetable.h:12,
from scripts/mod/devicetable-offsets.c:2:
>> include/asm-generic/bug.h:101:13: warning: 'struct pt_regs' declared inside parameter list will not be visible outside of this definition or declaration
struct pt_regs *regs, struct warn_args *args);
^~~~~~~
include/linux/jump_label.h: In function 'static_key_slow_inc':
>> include/asm-generic/bug.h:92:36: error: implicit declaration of function 'printk' [-Werror=implicit-function-declaration]
#define __WARN_printf(arg...) do { printk(arg); __WARN(); } while (0)
^
include/asm-generic/bug.h:116:3: note: in expansion of macro '__WARN_printf'
__WARN_printf(format); \
^~~~~~~~~~~~~
>> include/linux/jump_label.h:84:32: note: in expansion of macro 'WARN'
#define STATIC_KEY_CHECK_USE() WARN(!static_key_initialized, \
^~~~
>> include/linux/jump_label.h:212:2: note: in expansion of macro 'STATIC_KEY_CHECK_USE'
STATIC_KEY_CHECK_USE();
^~~~~~~~~~~~~~~~~~~~
In file included from include/linux/bug.h:4:0,
from include/linux/jump_label.h:184,
from arch/x86/include/asm/string_64.h:5,
from arch/x86/include/asm/string.h:4,
from include/linux/string.h:18,
from include/uapi/linux/uuid.h:21,
from include/linux/uuid.h:19,
from include/linux/mod_devicetable.h:12,
from scripts/mod/devicetable-offsets.c:2:
>> include/asm-generic/bug.h:91:32: error: 'TAINT_WARN' undeclared (first use in this function)
#define __WARN() __WARN_TAINT(TAINT_WARN)
^
arch/x86/include/asm/bug.h:46:10: note: in definition of macro '_BUG_FLAGS'
"i" (flags), \
^~~~~
>> include/asm-generic/bug.h:60:30: note: in expansion of macro '__WARN_FLAGS'
#define __WARN_TAINT(taint) __WARN_FLAGS(BUGFLAG_TAINT(taint))
^~~~~~~~~~~~
>> include/asm-generic/bug.h:60:43: note: in expansion of macro 'BUGFLAG_TAINT'
#define __WARN_TAINT(taint) __WARN_FLAGS(BUGFLAG_TAINT(taint))
^~~~~~~~~~~~~
>> include/asm-generic/bug.h:91:19: note: in expansion of macro '__WARN_TAINT'
#define __WARN() __WARN_TAINT(TAINT_WARN)
^~~~~~~~~~~~
>> include/asm-generic/bug.h:92:49: note: in expansion of macro '__WARN'
#define __WARN_printf(arg...) do { printk(arg); __WARN(); } while (0)
^~~~~~
include/asm-generic/bug.h:116:3: note: in expansion of macro '__WARN_printf'
__WARN_printf(format); \
^~~~~~~~~~~~~
>> include/linux/jump_label.h:84:32: note: in expansion of macro 'WARN'
#define STATIC_KEY_CHECK_USE() WARN(!static_key_initialized, \
^~~~
>> include/linux/jump_label.h:212:2: note: in expansion of macro 'STATIC_KEY_CHECK_USE'
STATIC_KEY_CHECK_USE();
^~~~~~~~~~~~~~~~~~~~
include/asm-generic/bug.h:91:32: note: each undeclared identifier is reported only once for each function it appears in
#define __WARN() __WARN_TAINT(TAINT_WARN)
^
arch/x86/include/asm/bug.h:46:10: note: in definition of macro '_BUG_FLAGS'
"i" (flags), \
^~~~~
>> include/asm-generic/bug.h:60:30: note: in expansion of macro '__WARN_FLAGS'
#define __WARN_TAINT(taint) __WARN_FLAGS(BUGFLAG_TAINT(taint))
^~~~~~~~~~~~
>> include/asm-generic/bug.h:60:43: note: in expansion of macro 'BUGFLAG_TAINT'
#define __WARN_TAINT(taint) __WARN_FLAGS(BUGFLAG_TAINT(taint))
^~~~~~~~~~~~~
>> include/asm-generic/bug.h:91:19: note: in expansion of macro '__WARN_TAINT'
#define __WARN() __WARN_TAINT(TAINT_WARN)
^~~~~~~~~~~~
>> include/asm-generic/bug.h:92:49: note: in expansion of macro '__WARN'
#define __WARN_printf(arg...) do { printk(arg); __WARN(); } while (0)
^~~~~~
include/asm-generic/bug.h:116:3: note: in expansion of macro '__WARN_printf'
__WARN_printf(format); \
^~~~~~~~~~~~~
>> include/linux/jump_label.h:84:32: note: in expansion of macro 'WARN'
#define STATIC_KEY_CHECK_USE() WARN(!static_key_initialized, \
^~~~
>> include/linux/jump_label.h:212:2: note: in expansion of macro 'STATIC_KEY_CHECK_USE'
STATIC_KEY_CHECK_USE();
^~~~~~~~~~~~~~~~~~~~
include/linux/jump_label.h: In function 'static_key_slow_dec':
>> include/asm-generic/bug.h:91:32: error: 'TAINT_WARN' undeclared (first use in this function)
#define __WARN() __WARN_TAINT(TAINT_WARN)
^
arch/x86/include/asm/bug.h:46:10: note: in definition of macro '_BUG_FLAGS'
"i" (flags), \
^~~~~
>> include/asm-generic/bug.h:60:30: note: in expansion of macro '__WARN_FLAGS'
#define __WARN_TAINT(taint) __WARN_FLAGS(BUGFLAG_TAINT(taint))
^~~~~~~~~~~~
>> include/asm-generic/bug.h:60:43: note: in expansion of macro 'BUGFLAG_TAINT'
#define __WARN_TAINT(taint) __WARN_FLAGS(BUGFLAG_TAINT(taint))
^~~~~~~~~~~~~
--
In file included from arch/x86/include/asm/bug.h:81:0,
from include/linux/bug.h:4,
from include/linux/page-flags.h:9,
from kernel/bounds.c:9:
>> include/asm-generic/bug.h:101:13: warning: 'struct pt_regs' declared inside parameter list will not be visible outside of this definition or declaration
struct pt_regs *regs, struct warn_args *args);
^~~~~~~

vim +/printk +92 include/asm-generic/bug.h

^1da177e4 Linus Torvalds 2005-04-16 54
^1da177e4 Linus Torvalds 2005-04-16 55 #ifndef HAVE_ARCH_BUG_ON
2a41de48b Alexey Dobriyan 2007-07-17 56 #define BUG_ON(condition) do { if (unlikely(condition)) BUG(); } while (0)
^1da177e4 Linus Torvalds 2005-04-16 57 #endif
^1da177e4 Linus Torvalds 2005-04-16 58
19d436268 Peter Zijlstra 2017-02-25 59 #ifdef __WARN_FLAGS
19d436268 Peter Zijlstra 2017-02-25 @60 #define __WARN_TAINT(taint) __WARN_FLAGS(BUGFLAG_TAINT(taint))
19d436268 Peter Zijlstra 2017-02-25 @61 #define __WARN_ONCE_TAINT(taint) __WARN_FLAGS(BUGFLAG_ONCE|BUGFLAG_TAINT(taint))
19d436268 Peter Zijlstra 2017-02-25 62
19d436268 Peter Zijlstra 2017-02-25 63 #define WARN_ON_ONCE(condition) ({ \
19d436268 Peter Zijlstra 2017-02-25 64 int __ret_warn_on = !!(condition); \
19d436268 Peter Zijlstra 2017-02-25 65 if (unlikely(__ret_warn_on)) \
19d436268 Peter Zijlstra 2017-02-25 @66 __WARN_ONCE_TAINT(TAINT_WARN); \
19d436268 Peter Zijlstra 2017-02-25 67 unlikely(__ret_warn_on); \
19d436268 Peter Zijlstra 2017-02-25 68 })
19d436268 Peter Zijlstra 2017-02-25 69 #endif
19d436268 Peter Zijlstra 2017-02-25 70
af9379c71 David Brownell 2009-01-06 71 /*
af9379c71 David Brownell 2009-01-06 72 * WARN(), WARN_ON(), WARN_ON_ONCE, and so on can be used to report
af9379c71 David Brownell 2009-01-06 73 * significant issues that need prompt attention if they should ever
af9379c71 David Brownell 2009-01-06 74 * appear at runtime. Use the versions with printk format strings
af9379c71 David Brownell 2009-01-06 75 * to provide better diagnostics.
af9379c71 David Brownell 2009-01-06 76 */
b2be05273 Ben Hutchings 2010-04-03 77 #ifndef __WARN_TAINT
b9075fa96 Joe Perches 2011-10-31 78 extern __printf(3, 4)
b9075fa96 Joe Perches 2011-10-31 79 void warn_slowpath_fmt(const char *file, const int line,
b9075fa96 Joe Perches 2011-10-31 80 const char *fmt, ...);
b9075fa96 Joe Perches 2011-10-31 81 extern __printf(4, 5)
b9075fa96 Joe Perches 2011-10-31 82 void warn_slowpath_fmt_taint(const char *file, const int line, unsigned taint,
b9075fa96 Joe Perches 2011-10-31 83 const char *fmt, ...);
57adc4d2d Andi Kleen 2009-05-06 84 extern void warn_slowpath_null(const char *file, const int line);
79b4cc5ee Arjan van de Ven 2008-01-30 85 #define WANT_WARN_ON_SLOWPATH
57adc4d2d Andi Kleen 2009-05-06 86 #define __WARN() warn_slowpath_null(__FILE__, __LINE__)
57adc4d2d Andi Kleen 2009-05-06 87 #define __WARN_printf(arg...) warn_slowpath_fmt(__FILE__, __LINE__, arg)
b2be05273 Ben Hutchings 2010-04-03 88 #define __WARN_printf_taint(taint, arg...) \
b2be05273 Ben Hutchings 2010-04-03 89 warn_slowpath_fmt_taint(__FILE__, __LINE__, taint, arg)
a8f18b909 Arjan van de Ven 2008-07-25 90 #else
b2be05273 Ben Hutchings 2010-04-03 @91 #define __WARN() __WARN_TAINT(TAINT_WARN)
f6f286f33 Arjan van de Ven 2008-10-20 @92 #define __WARN_printf(arg...) do { printk(arg); __WARN(); } while (0)
b2be05273 Ben Hutchings 2010-04-03 93 #define __WARN_printf_taint(taint, arg...) \
b2be05273 Ben Hutchings 2010-04-03 94 do { printk(arg); __WARN_TAINT(taint); } while (0)
3a6a62f96 Olof Johansson 2008-01-30 95 #endif
3a6a62f96 Olof Johansson 2008-01-30 96
2553b67a1 Josh Poimboeuf 2016-03-17 97 /* used internally by panic.c */
2553b67a1 Josh Poimboeuf 2016-03-17 98 struct warn_args;
2553b67a1 Josh Poimboeuf 2016-03-17 99
2553b67a1 Josh Poimboeuf 2016-03-17 100 void __warn(const char *file, int line, void *caller, unsigned taint,
2553b67a1 Josh Poimboeuf 2016-03-17 @101 struct pt_regs *regs, struct warn_args *args);
2553b67a1 Josh Poimboeuf 2016-03-17 102
3a6a62f96 Olof Johansson 2008-01-30 103 #ifndef WARN_ON
3a6a62f96 Olof Johansson 2008-01-30 104 #define WARN_ON(condition) ({ \

:::::: The code at line 92 was first introduced by commit
:::::: f6f286f33e843862c559bfea9281318c4cdec6b0 fix WARN() for PPC

:::::: TO: Arjan van de Ven <arjan@xxxxxxxxxxxxxxx>
:::::: CC: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

Attachment: .config.gz
Description: application/gzip