[compiler-rt] 5d5d806 - Silence warning with MSVC.

Alexandre Ganea via llvm-commits llvm-commits at lists.llvm.org
Sat Jan 15 09:06:46 PST 2022


Author: Alexandre Ganea
Date: 2022-01-15T12:06:38-05:00
New Revision: 5d5d806e7b95d8a99d5628d113d8ecd33b2b289f

URL: https://github.com/llvm/llvm-project/commit/5d5d806e7b95d8a99d5628d113d8ecd33b2b289f
DIFF: https://github.com/llvm/llvm-project/commit/5d5d806e7b95d8a99d5628d113d8ecd33b2b289f.diff

LOG: Silence warning with MSVC.

Fixes:

[2587/4073] Building CXX object projects\compiler-rt\lib\sanitizer_common\CMakeFiles\RTSanitizerCommon.x86_64.dir\sanitizer_stoptheworld_win.cpp.obj
D:\git\llvm-project\compiler-rt\lib\sanitizer_common\sanitizer_stoptheworld_win.cpp(125,33): warning: comparison of integers of different signs: 'DWORD' (aka 'unsigned long') and 'int' [-Wsign-compare]
      if (SuspendThread(thread) == -1) {
          ~~~~~~~~~~~~~~~~~~~~~ ^  ~~
1 warning generated.

Added: 
    

Modified: 
    compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld_win.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld_win.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld_win.cpp
index e12b9e5bee06f..f114acea79c9c 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld_win.cpp
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld_win.cpp
@@ -122,7 +122,7 @@ DWORD WINAPI RunThread(void *argument) {
           OpenThread(THREAD_ALL_ACCESS, FALSE, thread_entry.th32ThreadID);
       CHECK(thread);
 
-      if (SuspendThread(thread) == -1) {
+      if (SuspendThread(thread) == (DWORD)-1) {
         DWORD last_error = GetLastError();
 
         VPrintf(1, "Could not suspend thread %lu (error %lu)",


        


More information about the llvm-commits mailing list