As of Linux 5.6-rc3, the defconfig still builds with 33 warnings.
Can we get it down to zero by the time 5.6 ships?
zzy
zzy@esquivalience:~/linux-5.6-rc3$ make -j4 KCFLAGS="-Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers" > build_log_5.6-rc3
kernel/time/hrtimer.c:120:21: warning: initialized field overwritten [-Woverride-init]
[CLOCK_REALTIME] = HRTIMER_BASE_REALTIME,
^~~~~~~~~~~~~~~~~~~~~
kernel/time/hrtimer.c:120:21: note: (near initialization for ‘hrtimer_clock_to_base_table[0]’)
kernel/time/hrtimer.c:121:22: warning: initialized field overwritten [-Woverride-init]
[CLOCK_MONOTONIC] = HRTIMER_BASE_MONOTONIC,
^~~~~~~~~~~~~~~~~~~~~~
kernel/time/hrtimer.c:121:22: note: (near initialization for ‘hrtimer_clock_to_base_table[1]’)
kernel/time/hrtimer.c:122:21: warning: initialized field overwritten [-Woverride-init]
[CLOCK_BOOTTIME] = HRTIMER_BASE_BOOTTIME,
^~~~~~~~~~~~~~~~~~~~~
kernel/time/hrtimer.c:122:21: note: (near initialization for ‘hrtimer_clock_to_base_table[7]’)
kernel/time/hrtimer.c:123:17: warning: initialized field overwritten [-Woverride-init]
[CLOCK_TAI] = HRTIMER_BASE_TAI,
^~~~~~~~~~~~~~~~
kernel/time/hrtimer.c:123:17: note: (near initialization for ‘hrtimer_clock_to_base_table[11]’)
In file included from kernel/bpf/core.c:21:
kernel/bpf/core.c: In function ‘___bpf_prog_run’:
./include/linux/filter.h:863:3: warning: cast between incompatible function types from ‘u64 (*)(u64, u64, u64, u64, u64)’ {aka ‘long long unsigned int (*)(long long unsigned int, long long unsigned int, long long unsigned int, long long unsigned int, long long unsigned int)’} to ‘u64 (*)(u64, u64, u64, u64, u64, const struct bpf_insn *)’ {aka ‘long long unsigned int (*)(long long unsigned int, long long unsigned int, long long unsigned int, long long unsigned int, long long unsigned int, const struct bpf_insn *)’} [-Wcast-function-type]
((u64 (*)(u64, u64, u64, u64, u64, const struct bpf_insn *)) \
^
kernel/bpf/core.c:1513:13: note: in expansion of macro ‘__bpf_call_base_args’
BPF_R0 = (__bpf_call_base_args + insn->imm)(BPF_R1, BPF_R2,
^~~~~~~~~~~~~~~~~~~~
kernel/bpf/core.c: In function ‘bpf_patch_call_args’:
./include/linux/filter.h:863:3: warning: cast between incompatible function types from ‘u64 (*)(u64, u64, u64, u64, u64)’ {aka ‘long long unsigned int (*)(long long unsigned int, long long unsigned int, long long unsigned int, long long unsigned int, long long unsigned int)’} to ‘u64 (*)(u64, u64, u64, u64, u64, const struct bpf_insn *)’ {aka ‘long long unsigned int (*)(long long unsigned int, long long unsigned int, long long unsigned int, long long unsigned int, long long unsigned int, const struct bpf_insn *)’} [-Wcast-function-type]
((u64 (*)(u64, u64, u64, u64, u64, const struct bpf_insn *)) \
^
kernel/bpf/core.c:1704:3: note: in expansion of macro ‘__bpf_call_base_args’
__bpf_call_base_args;
^~~~~~~~~~~~~~~~~~~~
kernel/trace/blktrace.c: In function ‘__trace_note_message’:
kernel/trace/blktrace.c:145:63: warning: parameter ‘blkcg’ set but not used [-Wunused-but-set-parameter]
void __trace_note_message(struct blk_trace *bt, struct blkcg *blkcg,
~~~~~~~~~~~~~~^~~~~
arch/x86/kernel/jump_label.c:61:1: warning: ‘inline’ is not at beginning of declaration [-Wold-style-declaration]
static void inline __jump_label_transform(struct jump_entry *entry,
^~~~~~
In file included from ./include/linux/capability.h:16,
from security/commoncap.c:5:
security/commoncap.c: In function ‘cap_prctl_drop’:
./include/uapi/linux/capability.h:373:27: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
#define cap_valid(x) ((x) >= 0 && (x) <= CAP_LAST_CAP)
^~
security/commoncap.c:1145:7: note: in expansion of macro ‘cap_valid’
if (!cap_valid(cap))
^~~~~~~~~
security/commoncap.c: In function ‘cap_task_prctl’:
./include/uapi/linux/capability.h:373:27: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
#define cap_valid(x) ((x) >= 0 && (x) <= CAP_LAST_CAP)
^~
security/commoncap.c:1175:8: note: in expansion of macro ‘cap_valid’
if (!cap_valid(arg2))
^~~~~~~~~
./include/uapi/linux/capability.h:373:27: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
#define cap_valid(x) ((x) >= 0 && (x) <= CAP_LAST_CAP)
^~
security/commoncap.c:1260:10: note: in expansion of macro ‘cap_valid’
if (((!cap_valid(arg3)) | arg4 | arg5))
^~~~~~~~~
drivers/video/fbdev/core/fbmon.c: In function ‘get_monspecs’:
drivers/video/fbdev/core/fbmon.c:812:47: warning: suggest braces around empty body in an ‘if’ statement [-Wempty-body]
DPRINTK(" Configurable signal level\n");
^
drivers/video/fbdev/core/fbmon.c:842:24: warning: suggest braces around empty body in an ‘else’ statement [-Wempty-body]
DPRINTK("variable\n");
^
drivers/video/fbdev/core/fbmon.c:847:24: warning: suggest braces around empty body in an ‘else’ statement [-Wempty-body]
DPRINTK("variable\n");
^
drivers/tty/vt/keyboard.c: In function ‘k_fn’:
drivers/tty/vt/keyboard.c:740:22: warning: comparison is always true due to limited range of data type [-Wtype-limits]
if ((unsigned)value < ARRAY_SIZE(func_table)) {
^
drivers/acpi/scan.c: In function ‘acpi_bus_get_wakeup_device_flags’:
drivers/acpi/scan.c:903:43: warning: suggest braces around empty body in an ‘if’ statement [-Wempty-body]
"error in _DSW or _PSW evaluation\n"));
^
drivers/acpi/acpi_processor.c: In function ‘acpi_processor_errata_piix4’:
drivers/acpi/acpi_processor.c:133:67: warning: suggest braces around empty body in an ‘if’ statement [-Wempty-body]
"Bus master activity detection (BM-IDE) erratum enabled\n"));
^
drivers/acpi/acpi_processor.c:136:54: warning: suggest braces around empty body in an ‘if’ statement [-Wempty-body]
"Type-F DMA livelock erratum (C3 disabled)\n"));
^
drivers/acpi/acpi_processor.c: In function ‘acpi_processor_get_info’:
drivers/acpi/acpi_processor.c:251:49: warning: suggest braces around empty body in an ‘else’ statement [-Wempty-body]
"No bus mastering arbitration control\n"));
^
drivers/acpi/processor_pdc.c: In function ‘acpi_processor_eval_pdc’:
drivers/acpi/processor_pdc.c:136:65: warning: suggest braces around empty body in an ‘if’ statement [-Wempty-body]
"Could not evaluate _PDC, using legacy perf. control.\n"));
^
fs/posix_acl.c: In function ‘get_acl’:
fs/posix_acl.c:127:22: warning: suggest braces around empty body in an ‘if’ statement [-Wempty-body]
/* fall through */ ;
^
lib/errname.c:15:67: warning: initialized field overwritten [-Woverride-init]
#define E(err) [err + BUILD_BUG_ON_ZERO(err <= 0 || err > 300)] = "-" #err
^~~
lib/errname.c:172:2: note: in expansion of macro ‘E’
E(EDEADLK), /* EDEADLOCK */
^
lib/errname.c:15:67: note: (near initialization for ‘names_0[35]’)
#define E(err) [err + BUILD_BUG_ON_ZERO(err <= 0 || err > 300)] = "-" #err
^~~
lib/errname.c:172:2: note: in expansion of macro ‘E’
E(EDEADLK), /* EDEADLOCK */
^
lib/radix-tree.c: In function ‘set_iter_tags’:
lib/radix-tree.c:1134:15: warning: comparison is always false due to limited range of data type [-Wtype-limits]
if (tag_long < RADIX_TREE_TAG_LONGS - 1) {
^
drivers/scsi/sr.c:691:12: warning: initialized field overwritten [-Woverride-init]
.ioctl = sr_block_compat_ioctl,
^~~~~~~~~~~~~~~~~~~~~
drivers/scsi/sr.c:691:12: note: (near initialization for ‘sr_bdops.ioctl’)
In file included from drivers/ata/ahci.c:35:
drivers/ata/ahci.h:384:16: warning: initialized field overwritten [-Woverride-init]
.can_queue = AHCI_MAX_CMDS, \
^~~~~~~~~~~~~
drivers/ata/ahci.c:103:2: note: in expansion of macro ‘AHCI_SHT’
AHCI_SHT("ahci"),
^~~~~~~~
drivers/ata/ahci.h:384:16: note: (near initialization for ‘ahci_sht.can_queue’)
.can_queue = AHCI_MAX_CMDS, \
^~~~~~~~~~~~~
drivers/ata/ahci.c:103:2: note: in expansion of macro ‘AHCI_SHT’
AHCI_SHT("ahci"),
^~~~~~~~
drivers/ata/ahci.h:388:17: warning: initialized field overwritten [-Woverride-init]
.sdev_attrs = ahci_sdev_attrs
^~~~~~~~~~~~~~~
drivers/ata/ahci.c:103:2: note: in expansion of macro ‘AHCI_SHT’
AHCI_SHT("ahci"),
^~~~~~~~
drivers/ata/ahci.h:388:17: note: (near initialization for ‘ahci_sht.sdev_attrs’)
.sdev_attrs = ahci_sdev_attrs
^~~~~~~~~~~~~~~
drivers/ata/ahci.c:103:2: note: in expansion of macro ‘AHCI_SHT’
AHCI_SHT("ahci"),
^~~~~~~~
drivers/usb/core/sysfs.c: In function ‘usb_create_sysfs_intf_files’:
drivers/usb/core/sysfs.c:1266:3: warning: suggest braces around empty body in an ‘if’ statement [-Wempty-body]
; /* We don't actually care if the function fails. */
^
drivers/input/mouse/synaptics.c: In function ‘synaptics_process_packet’:
drivers/input/mouse/synaptics.c:1105:6: warning: suggest braces around empty body in an ‘if’ statement [-Wempty-body]
; /* Nothing, treat a pen as a single finger */
^
drivers/md/md.c: In function ‘bind_rdev_to_array’:
drivers/md/md.c:2438:27: warning: suggest braces around empty body in an ‘if’ statement [-Wempty-body]
/* failure here is OK */;
^
drivers/md/md.c: In function ‘slot_store’:
drivers/md/md.c:3200:28: warning: suggest braces around empty body in an ‘if’ statement [-Wempty-body]
/* failure here is OK */;
^
drivers/md/md.c: In function ‘remove_and_add_spares’:
drivers/md/md.c:9045:29: warning: suggest braces around empty body in an ‘if’ statement [-Wempty-body]
/* failure here is OK */;
^
drivers/hid/hid-lgff.c: In function ‘hid_lgff_play’:
drivers/hid/hid-lgff.c:65:24: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
#define CLAMP(x) if (x < 0) x = 0; if (x > 0xff) x = 0xff
^
drivers/hid/hid-lgff.c:86:3: note: in expansion of macro ‘CLAMP’
CLAMP(left);
^~~~~
drivers/hid/hid-lgff.c:65:24: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
#define CLAMP(x) if (x < 0) x = 0; if (x > 0xff) x = 0xff
^
drivers/hid/hid-lgff.c:87:3: note: in expansion of macro ‘CLAMP’
CLAMP(right);
^~~~~
On 2/24/20 4:17 PM, Zzy Wysm wrote:
> As of Linux 5.6-rc3, the defconfig still builds with 33 warnings.
>
> Can we get it down to zero by the time 5.6 ships?
>
> zzy
>
>
> zzy@esquivalience:~/linux-5.6-rc3$ make -j4 KCFLAGS="-Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers" > build_log_5.6-rc3
defconfig isn't very interesting IMO. x86_64 allmodconfig has 1103 warnings
when using your KCFLAGS string.
(I am using gcc 7.5.0). What version of gcc are you using?
--
~Randy
> On Feb 25, 2020, at 9:55 PM, Randy Dunlap <[email protected]> wrote:
>
> defconfig isn't very interesting IMO. x86_64 allmodconfig has 1103 warnings
> when using your KCFLAGS string.
> (I am using gcc 7.5.0). What version of gcc are you using?
>
The gcc that comes with either Debian (gcc 8.3.0) or Ubuntu (gcc 9.2.1),
depending on what I use that day.
I agree that defconfig isn’t very interesting. But it is the metric that
Linus used when he recently declared his warning mandate:
"we don't have any warnings in the default build”
If I do a x86_64 build with a very large config, I get 1139 warnings. The
config I used is:
https://github.com/zzywysm/linux-kernel-compile-warnings/blob/master/almostallconfig-5.6rc3
And the warnings can be found at:
https://github.com/zzywysm/linux-kernel-compile-warnings/blob/master/warninglog-5.6rc3
(Also, thank you Randy for fixing some of these warnings already!)
zzy