diff options
author | Nathan Chancellor <natechancellor@gmail.com> | 2020-03-07 16:37:44 -0800 |
---|---|---|
committer | Fangrui Song <maskray@google.com> | 2020-03-07 16:43:39 -0800 |
commit | 2a41b31fcdfcb67ab7038fc2ffb606fd50b83a84 (patch) | |
tree | cc2df89b2e0df2e77bfccf9400fa3b34e4fad42c /llvm/lib/CodeGen/MachineFunction.cpp | |
parent | d81d451442d758dcd4f8d59162cf46c8386bef2d (diff) | |
download | llvm-2a41b31fcdfcb67ab7038fc2ffb606fd50b83a84.zip llvm-2a41b31fcdfcb67ab7038fc2ffb606fd50b83a84.tar.gz llvm-2a41b31fcdfcb67ab7038fc2ffb606fd50b83a84.tar.bz2 |
[Sema] Add -Wpointer-to-enum-cast and -Wvoid-pointer-to-enum-cast
GCC does not warn on casts from pointers to enumerators, while clang
currently does: https://godbolt.org/z/3DFDVG
This causes a bunch of extra warnings in the Linux kernel, where
certain structs contain a void pointer to avoid using a gigantic
union for all of the various types of driver data, such as
versions.
Add a diagnostic that allows certain projects like the kernel to
disable the warning just for enums, which allows those projects to
keep full compatibility with GCC but keeps the intention of treating
casts to integers and enumerators the same by default so that other
projects have the opportunity to catch issues not noticed before (or
follow suite and disable the warning).
Link: https://github.com/ClangBuiltLinux/linux/issues/887
Reviewed By: rjmccall
Differential Revision: https://reviews.llvm.org/D75758
Diffstat (limited to 'llvm/lib/CodeGen/MachineFunction.cpp')
0 files changed, 0 insertions, 0 deletions