[lld] r298078 - [ELF] - Simplify logic of creating "COMMON" section.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 17 12:35:46 PDT 2017


On Fri, Mar 17, 2017 at 6:28 AM, George Rimar via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> >I am now getting:
> >
> >/home/fedora/llvm/llvm/tools/lld/ELF/Writer.cpp:361:24: warning: using
> the result of an assignment as a condition without >parentheses
> [-Wparentheses]
> >
> >Cheers,
> >Rafael
>
> Fixed in r298082
>
> It probably better then form sugested by compiler:
>   if ((In<ELFT>::Common = createCommonSection<ELFT>()))
>     Add(In<ELFT>::Common);


I don't know why I missed this during code review, but adding parentheses
isn't a good way to fix the warning. You should use more vertical space.

  In<ELFT>::Common = createCommonSection<ELFT>();
  if (In<ELFT>::Common)
    ....
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170317/fb359f8d/attachment.html>


More information about the llvm-commits mailing list