This is an archive of the discontinued LLVM Phabricator instance.

[LLVM][Alignment] Fix MSVC warning
ClosedPublic

Authored by RKSimon on Aug 7 2019, 4:42 AM.

Event Timeline

gchatelet created this revision.Aug 7 2019, 4:42 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 7 2019, 4:42 AM
gchatelet edited the summary of this revision. (Show Details)Aug 7 2019, 4:44 AM

This isn't handling all the cases - its probably better to push at the top of the file (before namespace) and similarly pop at the end of the file

This isn't handling all the cases - its probably better to push at the top of the file (before namespace) and similarly pop at the end of the file

Thx Simon, I'm OOO right now and traveling next week. Would you have a chance to check that the fix you offer is fixing the Windows build?

RKSimon commandeered this revision.Aug 15 2019, 4:43 AM
RKSimon edited reviewers, added: gchatelet; removed: RKSimon.
RKSimon updated this revision to Diff 215381.Aug 15 2019, 6:20 AM

Disable MSVC divide by zero warnings for the whole of AlignmentTest.cpp

Adding some people interested in MSVC builds

I've not tested, but it seems reasonable. The only other "#pragma warning" I came across (in the neighbouring llvm/unittests/Support/AlignOfTest.cpp) doesn't bother with a push/pop and just disables the warnings at file scope. I'm not sure if there's any reason to push/pop across the entire file unless we think we might want to ever include this cpp file inside another one?

I'm happy to remove the push/pull if reviewers prefer - its just a personal style preference tbh

rnk accepted this revision.Aug 15 2019, 9:16 AM

lgtm

I prefer push/pop generally.

This revision is now accepted and ready to land.Aug 15 2019, 9:16 AM

I'm happy to remove the push/pull if reviewers prefer - its just a personal style preference tbh

I have no strong preference. LGTM either way.

This revision was automatically updated to reflect the committed changes.
gchatelet added a comment.EditedAug 15 2019, 10:52 AM

LGTM.
Thx for fixing it!