[compiler-rt] 82694d9 - [compiler-rt][asan] Silence MSVC warning

Alexandre Ganea via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 2 09:29:44 PDT 2023


Author: Alexandre Ganea
Date: 2023-10-02T12:29:29-04:00
New Revision: 82694d9c60454d4fadfbad7ebea84e9ec1964f41

URL: https://github.com/llvm/llvm-project/commit/82694d9c60454d4fadfbad7ebea84e9ec1964f41
DIFF: https://github.com/llvm/llvm-project/commit/82694d9c60454d4fadfbad7ebea84e9ec1964f41.diff

LOG: [compiler-rt][asan] Silence MSVC warning

```
[3/56] Building CXX object projects\compiler-rt\lib\asan\CMakeFiles\RTAsan.x86_64.dir\asan_poisoning.cpp.obj
C:\git\llvm-project\compiler-rt\lib\asan\asan_poisoning.cpp(450): warning C4390: ';': empty controlled statement found; is this the intent?
[4/56] Building CXX object projects\compiler-rt\lib\asan\CMakeFiles\RTAsan_dynamic.x86_64.dir\asan_poisoning.cpp.obj
C:\git\llvm-project\compiler-rt\lib\asan\asan_poisoning.cpp(450): warning C4390: ';': empty controlled statement found; is this the intent?
```

Added: 
    

Modified: 
    compiler-rt/lib/asan/asan_poisoning.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/asan/asan_poisoning.cpp b/compiler-rt/lib/asan/asan_poisoning.cpp
index 6bfc79ecb34b9cc..746ad61813c65dc 100644
--- a/compiler-rt/lib/asan/asan_poisoning.cpp
+++ b/compiler-rt/lib/asan/asan_poisoning.cpp
@@ -446,8 +446,11 @@ void __sanitizer_annotate_contiguous_container(const void *beg_p,
   // https://github.com/google/sanitizers/issues/258.
   // if (d1 != d2)
   //  DCHECK_EQ(*(u8*)MemToShadow(d1), old_mid - d1);
-  if (a + granularity <= d1)
+  //
+  // NOTE: curly brackets for the "if" below to silence a MSVC warning.
+  if (a + granularity <= d1) {
     DCHECK_EQ(*(u8 *)MemToShadow(a), 0);
+  }
   // if (d2 + granularity <= c && c <= end)
   //   DCHECK_EQ(*(u8 *)MemToShadow(c - granularity),
   //            kAsanContiguousContainerOOBMagic);


        


More information about the llvm-commits mailing list