[llvm-commits] [lld] Fix some warnings

Evandro Menezes emenezes at codeaurora.org
Thu Apr 26 08:37:04 PDT 2012


Joerg,

I'm using just plain "-O1 -g" and cmake adds "-std=c++0x" to GCC 4.7. 
But, you're right, GCC 4.7 accepts that normally.  I had put this patch 
together with GCC 4.6, my bad.

With that said, there's only one warning:

.../tools/lld/lib/Platforms/Darwin/ExecutableWriter.cpp:1222:30: 
warning: comparison between signed and unsigned integer expressions 
[-Wsign-compare]

If this is worth getting rid off, is this patch OK?

TIA

-- 
Evandro Menezes          Austin, TX          emenezes at codeaurora.org
Qualcomm Innovation Center, Inc is a member of the Code Aurora Forum


On 04/25/12 19:05, Joerg Sonnenberger wrote:
> On Wed, Apr 25, 2012 at 02:41:03PM -0500, Evandro Menezes wrote:
>> I noticed that LLD builds mostly cleanly, except for a some
>> warnings, which this proposed patch aims to fix.
>>
>> OK to commit?
>
> What GCC flags and language settings are you using? Take it the majority
> of those are about comma at the end of enums, which IIRC is legal now?
-------------- next part --------------
Index: lib/Platforms/Darwin/ExecutableWriter.cpp
===================================================================
--- lib/Platforms/Darwin/ExecutableWriter.cpp	(revision 155577)
+++ lib/Platforms/Darwin/ExecutableWriter.cpp	(working copy)
@@ -1219,7 +1219,7 @@ void SymbolStringsChunk::computeSize(const lld::Fi
 uint32_t SymbolStringsChunk::stringIndex(StringRef str) {
   uint32_t result = _strings.size();
   const char* s = str.data();
-  for (int i=0; i < str.size(); ++i) {
+  for (unsigned int i=0; i < str.size(); ++i) {
     _strings.push_back(s[i]);
   }
   _strings.push_back('\0');


More information about the llvm-commits mailing list