[PATCH] D45082: [RFC][unittests] ADT: silence -Wself-assign diagnostics

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 3 08:25:38 PDT 2018


That's fair (re: cast over &*)

On Sat, Mar 31, 2018 at 9:53 AM John McCall via Phabricator <
reviews at reviews.llvm.org> wrote:

> rjmccall added a comment.
>
> In https://reviews.llvm.org/D45082#1053724, @lebedev.ri wrote:
>
> > - Rebase
> > - Drop comments
> > - Silence the warning via "*&" contraption, not by casting to the
> reference.
> >
> >   The main question still stands, do we want to recommend everyone to
> use that in their codebases, or double the amount of diag flags and provide
> a way to silence this specific diagnostic?
>
>
> I think it's probably best to just provide a blessed way of silencing the
> warning in code and recommend that people adopt that.  A good analogue here
> is the use of unnecessary parentheses to silence the -Wparens warning about
> using '=' instead of '==' in an if-condition; we've always recognized that
> there are legitimate reasons to write code that way, so we just picked a
> code idiom that we promise will always shut the warning off and tell people
> to use it if they need it.
>
> I think I still prefer casting the RHS as the idiom to bless here, on the
> grounds that casts are the more universal "treat this as an opaque value"
> tool; for example, that's how you tell -Wconversion to shut up.  On the
> other hand, *& is certainly not something that we expect to see much of in
> ordinary code, so it works, and it's definitely a less annoying thing to
> type.
>
>
> Repository:
>   rL LLVM
>
> https://reviews.llvm.org/D45082
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180403/b48f1948/attachment.html>


More information about the llvm-commits mailing list