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

Martin Storsjö via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 9 04:42:03 PDT 2022


mstorsjo created this revision.
mstorsjo added a reviewer: MaskRay.
Herald added subscribers: StephenFan, arichardson, emaste.
Herald added a project: All.
mstorsjo requested review of this revision.
Herald added a project: LLVM.

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 ||


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D127395

Files:
  lld/ELF/SyntheticSections.cpp


Index: lld/ELF/SyntheticSections.cpp
===================================================================
--- lld/ELF/SyntheticSections.cpp
+++ lld/ELF/SyntheticSections.cpp
@@ -1593,7 +1593,7 @@
     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;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D127395.435500.patch
Type: text/x-patch
Size: 562 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220609/8090bce8/attachment.bin>


More information about the llvm-commits mailing list