[llvm] r239729 - Avoid a "always true" warning from gcc.

Rafael Espindola rafael.espindola at gmail.com
Mon Jun 15 07:49:41 PDT 2015


Author: rafael
Date: Mon Jun 15 09:49:41 2015
New Revision: 239729

URL: http://llvm.org/viewvc/llvm-project?rev=239729&view=rev
Log:
Avoid a "always true" warning from gcc.

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

Modified: llvm/trunk/include/llvm/Object/ELFTypes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Object/ELFTypes.h?rev=239729&r1=239728&r2=239729&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Object/ELFTypes.h (original)
+++ llvm/trunk/include/llvm/Object/ELFTypes.h Mon Jun 15 09:49:41 2015
@@ -192,7 +192,9 @@ struct Elf_Sym_Impl : Elf_Sym_Base<ELFT>
     return st_shndx >= ELF::SHN_LOOS && st_shndx <= ELF::SHN_HIOS;
   }
   bool isReserved() const {
-    return st_shndx >= ELF::SHN_LORESERVE && st_shndx <= ELF::SHN_HIRESERVE;
+    // ELF::SHN_HIRESERVE is 0xffff so st_shndx <= ELF::SHN_HIRESERVE is always
+    // true and some compilers warn about it.
+    return st_shndx >= ELF::SHN_LORESERVE;
   }
   bool isUndefined() const { return st_shndx == ELF::SHN_UNDEF; }
 };





More information about the llvm-commits mailing list