[lld] 9617ffc - [LLD] [ELF] Add parentheses to silence a GCC warning. NFC.

Martin Storsjö via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 9 12:32:07 PDT 2022


Author: Martin Storsjö
Date: 2022-06-09T22:26:37+03:00
New Revision: 9617ffce0d376afe2539f477533f8c14f769cc6e

URL: https://github.com/llvm/llvm-project/commit/9617ffce0d376afe2539f477533f8c14f769cc6e
DIFF: https://github.com/llvm/llvm-project/commit/9617ffce0d376afe2539f477533f8c14f769cc6e.diff

LOG: [LLD] [ELF] Add parentheses to silence a GCC warning. NFC.

This silences the following warning:

../tools/lld/ELF/SyntheticSections.cpp:1596:48: warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses]
 1596 |   assert((index != 0 || type != target->gotRel && type != target->pltRel ||

Differential Revision: https://reviews.llvm.org/D127395

Added: 
    

Modified: 
    lld/ELF/SyntheticSections.cpp

Removed: 
    


################################################################################
diff  --git a/lld/ELF/SyntheticSections.cpp b/lld/ELF/SyntheticSections.cpp
index 900f17fb299d1..2f16ddcd5b972 100644
--- a/lld/ELF/SyntheticSections.cpp
+++ b/lld/ELF/SyntheticSections.cpp
@@ -1593,7 +1593,7 @@ uint32_t DynamicReloc::getSymIndex(SymbolTableBaseSection *symTab) const {
     return 0;
 
   size_t index = symTab->getSymbolIndex(sym);
-  assert((index != 0 || type != target->gotRel && type != target->pltRel ||
+  assert((index != 0 || (type != target->gotRel && type != target->pltRel) ||
           !mainPart->dynSymTab->getParent()) &&
          "GOT or PLT relocation must refer to symbol in dynamic symbol table");
   return index;


        


More information about the llvm-commits mailing list