Unary minus operator applied to unsigned type, result still unsigned.
Use ~0U instead of -1U and 1 + ~VAL instead of -VAL.
Differential D94417
[ADT][Support] Fix C4146 error from MSVC vinograd47 on Jan 11 2021, 7:24 AM. Authored by
Details Unary minus operator applied to unsigned type, result still unsigned. Use ~0U instead of -1U and 1 + ~VAL instead of -VAL.
Diff Detail
Unit Tests
Event TimelineComment Actions Perhaps we could rewrite the code to use ~ or the like instead of unary - if that works? Comment Actions +1 We currently globally disable C4146 inside llvm-project\llvm\cmake\modules\HandleLLVMOptions.cmake (along with a lot of other warnings that ideally we'd enable and make use of) - it'd be great if you could fix at least the code here instead of adding a lot of pragmas. Comment Actions Seems OK - I don't know if there's a nicer way to handle the latter cases that need the 1 + ~N. Comment Actions Can you commit this yourself (do you have commit access), or do you need someone to commit it for you? Comment Actions @dblaikie I'm not sure if I have commit access. But after rebase CI shows unit tests failures, I need to investigate them prior to merging. Comment Actions @dblaikie I see similar failures locally even on clean main branch without this changes. Is it some known issue? |
clang-format not found in user's PATH; not linting file.