r175721 - StaticAnalyzer/Core: Suppress warnings. [-Wunused-variable, -Wunused-function]
David Blaikie
dblaikie at gmail.com
Fri Jul 26 20:23:51 PDT 2013
On Fri, Jul 26, 2013 at 7:18 PM, Aaron Ballman <aaron at aaronballman.com> wrote:
> On Wed, Feb 20, 2013 at 11:40 PM, NAKAMURA Takumi <geek4civic at gmail.com> wrote:
>> Author: chapuni
>> Date: Wed Feb 20 22:40:10 2013
>> New Revision: 175721
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=175721&view=rev
>> Log:
>> StaticAnalyzer/Core: Suppress warnings. [-Wunused-variable, -Wunused-function]
>>
>> Modified:
>> cfe/trunk/lib/StaticAnalyzer/Core/MemRegion.cpp
>>
>> Modified: cfe/trunk/lib/StaticAnalyzer/Core/MemRegion.cpp
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/MemRegion.cpp?rev=175721&r1=175720&r2=175721&view=diff
>> ==============================================================================
>> --- cfe/trunk/lib/StaticAnalyzer/Core/MemRegion.cpp (original)
>> +++ cfe/trunk/lib/StaticAnalyzer/Core/MemRegion.cpp Wed Feb 20 22:40:10 2013
>> @@ -915,8 +915,9 @@ MemRegionManager::getCXXBaseObjectRegion
>> bool IsVirtual) {
>> RD = RD->getCanonicalDecl();
>>
>> - if (const TypedValueRegion *TVR = dyn_cast<TypedValueRegion>(Super)) {
>> - assert(isValidBaseClass(RD, TVR, IsVirtual));
>> + if (isa<TypedValueRegion>(Super)) {
>> + assert(isValidBaseClass(RD, dyn_cast<TypedValueRegion>(Super), IsVirtual));
>> + (void)isValidBaseClass;
>
> Sorry to resurrect an ancient patch, but what warning is this
> suppressing with the cast to void? Is the call function considered
> unused in release builds because it's part of the assert?
That's most likely the case.
> If so,
> perhaps it could be done:
> void *unused = &isValidBaseClass;
> (void)unused;
Would:
(void)&isValidBaseClass;
work?
Otherwise, I believe in other cases we've wrapped such support
functions in #ifndef NDEBUG or whatever. (or possibly annotated them
with LLVM_USED or LLVM_UNUSED, but neither's quite the right fit)
>
> I ask because it is the only place that triggers C4551 (function call
> missing argument list) in MSVC when I re-enable the warning.
> Ultimately, I would like to re-enable that warning since there's no
> valid reason for it to be turned off outside of this case.
>
> Thanks!
>
> ~Aaron
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
More information about the cfe-commits
mailing list