mstorsjo created this revision.
mstorsjo added reviewers: pirama, pcc, compnerd, srhines.
Herald added a reviewer: EricWF.
Herald added a subscriber: ldionne.

This fixes a warning like this:

warning: comparison of integers of different signs:

      'std::__1::__libcpp_tls_key' (aka 'long') and 'DWORD'
      (aka 'unsigned long') [-Wsign-compare]
  if (*__key == FLS_OUT_OF_INDEXES)
      ~~~~~~ ^  ~~~~~~~~~~~~~~~~~~
   


Repository:
  rCXX libc++

https://reviews.llvm.org/D49782

Files:
  src/support/win32/thread_win32.cpp


Index: src/support/win32/thread_win32.cpp
===================================================================
--- src/support/win32/thread_win32.cpp
+++ src/support/win32/thread_win32.cpp
@@ -254,9 +254,10 @@
 int __libcpp_tls_create(__libcpp_tls_key* __key,
                         void(_LIBCPP_TLS_DESTRUCTOR_CC* __at_exit)(void*))
 {
-  *__key = FlsAlloc(__at_exit);
-  if (*__key == FLS_OUT_OF_INDEXES)
+  DWORD index = FlsAlloc(__at_exit);
+  if (index == FLS_OUT_OF_INDEXES)
     return GetLastError();
+  *__key = index;
   return 0;
 }
 


Index: src/support/win32/thread_win32.cpp
===================================================================
--- src/support/win32/thread_win32.cpp
+++ src/support/win32/thread_win32.cpp
@@ -254,9 +254,10 @@
 int __libcpp_tls_create(__libcpp_tls_key* __key,
                         void(_LIBCPP_TLS_DESTRUCTOR_CC* __at_exit)(void*))
 {
-  *__key = FlsAlloc(__at_exit);
-  if (*__key == FLS_OUT_OF_INDEXES)
+  DWORD index = FlsAlloc(__at_exit);
+  if (index == FLS_OUT_OF_INDEXES)
     return GetLastError();
+  *__key = index;
   return 0;
 }
 
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to