[Mlir-commits] [mlir] Fixed Windows build warnings (PR #68978)

Nikita Kudriavtsev llvmlistbot at llvm.org
Fri Oct 20 03:14:58 PDT 2023


================
@@ -382,7 +382,10 @@ inline uint64_t alignTo(uint64_t Value, uint64_t Align) {
 inline uint64_t alignToPowerOf2(uint64_t Value, uint64_t Align) {
   assert(Align != 0 && (Align & (Align - 1)) == 0 &&
          "Align must be a power of 2");
-  return (Value + Align - 1) & -Align;
+  // Replace unary minus to avoid compilation error on Windows:
+  // "unary minus operator applied to unsigned type, result still unsigned"
----------------
nikita-kud wrote:

@dwblaikie, thank you for your review!

Sounds fair. We can disable warnings to build LLVM. But I still have a question about the *.h files. Since we include them in the "client" project, and in this project there are requirements not to have warnings. Can we consider fixing such warnings in the upstream, or should we have changes only in our fork?

https://github.com/llvm/llvm-project/pull/68978


More information about the Mlir-commits mailing list