[PATCH] D72231: [Sema] Adds the pointer-to-int-cast diagnostic

2020-02-19 Thread Mark de Wever via Phabricator via cfe-commits
Mordante added a comment. In D72231#1882658 , @rjmccall wrote: > Okay. Can we raise this with the kernel folks instead of just assuming > they'll be opposed? An obvious patch to fix a few dozen places where they're > hit by a warning they

[PATCH] D72231: [Sema] Adds the pointer-to-int-cast diagnostic

2020-02-19 Thread John McCall via Phabricator via cfe-commits
rjmccall added a comment. Okay. Can we raise this with the kernel folks instead of just assuming they'll be opposed? An obvious patch to fix a few dozen places where they're hit by a warning they intentionally enabled really doesn't seem like a burden. If they push back, fine, we can enable

[PATCH] D72231: [Sema] Adds the pointer-to-int-cast diagnostic

2020-02-18 Thread Nathan Chancellor via Phabricator via cfe-commits
nathanchance added a comment. In D72231#1881855 , @rjmccall wrote: > In D72231#1881797 , @nickdesaulniers > wrote: > > > In D72231#1881784 , @rjmccall > > wrote: > > > > >

[PATCH] D72231: [Sema] Adds the pointer-to-int-cast diagnostic

2020-02-18 Thread Nick Desaulniers via Phabricator via cfe-commits
nickdesaulniers added a comment. In D72231#1881855 , @rjmccall wrote: > No, I understand the pattern, but they must have already done some sort of > pass over the code to make it warning-clean when they're working with a > smaller integer type. Or do

[PATCH] D72231: [Sema] Adds the pointer-to-int-cast diagnostic

2020-02-18 Thread John McCall via Phabricator via cfe-commits
rjmccall added a comment. In D72231#1881797 , @nickdesaulniers wrote: > In D72231#1881784 , @rjmccall wrote: > > > In D72231#1881760 , > > @nickdesaulniers wrote: > > > >

[PATCH] D72231: [Sema] Adds the pointer-to-int-cast diagnostic

2020-02-18 Thread Nick Desaulniers via Phabricator via cfe-commits
nickdesaulniers added a comment. In D72231#1881784 , @rjmccall wrote: > In D72231#1881760 , @nickdesaulniers > wrote: > > > In D72231#1879347 , @rjmccall > > wrote: > > >

[PATCH] D72231: [Sema] Adds the pointer-to-int-cast diagnostic

2020-02-18 Thread John McCall via Phabricator via cfe-commits
rjmccall added a comment. In D72231#1881760 , @nickdesaulniers wrote: > In D72231#1879347 , @rjmccall wrote: > > > In D72231#1878528 , @nathanchance > > wrote: > > > > >

[PATCH] D72231: [Sema] Adds the pointer-to-int-cast diagnostic

2020-02-18 Thread Nick Desaulniers via Phabricator via cfe-commits
nickdesaulniers added a comment. In D72231#1879347 , @rjmccall wrote: > In D72231#1878528 , @nathanchance > wrote: > > > There appear to a be semantic difference between GCC and clang with the > > current version

[PATCH] D72231: [Sema] Adds the pointer-to-int-cast diagnostic

2020-02-18 Thread Nathan Chancellor via Phabricator via cfe-commits
nathanchance added a comment. In D72231#1879347 , @rjmccall wrote: > Warning about casting to an enum seems clearly correct and in scope for this > warning. Warning about casting to `_Bool` seems clearly incorrect and should > not be warned about at

[PATCH] D72231: [Sema] Adds the pointer-to-int-cast diagnostic

2020-02-18 Thread Mark de Wever via Phabricator via cfe-commits
Mordante added a comment. In D72231#1879347 , @rjmccall wrote: > In D72231#1878528 , @nathanchance > wrote: > > > There appear to a be semantic difference between GCC and clang with the > > current version of

[PATCH] D72231: [Sema] Adds the pointer-to-int-cast diagnostic

2020-02-17 Thread John McCall via Phabricator via cfe-commits
rjmccall added a comment. In D72231#1878528 , @nathanchance wrote: > There appear to a be semantic difference between GCC and clang with the > current version of this patch which results in a lot of additional warnings > in the Linux kernel:

[PATCH] D72231: [Sema] Adds the pointer-to-int-cast diagnostic

2020-02-16 Thread Nathan Chancellor via Phabricator via cfe-commits
nathanchance added a comment. There appear to a be semantic difference between GCC and clang with the current version of this patch which results in a lot of additional warnings in the Linux kernel: https://godbolt.org/z/eHFJd8 Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION

