From 13e45d6fdec650e37ca8c6f41aaea24c6fa2c349 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Sat, 28 Mar 2015 18:56:43 +0100 Subject: [PATCH] loplugin:redundantcast: Don't warn about certain casts in macros ...that might depend on macro arguments and not really be redundant Change-Id: If19de3835a4972add58965ea7c0936fad7ef6957 --- compilerplugins/clang/redundantcast.cxx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/compilerplugins/clang/redundantcast.cxx b/compilerplugins/clang/redundantcast.cxx index 1f580e588293..22e2ddf0094a 100644 --- a/compilerplugins/clang/redundantcast.cxx +++ b/compilerplugins/clang/redundantcast.cxx @@ -25,6 +25,7 @@ #include "clang/Sema/Sema.h" +#include "compat.hxx" #include "plugin.hxx" namespace { @@ -143,7 +144,9 @@ if(!cc->getSubExpr()->getType()->isPointerType()){ } else if (isa(e) && isVoidPointer( dyn_cast(e)->getSubExpr() - ->IgnoreParenImpCasts()->getType())) + ->IgnoreParenImpCasts()->getType()) + && !compat::isMacroBodyExpansion( + compiler, e->getLocStart())) { report( DiagnosticsEngine::Warning,