[llvm] r188079 - ELFObjectFile.h: Silence warning on Windows

Hans Wennborg hans at hanshq.net
Fri Aug 9 09:48:21 PDT 2013


Author: hans
Date: Fri Aug  9 11:48:21 2013
New Revision: 188079

URL: http://llvm.org/viewvc/llvm-project?rev=188079&view=rev
Log:
ELFObjectFile.h: Silence warning on Windows

The compiler was warning about using | on a uintptr_t and bool:

  Object/ELFObjectFile.h(131) : warning C4805: '|' : unsafe
  mix of type 'uintptr_t' and type 'bool' in operation

I think the warning might be useful in other cases, so I added
a cast instead of disabling it altogether.

Modified:
    llvm/trunk/include/llvm/Object/ELFObjectFile.h

Modified: llvm/trunk/include/llvm/Object/ELFObjectFile.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Object/ELFObjectFile.h?rev=188079&r1=188078&r2=188079&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Object/ELFObjectFile.h (original)
+++ llvm/trunk/include/llvm/Object/ELFObjectFile.h Fri Aug  9 11:48:21 2013
@@ -128,7 +128,8 @@ protected: // ELF specific protected mem
 
   DataRefImpl toDRI(Elf_Sym_Iter Symb) const {
     DataRefImpl DRI;
-    DRI.p = reinterpret_cast<uintptr_t>(Symb.get()) | Symb.isDynamic();
+    DRI.p = reinterpret_cast<uintptr_t>(Symb.get()) |
+      static_cast<uintptr_t>(Symb.isDynamic());
     return DRI;
   }
 





More information about the llvm-commits mailing list