<div dir="ltr">Yep, +1 to that.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Mar 2, 2021 at 10:00 AM Aaron Ballman <<a href="mailto:aaron@aaronballman.com">aaron@aaronballman.com</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 Tue, Mar 2, 2021 at 12:03 PM David Blaikie <<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>> wrote:<br>
><br>
> Any reason it shouldn't be a subgroup of -Wunused-function? I guess maybe because people already had codebases that were -Wunused-function clean, and we wouldn't want to regress that/start warning on new things/force them to have to add -Wno-unused-member-function to unbreak their builds?<br>
><br>
> (I guess there's some history here? Like perhaps -Wunused-function was initially implemented without member function support, and it was added later & so added under a separate flag to make rollout easier? But I think it'd probably still be OK for it to be under a subgroup - people could opt out of it initially without losing all their existing -Wunused-function-cleanliness, and opt in if they ever decided to do the extra cleanup)<br>
<br>
Here is the commit that introduced the feature (under a different flag<br>
that was later renamed to -Wunused-member-function):<br>
<a href="https://github.com/llvm/llvm-project/commit/cad715fb9bfd50370fa22ca62634048dcc85598b" rel="noreferrer" target="_blank">https://github.com/llvm/llvm-project/commit/cad715fb9bfd50370fa22ca62634048dcc85598b</a><br>
but I was not able to locate the discussion about the patch from the<br>
list archives.<br>
<br>
It looks like the big reason it's not under -Wunused is because the<br>
LLVM codebase isn't ready to handle it, but given that 11 years have<br>
passed, I feel like it would be reasonable to revisit the warning<br>
groups. Logically, I would expect -Wunused-function to include<br>
-Wunused-member-function and I would expect -Wunused to include them<br>
both. If LLVM is not able to handle that change, we can alter our<br>
CMake files.<br>
<br>
~Aaron<br>
<br>
><br>
> On Tue, Mar 2, 2021 at 6:05 AM Aaron Ballman <<a href="mailto:aaron@aaronballman.com" target="_blank">aaron@aaronballman.com</a>> wrote:<br>
>><br>
>> On Mon, Mar 1, 2021 at 8:22 PM David Blaikie <<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>> wrote:<br>
>> ><br>
>> > Not sure where the regression might've leaked in. But does seem to be something to do with anonymous namespace support and member functions: <a href="https://godbolt.org/z/zz8WP1" rel="noreferrer" target="_blank">https://godbolt.org/z/zz8WP1</a><br>
>><br>
>> I don't think there's a regression here, unless I'm missing something.<br>
>> -Wunused-member-function is what diagnoses this<br>
>> (<a href="https://godbolt.org/z/MxP4h6" rel="noreferrer" target="_blank">https://godbolt.org/z/MxP4h6</a>) but it is not a subgroup of either<br>
>> -Wunused-function or -Wunused<br>
>> (<a href="https://github.com/llvm/llvm-project/blob/main/clang/include/clang/Basic/DiagnosticGroups.td#L839" rel="noreferrer" target="_blank">https://github.com/llvm/llvm-project/blob/main/clang/include/clang/Basic/DiagnosticGroups.td#L839</a>).<br>
>> Perhaps we should explicitly enable it?<br>
>><br>
>> ~Aaron<br>
>><br>
>> ><br>
>> ><br>
>> ><br>
>> > On Mon, Mar 1, 2021 at 5:12 PM Luke Benes via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:<br>
>> >><br>
>> >><br>
>> >> By building llvm-project with gcc 7 and 10, I found multiple Wunused-function warnings that clang 11/12 missed.<br>
>> >><br>
>> >> All of these warnings were recently introduced, and the authors fixed many of them. Any ideas why clang misses so many of this category? And why the ones missed are recent changes to the llvm codebase?<br>
>> >><br>
>> >> -Luke<br>
>> >><br>
>> >><br>
>> >> ==========<br>
>> >><br>
>> >> After dab953c8e44a2 with gcc 10.2.1, I see the following new warnings:<br>
>> >><br>
>> >> [ 65%] Building CXX object lib/Linker/CMakeFiles/LLVMLinker.dir/IRMover.cpp.o<br>
>> >> /llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp:1600:1: warning: ‘std::pair<llvm::Value*, llvm::Value*> {anonymous}::DataFlowSanitizer::getShadowOriginAddress(llvm::Value*, llvm::Align, llvm::Instruction*)’ defined but not used [-Wunused-function]<br>
>> >> 1600 | DataFlowSanitizer::getShadowOriginAddress(Value *Addr, Align InstAlignment,<br>
>> >> | ^~~~~~~~~~~~~~~~~<br>
>> >> /llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp:1510:6: warning: ‘void {anonymous}::DFSanFunction::setOrigin(llvm::Instruction*, llvm::Value*)’ defined but not used [-Wunused-function]<br>
>> >> 1510 | void DFSanFunction::setOrigin(Instruction *I, Value *Origin) {<br>
>> >> | ^~~~~~~~~~~~~<br>
>> >> /llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp:1476:8: warning: ‘llvm::Value* {anonymous}::DFSanFunction::getOrigin(llvm::Value*)’ defined but not used [-Wunused-function]<br>
>> >> 1476 | Value *DFSanFunction::getOrigin(Value *V) {<br>
>> >> | ^~~~~~~~~~~~~<br>
>> >> /llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp:1469:8: warning: ‘llvm::Value* {anonymous}::DFSanFunction::getRetvalOriginTLS()’ defined but not used [-Wunused-function]<br>
>> >> 1469 | Value *DFSanFunction::getRetvalOriginTLS() { return DFS.RetvalOriginTLS; }<br>
>> >> | ^~~~~~~~~~~~~<br>
>> >><br>
>> >> FIX: <a href="https://github.com/llvm/llvm-project/commit/9524632fa2bf8c894e4aac27f03631a1915d84d3" rel="noreferrer" target="_blank">https://github.com/llvm/llvm-project/commit/9524632fa2bf8c894e4aac27f03631a1915d84d3</a><br>
>> >><br>
>> >> ==========<br>
>> >><br>
>> >> After bc8e262afe83, with gcc 10.1 but not clang 11, I'm seeing:<br>
>> >><br>
>> >> [ 21%] Building CXX object lib/MC/MCParser/CMakeFiles/LLVMMCParser.dir/MasmParser.cpp.o<br>
>> >> /llvm/lib/MC/MCParser/MasmParser.cpp:3836:6: warning: ‘bool {anonymous}::MasmParser::emitStructValue(const {anonymous}::StructInfo&)’ defined but not used [-Wunused-function]<br>
>> >> 3836 | bool MasmParser::emitStructValue(const StructInfo &Structure) {<br>
>> >> | ^~~~~~~~~~<br>
>> >><br>
>> >> FIX: <a href="https://reviews.llvm.org/D83898" rel="noreferrer" target="_blank">https://reviews.llvm.org/D83898</a><br>
>> >><br>
>> >> ==========<br>
>> >><br>
>> >> In 931a68f26b9a3, I'm seeing the following warning with gcc7 and gcc10:<br>
>> >> [ 70%] Building CXX object lib/CodeGen/CMakeFiles/LLVMCodeGen.dir/RegAllocPBQP.cpp.o<br>
>> >> /llvm/lib/CodeGen/RegAllocFast.cpp:384:6: warning: ‘bool {anonymous}::RegAllocFast::verifyRegStateMapping(const {anonymous}::RegAllocFast::LiveReg&) const’ defined but not used [-Wunused-function]<br>
>> >> bool RegAllocFast::verifyRegStateMapping(const LiveReg &LR) const {<br>
>> >> ^~~~~~~~~~~~<br>
>> >><br>
>> >> FIX: 0671a4c5087d40450603d9d26cf239f1a8b1367e<br>
>> >><br>
>> >> _______________________________________________<br>
>> >> LLVM Developers mailing list<br>
>> >> <a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
>> >> <a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div>