<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Apr 24, 2023 at 7:26 PM Fangrui Song <<a href="mailto:i@maskray.me">i@maskray.me</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Mon, Apr 24, 2023 at 5:10 PM David Blaikie <<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>> wrote:<br>
><br>
> Not sure if this is better than the traditional void casts?<br>
><br>
> 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... )<br>
<br>
[[maybe_unused]] seems used in a few files, though far less common<br>
than (void)x as a C++17 construct.<br>
<a href="https://discourse.llvm.org/t/maybe-unused-vs-attribute-unused-vs-void-var-for-assert-variables/64212" rel="noreferrer" target="_blank">https://discourse.llvm.org/t/maybe-unused-vs-attribute-unused-vs-void-var-for-assert-variables/64212</a><br>
has a discussion about what is preferred.<br>
It seems that the opinions are split. There are quite a few folks<br>
favoring [[maybe_unused]].<br></blockquote><div><br>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.<br> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
> On Thu, Apr 13, 2023 at 12:41 PM Fangrui Song via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>> wrote:<br>
>><br>
>><br>
>> Author: Fangrui Song<br>
>> Date: 2023-04-13T12:40:55-07:00<br>
>> New Revision: ea31a17dbec14363d8fe141128067db453befdc2<br>
>><br>
>> URL: <a href="https://github.com/llvm/llvm-project/commit/ea31a17dbec14363d8fe141128067db453befdc2" rel="noreferrer" target="_blank">https://github.com/llvm/llvm-project/commit/ea31a17dbec14363d8fe141128067db453befdc2</a><br>
>> DIFF: <a href="https://github.com/llvm/llvm-project/commit/ea31a17dbec14363d8fe141128067db453befdc2.diff" rel="noreferrer" target="_blank">https://github.com/llvm/llvm-project/commit/ea31a17dbec14363d8fe141128067db453befdc2.diff</a><br>
>><br>
>> LOG: [AArch64] Fix -Wunused-variable in -DLLVM_ENABLE_ASSERTIONS=off builds<br>
>><br>
>> Added:<br>
>><br>
>><br>
>> Modified:<br>
>> llvm/lib/Target/AArch64/AArch64ISelLowering.cpp<br>
>><br>
>> Removed:<br>
>><br>
>><br>
>><br>
>> ################################################################################<br>
>> diff --git a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp<br>
>> index 4b4f8c7f62cd..92eee316eae8 100644<br>
>> --- a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp<br>
>> +++ b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp<br>
>> @@ -22217,7 +22217,7 @@ static void replaceBoolVectorBitcast(SDNode *N,<br>
>> SDLoc DL(N);<br>
>> SDValue Op = N->getOperand(0);<br>
>> EVT VT = N->getValueType(0);<br>
>> - EVT SrcVT = Op.getValueType();<br>
>> + [[maybe_unused]] EVT SrcVT = Op.getValueType();<br>
>> assert(SrcVT.isVector() && SrcVT.getVectorElementType() == MVT::i1 &&<br>
>> "Must be bool vector.");<br>
>><br>
>><br>
>><br>
>><br>
>> _______________________________________________<br>
>> llvm-commits mailing list<br>
>> <a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br>
>> <a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</blockquote></div></div>