This is an archive of the discontinued LLVM Phabricator instance.

[Sema] Move pointer to int cast warnings under -Wmicrosoft-cast
AbandonedPublic

Authored by aeubanks on Mar 6 2020, 8:21 AM.

Details

Reviewers
thakis
rnk
Summary

Microsoft extensions should be under a -Wmicrosoft-foo group.
Added in https://reviews.llvm.org/D75708.

There shouldn't be a reason to separate out void pointers since this is C++.

Diff Detail

Event Timeline

aeubanks created this revision.Mar 6 2020, 8:21 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 6 2020, 8:21 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
aeubanks edited the summary of this revision. (Show Details)Mar 6 2020, 8:22 AM
aeubanks added reviewers: thakis, rnk.
aeubanks retitled this revision from Move warnings added in https://reviews.llvm.org/D75708 under -Wmicrosoft-cast to [Sema] Move pointer to int cast warnings under -Wmicrosoft-cast.
aeubanks edited the summary of this revision. (Show Details)
rnk added a comment.Mar 6 2020, 1:06 PM

I agree with the reasoning, but this is likely to fire all over existing C++ code. In fact, the one we just added finds issues in Chrome
https://ci.chromium.org/p/chrome/builders/ci/ToTWin/5879
../../base/debug/close_handle_hook_win.cc(155,16): error: cast to smaller integer type 'unsigned long' from 'void *'

The idea was that -Wpointer-int-cast was a new warning group, so it was fine to add new findings to it, but -Wmicrosoft-cast already exists. In this case, I would recommend adding some new -W flag.

As for naming, -Wmicrosoft-pointer-to-int? It can still be a subgroup of -Wmicrosoft-cast.

Specifically regarding
../../base/debug/close_handle_hook_win.cc(155,16): error: cast to smaller integer type 'unsigned long' from 'void *',
I sent out a change to fix that: https://chromium-review.googlesource.com/c/chromium/src/+/2091215, and tried compiling with ToT clang with the suppression removed, then there were no more errors.

Anyway, we should probably be consistent between this and https://reviews.llvm.org/D75643. I'm fine with keeping what we have, but then https://reviews.llvm.org/D75643 should probably go in.

aeubanks abandoned this revision.Mar 9 2020, 1:36 PM