MaskRay added inline comments.
Comment at: clang/lib/Sema/SemaCast.cpp:2783
+Diag = diag::ext_ms_pointer_to_int_cast;
+ else if (SrcType->isVoidPointerType())
+if (DestType->isEnumeralType())
A ternary operator is better here. I'll fix it.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG2a41b31fcdfc: [Sema] Add -Wpointer-to-enum-cast and
-Wvoid-pointer-to-enum-cast (authored by nathanchance, committed by MaskRay).
Changed prior to commit:
https://reviews.llvm.org/D75758?vs=248824&id=24
nathanchance marked an inline comment as done.
nathanchance added a comment.
Thanks for the review and accepting. I do not have commit rights, would you
mind doing that on my behalf?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D75758/new/
https:/
nathanchance marked 2 inline comments as done.
nathanchance added inline comments.
Comment at: clang/include/clang/Basic/DiagnosticSemaKinds.td:3673
+def warn_pointer_to_enum_cast : Warning<
+ "cast to smaller integer type %1 from %0">,
+ InGroup;
xbolva00 wrot
nathanchance updated this revision to Diff 248824.
nathanchance edited the summary of this revision.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D75758/new/
https://reviews.llvm.org/D75758
Files:
clang/include/clang/Basic/DiagnosticGroups.td
cl
xbolva00 added inline comments.
Comment at: clang/include/clang/Basic/DiagnosticSemaKinds.td:3673
+def warn_pointer_to_enum_cast : Warning<
+ "cast to smaller integer type %1 from %0">,
+ InGroup;
You can reuse warning text:
warn_pointer_to_int_cast.Text
I th
manojgupta added a comment.
Thanks, Verified that this fixes the kernel warnings in my local builds with
https://gist.github.com/nathanchance/767cccf4d093c1342e1994083518815e!
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D75758/new/
https://review
nathanchance created this revision.
nathanchance added reviewers: Mordante, rjmccall.
Herald added a project: clang.
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
c