[PATCH] D72231: [Sema] Adds the pointer-to-int-cast diagnostic

2020-02-16 Thread Mark de Wever via Phabricator via cfe-commits
Mordante added a comment. This revision caused issue for the MSVC build bot. I created a followup patch D74694 . Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D72231/new/ https://reviews.llvm.org/D72231

[PATCH] D72231: [Sema] Adds the pointer-to-int-cast diagnostic

2020-02-16 Thread Mark de Wever via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Mordante marked an inline comment as done. Closed by commit rG9658d895c81a: [Sema] Adds the pointer-to-int-cast diagnostic (authored by Mordante). Changed prior to commit:

[PATCH] D72231: [Sema] Adds the pointer-to-int-cast diagnostic

2020-02-16 Thread Mark de Wever via Phabricator via cfe-commits
Mordante marked 2 inline comments as done. Mordante added a comment. Herald added a subscriber: martong. Thanks for the review. I'll have a look at your suggestion for a follow-up patch. Comment at: clang/test/Sema/cast.c:1 -// RUN: %clang_cc1 -fsyntax-only -triple

[PATCH] D72231: [Sema] Adds the pointer-to-int-cast diagnostic

2020-02-04 Thread Richard Smith - zygoloid via Phabricator via cfe-commits
rsmith accepted this revision. rsmith added a comment. This revision is now accepted and ready to land. Looks fine. Would it make sense to put the MS extension warning into the `-Wpointer-to-int-cast` group so that we can control this warning consistently across platforms? You could get that

[PATCH] D72231: [Sema] Adds the pointer-to-int-cast diagnostic

2020-02-04 Thread Mark de Wever via Phabricator via cfe-commits
Mordante updated this revision to Diff 242393. Mordante added a comment. - Enabled the warning by default - Added an Microsoft extension, the unit tests already expected this behaviour CHANGES SINCE LAST ACTION https://reviews.llvm.org/D72231/new/ https://reviews.llvm.org/D72231 Files:

[PATCH] D72231: [Sema] Adds the pointer-to-int-cast diagnostic

2020-01-07 Thread John McCall via Phabricator via cfe-commits
rjmccall added a reviewer: rjmccall. rjmccall added a comment. It's not unusual for new warnings to require changes to other tests. I agree with enabling this by default. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D72231/new/

[PATCH] D72231: [Sema] Adds the pointer-to-int-cast diagnostic

2020-01-07 Thread Mark de Wever via Phabricator via cfe-commits
Mordante planned changes to this revision. Mordante added a comment. While looking at the test failures I noticed the tests `pointer_to_integral_type_conv` in `clang/test/Sema/MicrosoftExtensions.c` were not tested. Will look into it later. Repository: rG LLVM Github Monorepo CHANGES SINCE

[PATCH] D72231: [Sema] Adds the pointer-to-int-cast diagnostic

2020-01-05 Thread Mark de Wever via Phabricator via cfe-commits
Mordante added a comment. In D72231#1804929 , @xbolva00 wrote: > >> The diagnostic is not enabled by default > > But GCC enables it for C even without "-Wall or -Wextra". Clang should follow > it.. I'll have a look what the impact is. When I tested it

[PATCH] D72231: [Sema] Adds the pointer-to-int-cast diagnostic

2020-01-05 Thread pre-merge checks [bot] via Phabricator via cfe-commits
merge_guards_bot added a comment. {icon check-circle color=green} Unit tests: pass. 61248 tests passed, 0 failed and 736 were skipped. {icon times-circle color=red} clang-tidy: fail. Please fix clang-tidy findings

[PATCH] D72231: [Sema] Adds the pointer-to-int-cast diagnostic

2020-01-05 Thread Dávid Bolvanský via Phabricator via cfe-commits
xbolva00 added a comment. >> The diagnostic is not enabled by default But GCC enables it for C even without "-Wall or -Wextra". Clang should follow it.. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D72231/new/ https://reviews.llvm.org/D72231

[PATCH] D72231: [Sema] Adds the pointer-to-int-cast diagnostic

2020-01-05 Thread Mark de Wever via Phabricator via cfe-commits
Mordante created this revision. Mordante added reviewers: dblaikie, rsmith. Mordante added a project: clang. Converting a pointer to an integer whose result cannot represented in the integer type is undefined behavior is C and prohibited in C++. C++ already has a diagnostic when casting. This