r175721 - StaticAnalyzer/Core: Suppress warnings. [-Wunused-variable, -Wunused-function]

Aaron Ballman aaron at aaronballman.com
Fri Jul 26 19:18:26 PDT 2013


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?  If so,
perhaps it could be done:
void *unused = &isValidBaseClass;
(void)unused;

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



More information about the cfe-commits mailing list