Re: [PATCH] err.h: add type checking to IS_ERR_VALUE macro

From: kbuild test robot
Date: Fri Dec 18 2015 - 06:10:19 EST


Hi Andrzej,

[auto build test ERROR on v4.4-rc5]
[also build test ERROR on next-20151217]

url: https://github.com/0day-ci/linux/commits/Andrzej-Hajda/err-h-add-type-checking-to-IS_ERR_VALUE-macro/20151218-185839
config: i386-tinyconfig (attached as .config)
reproduce:
# save the attached .config to linux build tree
make ARCH=i386

All errors (new ones prefixed by >>):

include/linux/bug.h: Assembler messages:
>> include/linux/bug.h:7: Error: no such instruction: `enum bug_trap_type {'
>> include/linux/bug.h:8: Error: junk at end of line, first unrecognized character is `,'
include/linux/bug.h:9: Error: junk at end of line, first unrecognized character is `,'
include/linux/bug.h:10: Error: junk at end of line, first unrecognized character is `,'
include/linux/bug.h:11: Error: junk at end of line, first unrecognized character is `}'
>> include/linux/bug.h:13: Error: no such instruction: `struct pt_regs'
>> include/linux/bug.h:105: Error: no such instruction: `static inline enum bug_trap_type report_bug(unsigned long bug_addr,'
>> include/linux/bug.h:106: Error: no such instruction: `struct pt_regs *regs)'
include/linux/bug.h:107: Error: junk at end of line, first unrecognized character is `{'
>> include/linux/bug.h:108: Error: no such instruction: `return BUG_TRAP_TYPE_BUG'
include/linux/bug.h:109: Error: junk at end of line, first unrecognized character is `}'

vim +7 include/linux/bug.h

7664c5a1d Jeremy Fitzhardinge 2006-12-08 1 #ifndef _LINUX_BUG_H
7664c5a1d Jeremy Fitzhardinge 2006-12-08 2 #define _LINUX_BUG_H
7664c5a1d Jeremy Fitzhardinge 2006-12-08 3
7664c5a1d Jeremy Fitzhardinge 2006-12-08 4 #include <asm/bug.h>
a3ccc497c Daniel Santos 2013-02-21 5 #include <linux/compiler.h>
7664c5a1d Jeremy Fitzhardinge 2006-12-08 6
7664c5a1d Jeremy Fitzhardinge 2006-12-08 @7 enum bug_trap_type {
7664c5a1d Jeremy Fitzhardinge 2006-12-08 @8 BUG_TRAP_TYPE_NONE = 0,
7664c5a1d Jeremy Fitzhardinge 2006-12-08 9 BUG_TRAP_TYPE_WARN = 1,
7664c5a1d Jeremy Fitzhardinge 2006-12-08 10 BUG_TRAP_TYPE_BUG = 2,
7664c5a1d Jeremy Fitzhardinge 2006-12-08 11 };
7664c5a1d Jeremy Fitzhardinge 2006-12-08 12
608e26196 Heiko Carstens 2007-07-15 @13 struct pt_regs;
608e26196 Heiko Carstens 2007-07-15 14
35edd9103 Paul Gortmaker 2011-11-16 15 #ifdef __CHECKER__
ca623c914 Daniel Santos 2013-02-21 16 #define BUILD_BUG_ON_NOT_POWER_OF_2(n) (0)
35edd9103 Paul Gortmaker 2011-11-16 17 #define BUILD_BUG_ON_ZERO(e) (0)
35edd9103 Paul Gortmaker 2011-11-16 18 #define BUILD_BUG_ON_NULL(e) ((void*)0)
c5782e9f5 Tushar Behera 2012-11-26 19 #define BUILD_BUG_ON_INVALID(e) (0)
9a8ab1c39 Daniel Santos 2013-02-21 20 #define BUILD_BUG_ON_MSG(cond, msg) (0)
ca623c914 Daniel Santos 2013-02-21 21 #define BUILD_BUG_ON(condition) (0)
35edd9103 Paul Gortmaker 2011-11-16 22 #define BUILD_BUG() (0)
35edd9103 Paul Gortmaker 2011-11-16 23 #else /* __CHECKER__ */
35edd9103 Paul Gortmaker 2011-11-16 24
35edd9103 Paul Gortmaker 2011-11-16 25 /* Force a compilation error if a constant expression is not a power of 2 */
35edd9103 Paul Gortmaker 2011-11-16 26 #define BUILD_BUG_ON_NOT_POWER_OF_2(n) \
35edd9103 Paul Gortmaker 2011-11-16 27 BUILD_BUG_ON((n) == 0 || (((n) & ((n) - 1)) != 0))
35edd9103 Paul Gortmaker 2011-11-16 28
35edd9103 Paul Gortmaker 2011-11-16 29 /* Force a compilation error if condition is true, but also produce a
35edd9103 Paul Gortmaker 2011-11-16 30 result (of value 0 and type size_t), so the expression can be used
35edd9103 Paul Gortmaker 2011-11-16 31 e.g. in a structure initializer (or where-ever else comma expressions
35edd9103 Paul Gortmaker 2011-11-16 32 aren't permitted). */
35edd9103 Paul Gortmaker 2011-11-16 33 #define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); }))
35edd9103 Paul Gortmaker 2011-11-16 34 #define BUILD_BUG_ON_NULL(e) ((void *)sizeof(struct { int:-!!(e); }))
35edd9103 Paul Gortmaker 2011-11-16 35
baf05aa92 Konstantin Khlebnikov 2012-05-29 36 /*
baf05aa92 Konstantin Khlebnikov 2012-05-29 37 * BUILD_BUG_ON_INVALID() permits the compiler to check the validity of the
baf05aa92 Konstantin Khlebnikov 2012-05-29 38 * expression but avoids the generation of any code, even if that expression
baf05aa92 Konstantin Khlebnikov 2012-05-29 39 * has side-effects.
baf05aa92 Konstantin Khlebnikov 2012-05-29 40 */
baf05aa92 Konstantin Khlebnikov 2012-05-29 41 #define BUILD_BUG_ON_INVALID(e) ((void)(sizeof((__force long)(e))))
baf05aa92 Konstantin Khlebnikov 2012-05-29 42
35edd9103 Paul Gortmaker 2011-11-16 43 /**
9a8ab1c39 Daniel Santos 2013-02-21 44 * BUILD_BUG_ON_MSG - break compile if a condition is true & emit supplied
9a8ab1c39 Daniel Santos 2013-02-21 45 * error message.
9a8ab1c39 Daniel Santos 2013-02-21 46 * @condition: the condition which the compiler should know is false.
9a8ab1c39 Daniel Santos 2013-02-21 47 *
9a8ab1c39 Daniel Santos 2013-02-21 48 * See BUILD_BUG_ON for description.
9a8ab1c39 Daniel Santos 2013-02-21 49 */
9a8ab1c39 Daniel Santos 2013-02-21 50 #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
9a8ab1c39 Daniel Santos 2013-02-21 51
9a8ab1c39 Daniel Santos 2013-02-21 52 /**
35edd9103 Paul Gortmaker 2011-11-16 53 * BUILD_BUG_ON - break compile if a condition is true.
35edd9103 Paul Gortmaker 2011-11-16 54 * @condition: the condition which the compiler should know is false.
35edd9103 Paul Gortmaker 2011-11-16 55 *
35edd9103 Paul Gortmaker 2011-11-16 56 * If you have some code which relies on certain constants being equal, or
a3ccc497c Daniel Santos 2013-02-21 57 * some other compile-time-evaluated condition, you should use BUILD_BUG_ON to
35edd9103 Paul Gortmaker 2011-11-16 58 * detect if someone changes it.
35edd9103 Paul Gortmaker 2011-11-16 59 *
a3ccc497c Daniel Santos 2013-02-21 60 * The implementation uses gcc's reluctance to create a negative array, but gcc
a3ccc497c Daniel Santos 2013-02-21 61 * (as of 4.4) only emits that error for obvious cases (e.g. not arguments to
a3ccc497c Daniel Santos 2013-02-21 62 * inline functions). Luckily, in 4.3 they added the "error" function
a3ccc497c Daniel Santos 2013-02-21 63 * attribute just for this type of case. Thus, we use a negative sized array
a3ccc497c Daniel Santos 2013-02-21 64 * (should always create an error on gcc versions older than 4.4) and then call
a3ccc497c Daniel Santos 2013-02-21 65 * an undefined function with the error attribute (should always create an
a3ccc497c Daniel Santos 2013-02-21 66 * error on gcc 4.3 and later). If for some reason, neither creates a
a3ccc497c Daniel Santos 2013-02-21 67 * compile-time error, we'll still have a link-time error, which is harder to
a3ccc497c Daniel Santos 2013-02-21 68 * track down.
35edd9103 Paul Gortmaker 2011-11-16 69 */
35edd9103 Paul Gortmaker 2011-11-16 70 #ifndef __OPTIMIZE__
35edd9103 Paul Gortmaker 2011-11-16 71 #define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
35edd9103 Paul Gortmaker 2011-11-16 72 #else
35edd9103 Paul Gortmaker 2011-11-16 73 #define BUILD_BUG_ON(condition) \
9a8ab1c39 Daniel Santos 2013-02-21 74 BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
35edd9103 Paul Gortmaker 2011-11-16 75 #endif
35edd9103 Paul Gortmaker 2011-11-16 76
35edd9103 Paul Gortmaker 2011-11-16 77 /**
35edd9103 Paul Gortmaker 2011-11-16 78 * BUILD_BUG - break compile if used.
35edd9103 Paul Gortmaker 2011-11-16 79 *
35edd9103 Paul Gortmaker 2011-11-16 80 * If you have some code that you expect the compiler to eliminate at
35edd9103 Paul Gortmaker 2011-11-16 81 * build time, you should use BUILD_BUG to detect if it is
35edd9103 Paul Gortmaker 2011-11-16 82 * unexpectedly used.
35edd9103 Paul Gortmaker 2011-11-16 83 */
9a8ab1c39 Daniel Santos 2013-02-21 84 #define BUILD_BUG() BUILD_BUG_ON_MSG(1, "BUILD_BUG failed")
35edd9103 Paul Gortmaker 2011-11-16 85
35edd9103 Paul Gortmaker 2011-11-16 86 #endif /* __CHECKER__ */
35edd9103 Paul Gortmaker 2011-11-16 87
7664c5a1d Jeremy Fitzhardinge 2006-12-08 88 #ifdef CONFIG_GENERIC_BUG
7664c5a1d Jeremy Fitzhardinge 2006-12-08 89 #include <asm-generic/bug.h>
7664c5a1d Jeremy Fitzhardinge 2006-12-08 90
7664c5a1d Jeremy Fitzhardinge 2006-12-08 91 static inline int is_warning_bug(const struct bug_entry *bug)
7664c5a1d Jeremy Fitzhardinge 2006-12-08 92 {
7664c5a1d Jeremy Fitzhardinge 2006-12-08 93 return bug->flags & BUGFLAG_WARNING;
7664c5a1d Jeremy Fitzhardinge 2006-12-08 94 }
7664c5a1d Jeremy Fitzhardinge 2006-12-08 95
7664c5a1d Jeremy Fitzhardinge 2006-12-08 96 const struct bug_entry *find_bug(unsigned long bugaddr);
7664c5a1d Jeremy Fitzhardinge 2006-12-08 97
608e26196 Heiko Carstens 2007-07-15 98 enum bug_trap_type report_bug(unsigned long bug_addr, struct pt_regs *regs);
7664c5a1d Jeremy Fitzhardinge 2006-12-08 99
7664c5a1d Jeremy Fitzhardinge 2006-12-08 100 /* These are defined by the architecture */
7664c5a1d Jeremy Fitzhardinge 2006-12-08 101 int is_valid_bugaddr(unsigned long addr);
7664c5a1d Jeremy Fitzhardinge 2006-12-08 102
7664c5a1d Jeremy Fitzhardinge 2006-12-08 103 #else /* !CONFIG_GENERIC_BUG */
7664c5a1d Jeremy Fitzhardinge 2006-12-08 104
608e26196 Heiko Carstens 2007-07-15 @105 static inline enum bug_trap_type report_bug(unsigned long bug_addr,
608e26196 Heiko Carstens 2007-07-15 @106 struct pt_regs *regs)
7664c5a1d Jeremy Fitzhardinge 2006-12-08 107 {
7664c5a1d Jeremy Fitzhardinge 2006-12-08 @108 return BUG_TRAP_TYPE_BUG;
7664c5a1d Jeremy Fitzhardinge 2006-12-08 109 }
7664c5a1d Jeremy Fitzhardinge 2006-12-08 110
7664c5a1d Jeremy Fitzhardinge 2006-12-08 111 #endif /* CONFIG_GENERIC_BUG */

:::::: The code at line 7 was first introduced by commit
:::::: 7664c5a1da4711bb6383117f51b94c8dc8f3f1cd [PATCH] Generic BUG implementation

:::::: TO: Jeremy Fitzhardinge <jeremy@xxxxxxxx>
:::::: CC: Linus Torvalds <torvalds@xxxxxxxxxxxxxx>

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

Attachment: .config.gz
Description: Binary data