Re: [PATCH 41/45] C++: Cast in bitops

kbuild test robot
2018-04-02T06:11:26Z

[-- Attachment #1: Type: text/plain, Size: 26084 bytes --]

Hi David,

I love your patch! Yet something to improve:

[auto build test ERROR on v4.16-rc7]
[cannot apply to linus/master tip/x86/core tip/locking/core v4.16 next-20180329]
[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/David-Howells/C-Convert-the-kernel-to-C/20180402-120344
config: x86_64-randconfig-x016-201813 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64

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

include/linux/printk.h:183:12: error: storage class specified for parameter '__printk_ratelimit'
extern int __printk_ratelimit(const char *func);
^~~~~~~~~~~~~~~~~~
include/linux/printk.h:185:8: error: unknown type name 'bool'
extern bool printk_timed_ratelimit(unsigned long *caller_jiffies,
^~~~
include/linux/printk.h:185:13: error: storage class specified for parameter 'printk_timed_ratelimit'
extern bool printk_timed_ratelimit(unsigned long *caller_jiffies,
^~~~~~~~~~~~~~~~~~~~~~
include/linux/printk.h:188:12: error: storage class specified for parameter 'printk_delay_msec'
extern int printk_delay_msec;
^~~~~~~~~~~~~~~~~
include/linux/printk.h:189:12: error: storage class specified for parameter 'dmesg_restrict'
extern int dmesg_restrict;
^~~~~~~~~~~~~~
include/linux/printk.h:193:6: error: expected declaration specifiers or '...' before 'size_t'
size_t *lenp, loff_t *ppos);
^~~~~~
include/linux/printk.h:193:20: error: unknown type name 'loff_t'; did you mean 'pgoff_t'?
size_t *lenp, loff_t *ppos);
^~~~~~
pgoff_t
include/linux/printk.h:195:13: error: storage class specified for parameter 'wake_up_klogd'
extern void wake_up_klogd(void);
^~~~~~~~~~~~~
include/linux/printk.h:200:13: error: section attribute not allowed for 'setup_log_buf'
void __init setup_log_buf(int early);
^~~~~~~~~~~~~
include/linux/printk.h:200:1: warning: '__cold__' attribute ignored [-Wattributes]
void __init setup_log_buf(int early);
^~~~
In file included from include/linux/compiler_types.h:58:0,
from include/linux/kconfig.h:74,
from <command-line>:0:
include/linux/compiler-gcc.h:130:25: error: expected declaration specifiers before '__attribute__'
#define __printf(a, b) __attribute__((format(printf, a, b)))
^
include/linux/printk.h:201:1: note: in expansion of macro '__printf'
__printf(1, 2) void dump_stack_set_arch_desc(const char *fmt, ...);
^~~~~~~~
In file included from include/linux/kernel.h:15:0,
from include/asm-generic/bug.h:18,
from arch/x86/include/asm/bug.h:83,
from include/linux/bug.h:5,
from include/linux/page-flags.h:10,
from kernel/bounds.c:10:
include/linux/printk.h:204:13: error: storage class specified for parameter 'printk_safe_init'
extern void printk_safe_init(void);
^~~~~~~~~~~~~~~~
include/linux/printk.h:205:13: error: storage class specified for parameter 'printk_safe_flush'
extern void printk_safe_flush(void);
^~~~~~~~~~~~~~~~~
include/linux/printk.h:206:13: error: storage class specified for parameter 'printk_safe_flush_on_panic'
extern void printk_safe_flush_on_panic(void);
^~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/printk.h:280:12: error: storage class specified for parameter 'kptr_restrict'
extern int kptr_restrict;
^~~~~~~~~~~~~
include/linux/printk.h:282:1: warning: '__cold__' attribute ignored [-Wattributes]
asmlinkage void dump_stack(void) __cold;
^~~~~~~~~~
include/linux/printk.h:474:37: error: storage class specified for parameter 'kmsg_fops'
extern const struct file_operations kmsg_fops;
^~~~~~~~~
include/linux/printk.h:476:1: warning: empty declaration
enum {
^~~~
include/linux/printk.h:481:48: error: expected declaration specifiers or '...' before 'size_t'
extern int hex_dump_to_buffer(const void *buf, size_t len, int rowsize,
^~~~~~
include/linux/printk.h:482:40: error: expected declaration specifiers or '...' before 'size_t'
int groupsize, char *linebuf, size_t linebuflen,
^~~~~~
include/linux/printk.h:483:10: error: unknown type name 'bool'; did you mean '_Bool'?
bool ascii);
^~~~
_Bool
include/linux/printk.h:487:24: error: expected declaration specifiers or '...' before 'size_t'
const void *buf, size_t len, bool ascii);
^~~~~~
include/linux/printk.h:487:36: error: unknown type name 'bool'; did you mean '_Bool'?
const void *buf, size_t len, bool ascii);
^~~~
_Bool
include/linux/printk.h:493:23: error: expected declaration specifiers or '...' before 'size_t'
const void *buf, size_t len);
^~~~~~
include/linux/printk.h:521:23: error: expected declaration specifiers or '...' before 'size_t'
const void *buf, size_t len, bool ascii)
^~~~~~
include/linux/printk.h:521:35: error: unknown type name 'bool'; did you mean '_Bool'?
const void *buf, size_t len, bool ascii)
^~~~
_Bool
In file included from include/linux/kernel.h:16:0,
from include/asm-generic/bug.h:18,
from arch/x86/include/asm/bug.h:83,
from include/linux/bug.h:5,
from include/linux/page-flags.h:10,
from kernel/bounds.c:10:
>> include/linux/build_bug.h:23:12: error: storage class specified for parameter '__build_bug_on_zero'
extern int __build_bug_on_zero(void)
^~~~~~~~~~~~~~~~~~~
>> include/linux/build_bug.h:24:2: warning: 'error' attribute ignored [-Wattributes]
__compiletime_error("Build bug on zero");
^~~~~~~~~~~~~~~~~~~
In file included from include/asm-generic/bug.h:18:0,
from arch/x86/include/asm/bug.h:83,
from include/linux/bug.h:5,
from include/linux/page-flags.h:10,
from kernel/bounds.c:10:
include/linux/kernel.h:203:1: warning: empty declaration
struct completion;
^~~~~~
include/linux/kernel.h:204:1: warning: empty declaration
struct pt_regs;
^~~~~~
include/linux/kernel.h:205:1: warning: empty declaration
struct user;
^~~~~~
include/linux/kernel.h:249:1: error: expected declaration specifiers before 'template'
template<typename T>
^~~~~~~~
include/linux/kernel.h:270:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
{
^
include/linux/kernel.h:282:36: error: storage class specified for parameter 'panic_notifier_list'
extern struct atomic_notifier_head panic_notifier_list;
^~~~~~~~~~~~~~~~~~~
include/linux/kernel.h:283:15: error: storage class specified for parameter 'panic_blink'
extern long (*panic_blink)(int state);
^~~~~~~~~~~
In file included from include/linux/compiler_types.h:58:0,
from include/linux/kconfig.h:74,
from <command-line>:0:
include/linux/compiler-gcc.h:130:25: error: expected declaration specifiers before '__attribute__'
#define __printf(a, b) __attribute__((format(printf, a, b)))
^
include/linux/kernel.h:284:1: note: in expansion of macro '__printf'
__printf(1, 2)
^~~~~~~~
In file included from include/asm-generic/bug.h:18:0,
from arch/x86/include/asm/bug.h:83,
from include/linux/bug.h:5,
from include/linux/page-flags.h:10,
from kernel/bounds.c:10:
include/linux/kernel.h:287:13: error: storage class specified for parameter 'oops_enter'
extern void oops_enter(void);
^~~~~~~~~~
include/linux/kernel.h:288:13: error: storage class specified for parameter 'oops_exit'
extern void oops_exit(void);
^~~~~~~~~
include/linux/kernel.h:290:12: error: storage class specified for parameter 'oops_may_print'
extern int oops_may_print(void);
^~~~~~~~~~~~~~
include/linux/kernel.h:325:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
{
^
include/linux/kernel.h:354:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
{
^
include/linux/kernel.h:370:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
{
^
include/linux/kernel.h:375:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
{
^
include/linux/kernel.h:380:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
{
^
include/linux/kernel.h:385:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
{
^
include/linux/kernel.h:393:44: error: unknown type name 'bool'; did you mean '_Bool'?
int __must_check kstrtobool(const char *s, bool *res);
^~~~
_Bool
include/linux/kernel.h:395:60: error: expected declaration specifiers or '...' before 'size_t'
int __must_check kstrtoull_from_user(const char __user *s, size_t count, unsigned int base, unsigned long long *res);
^~~~~~
include/linux/kernel.h:396:59: error: expected declaration specifiers or '...' before 'size_t'
int __must_check kstrtoll_from_user(const char __user *s, size_t count, unsigned int base, long long *res);
^~~~~~
include/linux/kernel.h:397:59: error: expected declaration specifiers or '...' before 'size_t'
int __must_check kstrtoul_from_user(const char __user *s, size_t count, unsigned int base, unsigned long *res);
^~~~~~
include/linux/kernel.h:398:58: error: expected declaration specifiers or '...' before 'size_t'
int __must_check kstrtol_from_user(const char __user *s, size_t count, unsigned int base, long *res);
^~~~~~
include/linux/kernel.h:399:61: error: expected declaration specifiers or '...' before 'size_t'
int __must_check kstrtouint_from_user(const char __user *s, size_t count, unsigned int base, unsigned int *res);
^~~~~~
include/linux/kernel.h:400:60: error: expected declaration specifiers or '...' before 'size_t'
int __must_check kstrtoint_from_user(const char __user *s, size_t count, unsigned int base, int *res);
^~~~~~
include/linux/kernel.h:401:60: error: expected declaration specifiers or '...' before 'size_t'
int __must_check kstrtou16_from_user(const char __user *s, size_t count, unsigned int base, u16 *res);
^~~~~~
include/linux/kernel.h:402:60: error: expected declaration specifiers or '...' before 'size_t'
int __must_check kstrtos16_from_user(const char __user *s, size_t count, unsigned int base, s16 *res);
^~~~~~
include/linux/kernel.h:403:59: error: expected declaration specifiers or '...' before 'size_t'
int __must_check kstrtou8_from_user(const char __user *s, size_t count, unsigned int base, u8 *res);
^~~~~~
--
include/linux/kernel.h:460:12: error: declaration for parameter 'get_option' but no such parameter
extern int get_option(char **str, int *pint);
^~~~~~~~~~
include/linux/kernel.h:456:5: error: declaration for parameter 'sscanf' but no such parameter
int sscanf(const char *, const char *, ...);
^~~~~~
include/linux/kernel.h:438:27: error: declaration for parameter 'sprintf' but no such parameter
extern __printf(2, 3) int sprintf(char *buf, const char * fmt, ...);
^~~~~~~
include/linux/kernel.h:434:12: error: declaration for parameter 'num_to_str' but no such parameter
extern int num_to_str(char *buf, int size, unsigned long long num);
^~~~~~~~~~
include/linux/kernel.h:432:18: error: declaration for parameter 'simple_strtoll' but no such parameter
extern long long simple_strtoll(const char *,char **,unsigned int);
^~~~~~~~~~~~~~
include/linux/kernel.h:431:27: error: declaration for parameter 'simple_strtoull' but no such parameter
extern unsigned long long simple_strtoull(const char *,char **,unsigned int);
^~~~~~~~~~~~~~~
include/linux/kernel.h:430:13: error: declaration for parameter 'simple_strtol' but no such parameter
extern long simple_strtol(const char *,char **,unsigned int);
^~~~~~~~~~~~~
include/linux/kernel.h:429:22: error: declaration for parameter 'simple_strtoul' but no such parameter
extern unsigned long simple_strtoul(const char *,char **,unsigned int);
^~~~~~~~~~~~~~
include/linux/kernel.h:392:18: error: declaration for parameter 'kstrtos8' but no such parameter
int __must_check kstrtos8(const char *s, unsigned int base, s8 *res);
^~~~~~~~
include/linux/kernel.h:391:18: error: declaration for parameter 'kstrtou8' but no such parameter
int __must_check kstrtou8(const char *s, unsigned int base, u8 *res);
^~~~~~~~
include/linux/kernel.h:390:18: error: declaration for parameter 'kstrtos16' but no such parameter
int __must_check kstrtos16(const char *s, unsigned int base, s16 *res);
^~~~~~~~~
include/linux/kernel.h:389:18: error: declaration for parameter 'kstrtou16' but no such parameter
int __must_check kstrtou16(const char *s, unsigned int base, u16 *res);
^~~~~~~~~
include/linux/kernel.h:367:18: error: declaration for parameter 'kstrtoint' but no such parameter
int __must_check kstrtoint(const char *s, unsigned int base, int *res);
^~~~~~~~~
include/linux/kernel.h:366:18: error: declaration for parameter 'kstrtouint' but no such parameter
int __must_check kstrtouint(const char *s, unsigned int base, unsigned int *res);
^~~~~~~~~~
include/linux/kernel.h:306:18: error: declaration for parameter 'kstrtoll' but no such parameter
int __must_check kstrtoll(const char *s, unsigned int base, long long *res);
^~~~~~~~
include/linux/kernel.h:305:18: error: declaration for parameter 'kstrtoull' but no such parameter
int __must_check kstrtoull(const char *s, unsigned int base, unsigned long long *res);
^~~~~~~~~
include/linux/kernel.h:303:18: error: declaration for parameter '_kstrtol' but no such parameter
int __must_check _kstrtol(const char *s, unsigned int base, long *res);
^~~~~~~~
include/linux/kernel.h:302:18: error: declaration for parameter '_kstrtoul' but no such parameter
int __must_check _kstrtoul(const char *s, unsigned int base, unsigned long *res);
^~~~~~~~~
include/linux/kernel.h:295:6: error: declaration for parameter 'refcount_error_report' but no such parameter
void refcount_error_report(struct pt_regs *regs, const char *err);
^~~~~~~~~~~~~~~~~~~~~
include/linux/kernel.h:292:6: error: declaration for parameter 'complete_and_exit' but no such parameter
void complete_and_exit(struct completion *, long) __noreturn;
^~~~~~~~~~~~~~~~~
include/linux/kernel.h:291:6: error: declaration for parameter 'do_exit' but no such parameter
void do_exit(long error_code) __noreturn;
^~~~~~~
include/linux/kernel.h:290:12: error: declaration for parameter 'oops_may_print' but no such parameter
extern int oops_may_print(void);
^~~~~~~~~~~~~~
include/linux/kernel.h:289:6: error: declaration for parameter 'print_oops_end_marker' but no such parameter
void print_oops_end_marker(void);
^~~~~~~~~~~~~~~~~~~~~
include/linux/kernel.h:288:13: error: declaration for parameter 'oops_exit' but no such parameter
extern void oops_exit(void);
^~~~~~~~~
include/linux/kernel.h:287:13: error: declaration for parameter 'oops_enter' but no such parameter
extern void oops_enter(void);
^~~~~~~~~~
include/linux/kernel.h:286:6: error: declaration for parameter 'nmi_panic' but no such parameter
void nmi_panic(struct pt_regs *regs, const char *msg);
^~~~~~~~~
include/linux/kernel.h:283:15: error: declaration for parameter 'panic_blink' but no such parameter
extern long (*panic_blink)(int state);
^~~~~~~~~~~
include/linux/kernel.h:282:36: error: parameter 'panic_notifier_list' has incomplete type
extern struct atomic_notifier_head panic_notifier_list;
^~~~~~~~~~~~~~~~~~~
include/linux/kernel.h:282:36: error: declaration for parameter 'panic_notifier_list' but no such parameter
include/linux/kernel.h:277:6: error: declaration for parameter '__might_fault' but no such parameter
void __might_fault(const char *file, int line);
^~~~~~~~~~~~~
include/linux/kernel.h:216:8: error: declaration for parameter '__might_sleep' but no such parameter
void __might_sleep(const char *file, int line, int preempt_offset);
^~~~~~~~~~~~~
include/linux/kernel.h:215:8: error: declaration for parameter '___might_sleep' but no such parameter
void ___might_sleep(const char *file, int line, int preempt_offset);
^~~~~~~~~~~~~~
In file included from include/linux/kernel.h:16:0,
from include/asm-generic/bug.h:18,
from arch/x86/include/asm/bug.h:83,
from include/linux/bug.h:5,
from include/linux/page-flags.h:10,
from kernel/bounds.c:10:
>> include/linux/build_bug.h:23:12: error: declaration for parameter '__build_bug_on_zero' but no such parameter
extern int __build_bug_on_zero(void)
^~~~~~~~~~~~~~~~~~~
In file included from include/linux/kernel.h:15:0,
from include/asm-generic/bug.h:18,
from arch/x86/include/asm/bug.h:83,
from include/linux/bug.h:5,
from include/linux/page-flags.h:10,
from kernel/bounds.c:10:
include/linux/printk.h:474:37: error: parameter 'kmsg_fops' has incomplete type
extern const struct file_operations kmsg_fops;
^~~~~~~~~
include/linux/printk.h:474:37: error: declaration for parameter 'kmsg_fops' but no such parameter
include/linux/printk.h:282:17: error: declaration for parameter 'dump_stack' but no such parameter
asmlinkage void dump_stack(void) __cold;
^~~~~~~~~~
include/linux/printk.h:280:12: error: declaration for parameter 'kptr_restrict' but no such parameter
extern int kptr_restrict;
^~~~~~~~~~~~~
include/linux/printk.h:206:13: error: declaration for parameter 'printk_safe_flush_on_panic' but no such parameter
extern void printk_safe_flush_on_panic(void);
^~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/printk.h:205:13: error: declaration for parameter 'printk_safe_flush' but no such parameter
extern void printk_safe_flush(void);
^~~~~~~~~~~~~~~~~
include/linux/printk.h:204:13: error: declaration for parameter 'printk_safe_init' but no such parameter
extern void printk_safe_init(void);
^~~~~~~~~~~~~~~~
include/linux/printk.h:203:6: error: declaration for parameter 'show_regs_print_info' but no such parameter
void show_regs_print_info(const char *log_lvl);
^~~~~~~~~~~~~~~~~~~~
include/linux/printk.h:202:6: error: declaration for parameter 'dump_stack_print_info' but no such parameter
void dump_stack_print_info(const char *log_lvl);
^~~~~~~~~~~~~~~~~~~~~
include/linux/printk.h:200:13: error: declaration for parameter 'setup_log_buf' but no such parameter
void __init setup_log_buf(int early);
^~~~~~~~~~~~~
include/linux/printk.h:199:6: error: declaration for parameter 'log_buf_vmcoreinfo_setup' but no such parameter
void log_buf_vmcoreinfo_setup(void);
^~~~~~~~~~~~~~~~~~~~~~~~
include/linux/printk.h:198:5: error: declaration for parameter 'log_buf_len_get' but no such parameter
u32 log_buf_len_get(void);
^~~~~~~~~~~~~~~
include/linux/printk.h:197:7: error: declaration for parameter 'log_buf_addr_get' but no such parameter
char *log_buf_addr_get(void);
^~~~~~~~~~~~~~~~
include/linux/printk.h:195:13: error: declaration for parameter 'wake_up_klogd' but no such parameter
extern void wake_up_klogd(void);
^~~~~~~~~~~~~
include/linux/printk.h:189:12: error: declaration for parameter 'dmesg_restrict' but no such parameter
extern int dmesg_restrict;
^~~~~~~~~~~~~~
include/linux/printk.h:188:12: error: declaration for parameter 'printk_delay_msec' but no such parameter
extern int printk_delay_msec;
^~~~~~~~~~~~~~~~~
include/linux/printk.h:185:13: error: declaration for parameter 'printk_timed_ratelimit' but no such parameter
extern bool printk_timed_ratelimit(unsigned long *caller_jiffies,
^~~~~~~~~~~~~~~~~~~~~~
include/linux/printk.h:183:12: error: declaration for parameter '__printk_ratelimit' but no such parameter
extern int __printk_ratelimit(const char *func);
^~~~~~~~~~~~~~~~~~
include/linux/printk.h:150:13: error: declaration for parameter 'printk_nmi_exit' but no such parameter
extern void printk_nmi_exit(void);
^~~~~~~~~~~~~~~
include/linux/printk.h:149:13: error: declaration for parameter 'printk_nmi_enter' but no such parameter
extern void printk_nmi_enter(void);
^~~~~~~~~~~~~~~~
include/linux/printk.h:83:13: error: declaration for parameter 'devkmsg_log_str' but no such parameter
extern char devkmsg_log_str[];
^~~~~~~~~~~~~~~
include/linux/printk.h:63:12: error: declaration for parameter 'console_printk' but no such parameter
extern int console_printk[];
^~~~~~~~~~~~~~
include/linux/printk.h:12:19: error: declaration for parameter 'linux_proc_banner' but no such parameter
extern const char linux_proc_banner[];
^~~~~~~~~~~~~~~~~
include/linux/printk.h:11:19: error: declaration for parameter 'linux_banner' but no such parameter
extern const char linux_banner[];
^~~~~~~~~~~~
In file included from include/linux/printk.h:6:0,
from include/linux/kernel.h:15,
from include/asm-generic/bug.h:18,
from arch/x86/include/asm/bug.h:83,
from include/linux/bug.h:5,
from include/linux/page-flags.h:10,
from kernel/bounds.c:10:
include/linux/init.h:269:13: error: declaration for parameter 'parse_early_options' but no such parameter
void __init parse_early_options(char *cmdline);
^~~~~~~~~~~~~~~~~~~
include/linux/init.h:268:13: error: declaration for parameter 'parse_early_param' but no such parameter
void __init parse_early_param(void);
^~~~~~~~~~~~~~~~~
include/linux/init.h:146:13: error: declaration for parameter 'initcall_debug' but no such parameter
extern bool initcall_debug;
^~~~~~~~~~~~~~
include/linux/init.h:144:15: error: declaration for parameter 'late_time_init' but no such parameter
extern void (*late_time_init)(void);
^~~~~~~~~~~~~~
include/linux/init.h:141:6: error: declaration for parameter 'mark_rodata_ro' but no such parameter
void mark_rodata_ro(void);
^~~~~~~~~~~~~~

vim +/__build_bug_on_zero +23 include/linux/build_bug.h

bc6245e5 Ian Abbott 2017-07-10 16
bc6245e5 Ian Abbott 2017-07-10 17 /* Force a compilation error if a constant expression is not a power of 2 */
bc6245e5 Ian Abbott 2017-07-10 18 #define __BUILD_BUG_ON_NOT_POWER_OF_2(n) \
bc6245e5 Ian Abbott 2017-07-10 19 BUILD_BUG_ON(((n) & ((n) - 1)) != 0)
bc6245e5 Ian Abbott 2017-07-10 20 #define BUILD_BUG_ON_NOT_POWER_OF_2(n) \
bc6245e5 Ian Abbott 2017-07-10 21 BUILD_BUG_ON((n) == 0 || (((n) & ((n) - 1)) != 0))
bc6245e5 Ian Abbott 2017-07-10 22
73492728 David Howells 2018-04-01 @23 extern int __build_bug_on_zero(void)
73492728 David Howells 2018-04-01 @24 __compiletime_error("Build bug on zero");
73492728 David Howells 2018-04-01 25

:::::: The code at line 23 was first introduced by commit
:::::: 73492728261d8868947821e21053d51d2a2c1d3f C++: Fix BUILD_BUG_ON_ZERO()

:::::: TO: David Howells <dhowells@redhat.com>
:::::: CC: 0day robot <fengguang.wu@intel.com>

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

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 28314 bytes --]