This is an archive of the discontinued LLVM Phabricator instance.

[ELF][PPC64]Workaround bogus Visual Studio build warning
ClosedPublic

Authored by jhenderson on Oct 29 2018, 9:32 AM.

Details

Summary

Visual Studio has a bug where it converts the integer literal 2147483648 into an unsigned int instead of a long long (i.e. it follows C89 rules). The bug has been reported as https://developercommunity.visualstudio.com/content/problem/141813/-2147483648-c4146-error.html. Because of this bug, we were getting a signed/unsigned comparison warning in VS2015 from the old code (the subsequent unary negation had no effect on the type).

Diff Detail

Repository
rLLD LLVM Linker

Event Timeline

jhenderson created this revision.Oct 29 2018, 9:32 AM
sfertile accepted this revision.Oct 29 2018, 9:56 AM

Thanks for cleaning this up. LGTM.

We could also fix this by using INT32_MIN or std::numeric_limts<int32_t>::min(), if preferred

Personally I prefer either of those over the raw numeric literal.

This revision is now accepted and ready to land.Oct 29 2018, 9:56 AM
jhenderson edited the summary of this revision. (Show Details)
jhenderson removed a reviewer: espindola.

Use numeric_limits instead of literal.

Thanks for cleaning this up. LGTM.

We could also fix this by using INT32_MIN or std::numeric_limts<int32_t>::min(), if preferred

Personally I prefer either of those over the raw numeric literal.

Thanks, I've updated it, and will land the patch tomorrow, as I'm just leaving the office now.

This revision was automatically updated to reflect the committed changes.