[llvm] ea31a17 - [AArch64] Fix -Wunused-variable in -DLLVM_ENABLE_ASSERTIONS=off builds

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 25 08:31:27 PDT 2023


On Mon, Apr 24, 2023 at 7:26 PM Fangrui Song <i at maskray.me> wrote:

> On Mon, Apr 24, 2023 at 5:10 PM David Blaikie <dblaikie at gmail.com> wrote:
> >
> > Not sure if this is better than the traditional void casts?
> >
> > But if it is, maybe we should have a style guide
> discussion/authoritative suggestion about it? (& probably the sort of thing
> where a mass cleanup wouldn't be too bad - not sure anyone would much care
> about the blame lines on the existing void casts... )
>
> [[maybe_unused]] seems used in a few files, though far less common
> than (void)x as a C++17 construct.
>
> https://discourse.llvm.org/t/maybe-unused-vs-attribute-unused-vs-void-var-for-assert-variables/64212
> has a discussion about what is preferred.
> It seems that the opinions are split. There are quite a few folks
> favoring [[maybe_unused]].
>

I'd say, judging by both Chris Lattner and Reid Kleckner's perspective on
that, that it's in favour of the status quo & we should probably keep going
with void casts for consistency.


>
> > On Thu, Apr 13, 2023 at 12:41 PM Fangrui Song via llvm-commits <
> llvm-commits at lists.llvm.org> wrote:
> >>
> >>
> >> Author: Fangrui Song
> >> Date: 2023-04-13T12:40:55-07:00
> >> New Revision: ea31a17dbec14363d8fe141128067db453befdc2
> >>
> >> URL:
> https://github.com/llvm/llvm-project/commit/ea31a17dbec14363d8fe141128067db453befdc2
> >> DIFF:
> https://github.com/llvm/llvm-project/commit/ea31a17dbec14363d8fe141128067db453befdc2.diff
> >>
> >> LOG: [AArch64] Fix -Wunused-variable in -DLLVM_ENABLE_ASSERTIONS=off
> builds
> >>
> >> Added:
> >>
> >>
> >> Modified:
> >>     llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
> >>
> >> Removed:
> >>
> >>
> >>
> >>
> ################################################################################
> >> diff  --git a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
> b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
> >> index 4b4f8c7f62cd..92eee316eae8 100644
> >> --- a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
> >> +++ b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
> >> @@ -22217,7 +22217,7 @@ static void replaceBoolVectorBitcast(SDNode *N,
> >>    SDLoc DL(N);
> >>    SDValue Op = N->getOperand(0);
> >>    EVT VT = N->getValueType(0);
> >> -  EVT SrcVT = Op.getValueType();
> >> +  [[maybe_unused]] EVT SrcVT = Op.getValueType();
> >>    assert(SrcVT.isVector() && SrcVT.getVectorElementType() == MVT::i1 &&
> >>           "Must be bool vector.");
> >>
> >>
> >>
> >>
> >> _______________________________________________
> >> llvm-commits mailing list
> >> llvm-commits at lists.llvm.org
> >> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230425/fd97ea44/attachment.html>


More information about the llvm-commits mailing list