Skip to content

Commit dafda49

Browse files
nathanchancegregkh
authored andcommitted
kbuild: Disable -Wpointer-to-enum-cast
commit 82f2bc2fcc0160d6f82dd1ac64518ae0a4dd183f upstream. Clang's -Wpointer-to-int-cast deviates from GCC in that it warns when casting to enums. The kernel does this in certain places, such as device tree matches to set the version of the device being used, which allows the kernel to avoid using a gigantic union. https://elixir.bootlin.com/linux/v5.5.8/source/drivers/ata/ahci_brcm.c#L428 https://elixir.bootlin.com/linux/v5.5.8/source/drivers/ata/ahci_brcm.c#L402 https://elixir.bootlin.com/linux/v5.5.8/source/include/linux/mod_devicetable.h#L264 To avoid a ton of false positive warnings, disable this particular part of the warning, which has been split off into a separate diagnostic so that the entire warning does not need to be turned off for clang. It will be visible under W=1 in case people want to go about fixing these easily and enabling the warning treewide. Cc: [email protected] Link: ClangBuiltLinux/linux#887 Link: llvm/llvm-project@2a41b31 Signed-off-by: Nathan Chancellor <[email protected]> Signed-off-by: Masahiro Yamada <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 9d25ef1 commit dafda49

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

Diff for: scripts/Makefile.extrawarn

+1
Original file line numberDiff line numberDiff line change
@@ -72,5 +72,6 @@ KBUILD_CFLAGS += $(call cc-disable-warning, format)
7272
KBUILD_CFLAGS += $(call cc-disable-warning, sign-compare)
7373
KBUILD_CFLAGS += $(call cc-disable-warning, format-zero-length)
7474
KBUILD_CFLAGS += $(call cc-disable-warning, uninitialized)
75+
KBUILD_CFLAGS += $(call cc-disable-warning, pointer-to-enum-cast)
7576
endif
7677
endif

0 commit comments

Comments
 (0)