bpf/core.c - silence warning messages
Subsystems (3)
PATCH 1/1 bpf/core.c - silence warning messages
Compiling kernel/bpf/core.c with W=1 causes a flood of warnings:
kernel/bpf/core.c:1198:65: warning: initialized field overwritten [-Woverride-init]
1198 | #define BPF_INSN_3_TBL(x, y, z) [BPF_##x | BPF_##y | BPF_##z] = true
| ^~~~kernel/bpf/core.c:1087:2: note: in expansion of macro 'BPF_INSN_3_TBL'
1087 | INSN_3(ALU, ADD, X), \
| ^~~~~~
kernel/bpf/core.c:1202:3: note: in expansion of macro 'BPF_INSN_MAP'
1202 | BPF_INSN_MAP(BPF_INSN_2_TBL, BPF_INSN_3_TBL),
| ^~~~~~~~~~~~kernel/bpf/core.c:1198:65: note: (near initialization for 'public_insntable[12]')
1198 | #define BPF_INSN_3_TBL(x, y, z) [BPF_##x | BPF_##y | BPF_##z] = true
| ^~~~kernel/bpf/core.c:1087:2: note: in expansion of macro 'BPF_INSN_3_TBL'
1087 | INSN_3(ALU, ADD, X), \
| ^~~~~~
kernel/bpf/core.c:1202:3: note: in expansion of macro 'BPF_INSN_MAP'
1202 | BPF_INSN_MAP(BPF_INSN_2_TBL, BPF_INSN_3_TBL),
| ^~~~~~~~~~~~98 copies of the above.
The attached patch silences the warnings, because we *know* we're overwriting the default initializer. That leaves bpf/core.c with only 6 other warnings, which become more visible in comparison.
kernel/bpf/Makefile +1 -0
@@ -21,3 +21,4 @@ obj-$(CONFIG_CGROUP_BPF) += cgroup.o ifeq ($(CONFIG_INET),y) obj-$(CONFIG_BPF_SYSCALL) += reuseport_array.o endif +CFLAGS_core.o += $(call cc-disable-warning, override-init)
Quoted 22 lines · Valdis Klētnieks
Compiling
kernel/bpf/core.cwith W=1 causes a flood of warnings:
kernel/bpf/core.c:1198:65: warning: initialized field overwritten [-Woverride-init]
1198 | #defineBPF_INSN_3_TBL(x, y, z)[BPF_##x | BPF_##y | BPF_##z] = true
| ^~~~kernel/bpf/core.c:1087:2: note: in expansion of macro 'BPF_INSN_3_TBL'1087 | INSN_3(ALU, ADD, X), \ | ^~~~~~ kernel/bpf/core.c:1202:3: note: in expansion of macro 'BPF_INSN_MAP' 1202 | BPF_INSN_MAP(BPF_INSN_2_TBL, BPF_INSN_3_TBL), | ^~~~~~~~~~~~
kernel/bpf/core.c:1198:65: note: (near initialization for 'public_insntable[12]')
1198 | #defineBPF_INSN_3_TBL(x, y, z)[BPF_##x | BPF_##y | BPF_##z] = true
| ^~~~kernel/bpf/core.c:1087:2: note: in expansion of macro 'BPF_INSN_3_TBL'1087 | INSN_3(ALU, ADD, X), \ | ^~~~~~ kernel/bpf/core.c:1202:3: note: in expansion of macro 'BPF_INSN_MAP' 1202 | BPF_INSN_MAP(BPF_INSN_2_TBL, BPF_INSN_3_TBL), | ^~~~~~~~~~~~
Quoted 7 lines
98 copies of the above.
The attached patch silences the warnings, because we *know* we're overwriting the default initializer. That leaves
bpf/core.cwith only 6 other warnings, which become more visible in comparison.Signed-off-by Valdis Kletnieks <[email protected]>
Thanks! Please include bpf-next in [PATCH] prefix in the future. I've also CC'ed [email protected] list.
Quoted 12 lines
kernel/bpf/Makefile +1
-0@@ -21,3 +21,4 @@ obj-$(CONFIG_CGROUP_BPF) += cgroup.o ifeq ($(CONFIG_INET),y) obj-$(CONFIG_BPF_SYSCALL) += reuseport_array.o endif +CFLAGS_core.o += $(call cc-disable-warning, override-init)
Daniel Borkmann
maintainerQuoted 21 lines · Valdis Klētnieks
Compiling
kernel/bpf/core.cwith W=1 causes a flood of warnings:
kernel/bpf/core.c:1198:65: warning: initialized field overwritten [-Woverride-init]
1198 | #defineBPF_INSN_3_TBL(x, y, z)[BPF_##x | BPF_##y | BPF_##z] = true
| ^~~~kernel/bpf/core.c:1087:2: note: in expansion of macro 'BPF_INSN_3_TBL'1087 | INSN_3(ALU, ADD, X), \ | ^~~~~~ kernel/bpf/core.c:1202:3: note: in expansion of macro 'BPF_INSN_MAP' 1202 | BPF_INSN_MAP(BPF_INSN_2_TBL, BPF_INSN_3_TBL), | ^~~~~~~~~~~~
kernel/bpf/core.c:1198:65: note: (near initialization for 'public_insntable[12]')
1198 | #defineBPF_INSN_3_TBL(x, y, z)[BPF_##x | BPF_##y | BPF_##z] = true
| ^~~~kernel/bpf/core.c:1087:2: note: in expansion of macro 'BPF_INSN_3_TBL'1087 | INSN_3(ALU, ADD, X), \ | ^~~~~~ kernel/bpf/core.c:1202:3: note: in expansion of macro 'BPF_INSN_MAP' 1202 | BPF_INSN_MAP(BPF_INSN_2_TBL, BPF_INSN_3_TBL), | ^~~~~~~~~~~~
Quoted 7 lines
98 copies of the above.
The attached patch silences the warnings, because we *know* we're overwriting the default initializer. That leaves
bpf/core.cwith only 6 other warnings, which become more visible in comparison.Signed-off-by Valdis Kletnieks <[email protected]>
Makes sense, applied!