[PATCH] D43110: [Sema] Don't mark plain MS enums as fixed
Reid Kleckner via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Feb 12 09:13:10 PST 2018
rnk added a comment.
In https://reviews.llvm.org/D43110#1004107, @rsmith wrote:
> Thanks! I'd noticed this weirdness but wasn't sure what we could do about it without breaking MS compat. I like this approach a lot.
Great, sorry for the delay.
> If we want to change the C behavior too, I think that should be a separate change. How does MSVC behave in C mode?
They warn in both C and C++ on the code below:
enum PosEnum { A_a = 0, A_b = 1, A_c = 10 };
int test_pos(enum PosEnum a, unsigned uv) { return a < uv; }
I picked this back up because clang-cl was giving -Wsign-comparison warnings in code like this:
unsigned DiagID = ...;
EXPECT_EQ(DiagID, diag::warn_foo);
I think there has been a recent growth in gtest usage, so this was starting to get really annoying. The source-level fix would be to give the diag enums a fixed type, but I didn't feel like doing that to literally every enum in LLVM and clang. I guess the MSVC build will just be noisy unless we disable that warning.
https://reviews.llvm.org/D43110
More information about the cfe-commits
mailing list