loplugin:unusedvariablecheck tweak to find more stuff

but leave the tweak commented out, since it generates false positives

Change-Id: Iaf3f92414d2618f8780561f98765e33e282afe0c
Reviewed-on: https://gerrit.libreoffice.org/82121
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin
2019-11-06 10:47:15 +01:00
parent d746e6f7cb
commit 9e087d4a30
28 changed files with 25 additions and 56 deletions
@@ -421,8 +421,6 @@ bool AreaChart::impl_createLine( VDataSeries* pSeries
aPoint2.PositionY = aPoly.SequenceY[nPoly][nPoint];
aPoint2.PositionZ = aPoly.SequenceZ[nPoly][nPoint];
Stripe aStripe( aPoint1, aPoint2, fDepth );
m_pShapeFactory->createStripe(xSeriesGroupShape_Shapes
, Stripe( aPoint1, aPoint2, fDepth )
, pSeries->getPropertiesOfSeries(), PropertyMapper::getPropertyNameMapForFilledSeriesProperties(), true, 1 );
-2
View File
@@ -2893,7 +2893,6 @@ OUString ChartView::dump()
uno::Reference< drawing::XShapes > xShape(xShapes->getByIndex(i), uno::UNO_QUERY);
if(xShape.is())
{
XShapeDumper dumper;
OUString aString = XShapeDumper::dump(mxRootShape);
aBuffer.append(aString);
}
@@ -2902,7 +2901,6 @@ OUString ChartView::dump()
uno::Reference< drawing::XShape > xSingleShape(xShapes->getByIndex(i), uno::UNO_QUERY);
if(!xSingleShape.is())
continue;
XShapeDumper dumper;
OUString aString = XShapeDumper::dump(xSingleShape);
aBuffer.append(aString);
}
+15 -1
View File
@@ -53,7 +53,21 @@ bool UnusedVariableCheck::VisitVarDecl( const VarDecl* var )
return true;
if( var->isDefinedOutsideFunctionOrMethod())
return true;
if( loplugin::isExtraWarnUnusedType(var->getType()))
auto type = var->getType();
bool check = loplugin::isExtraWarnUnusedType(type);
// this chunk of logic generates false+, which is why we don't leave it on
/*
if (!check && type->isRecordType())
{
auto recordDecl
= dyn_cast_or_null<CXXRecordDecl>(type->getAs<RecordType>()->getDecl());
if (recordDecl && recordDecl->hasDefinition() && recordDecl->hasTrivialDestructor())
check = true;
}
*/
if(check)
{
if( const ParmVarDecl* param = dyn_cast< ParmVarDecl >( var ))
{
@@ -734,8 +734,6 @@ bool OSelectionBrowseBox::saveField(OUString& _sFieldName ,OTableFieldDescRef co
}
else // travel through the select column parse node
{
::comphelper::UStringMixEqual bCase(xMetaData->supportsMixedCaseQuotedIdentifiers());
OTableFieldDescRef aSelEntry = _pEntry;
sal_uInt16 nColumnId = aSelEntry->GetColumnId();
@@ -47,12 +47,6 @@
#define DEBUG_DUMPER 0
using namespace com::sun::star;
//class XShapeDumper
XShapeDumper::XShapeDumper()
{
}
namespace {
@@ -689,7 +689,6 @@ IMPL_LINK( MenuBarManager, Activate, Menu *, pMenu, bool )
if ( xDispatchProvider.is() )
{
vcl::KeyCode aEmptyKeyCode;
SvtCommandOptions aCmdOptions;
for (auto const& menuItemHandler : m_aMenuItemHandlerVector)
{
+2 -4
View File
@@ -17,11 +17,9 @@ namespace com::sun::star::drawing { class XShape; }
namespace com::sun::star::drawing { class XShapes; }
namespace com::sun::star::uno { template <typename > class Reference; }
class DRAWINGLAYER_DLLPUBLIC XShapeDumper
struct DRAWINGLAYER_DLLPUBLIC XShapeDumper
{
public:
XShapeDumper();
XShapeDumper() = delete;
static OUString dump(const css::uno::Reference<css::drawing::XShapes>& xPageShapes, bool bDumpInteropProperties=false);
static OUString dump(const css::uno::Reference<css::drawing::XShape>& xPageShapes, bool bDumpInteropProperties=false);
};
+3 -8
View File
@@ -88,11 +88,7 @@ struct ScFuncDescCore
sal_uInt8 const aOptionalArgs[7];
};
class ScFuncRes
{
public:
ScFuncRes(const ScFuncDescCore &rEntry, ScFuncDesc*, bool& rbSuppressed);
};
static void ScFuncRes(const ScFuncDescCore &rEntry, ScFuncDesc*, bool& rbSuppressed);
// class ScFuncDesc:
ScFuncDesc::ScFuncDesc() :
@@ -815,7 +811,7 @@ ScFunctionList::ScFunctionList()
pDesc = new ScFuncDesc;
bool bSuppressed = false;
ScFuncRes aSubRes(*pEntry, pDesc, bSuppressed);
ScFuncRes(*pEntry, pDesc, bSuppressed);
// Instead of dealing with this exceptional case at 1001 places
// we simply don't add an entirely suppressed function to the
// list and delete it.
@@ -1185,8 +1181,7 @@ sal_Unicode ScFunctionMgr::getSingleToken(const formula::IFunctionManager::EToke
return 0;
}
// class ScFuncRes:
ScFuncRes::ScFuncRes(const ScFuncDescCore &rEntry, ScFuncDesc* pDesc, bool& rbSuppressed)
static void ScFuncRes(const ScFuncDescCore &rEntry, ScFuncDesc* pDesc, bool& rbSuppressed)
{
const sal_uInt16 nOpCode = rEntry.nOpCode;
sal_uInt16 nFunctionFlags = rEntry.nFunctionFlags;
-1
View File
@@ -257,7 +257,6 @@ void SheetDataBuffer::setFormulaCell( const CellModel& rModel, const ApiTokenSeq
reading the formula definition it will be retried to insert the
formula via retryPendingSharedFormulaCell(). */
ScAddress aTokenAddr( aTokenInfo.First.Column, aTokenInfo.First.Row, aTokenInfo.First.Sheet );
BinAddress aBaseAddr( aTokenAddr );
aTokens = resolveSharedFormula( aTokenAddr );
if( !aTokens.hasElements() )
{
+1 -1
View File
@@ -72,7 +72,7 @@ void QProToSc::DoFunc( DefTokenId eOc, sal_uInt16 nArgs, const sal_Char* pExtStr
{
TokenId eParam[ nBufSize ];
sal_Int32 nCount;
TokenId nPush, nPush1;
TokenId nPush;
bool bAddIn = false;
-1
View File
@@ -69,7 +69,6 @@ OUString SAL_CALL ScVbaPageSetup::getPrintArea()
const uno::Sequence< table::CellRangeAddress > aSeq = xPrintAreas->getPrintAreas();
if( aSeq.hasElements() )
{
ScAddress::Details aDetails( formula::FormulaGrammar::CONV_XL_A1, 0, 0 );
ScRangeList aRangeList;
for( const auto& rRange : aSeq )
{
-1
View File
@@ -965,7 +965,6 @@ void ScDBFunc::DateGroupDataPilot( const ScDPNumGroupInfo& rInfo, sal_Int32 nPar
{
// create date group dimensions
ScDPNumGroupInfo aEmpty;
bool bFirst = true;
sal_Int32 nMask = 1;
for (sal_uInt16 nBit=0; nBit<32; nBit++)
-1
View File
@@ -317,7 +317,6 @@ protected:
uno::Reference< drawing::XDrawPages > xDrawPages = xDrawPagesSupplier->getDrawPages();
CPPUNIT_ASSERT(xDrawPages.is());
XShapeDumper aShapeDumper;
sal_Int32 nLength = xDrawPages->getCount();
for (sal_Int32 i = 0; i < nLength; ++i)
{
-2
View File
@@ -637,8 +637,6 @@ void SdDrawDocument::CreateDefaultCellStyles()
pSheet->SetHelpId( OUString(), HID_SD_CELL_STYLE_DEFAULT );
SfxItemSet& rISet = pSheet->GetItemSet();
XHatch aNullHatch(COL_BLACK);
rISet.Put(XFillStyleItem(drawing::FillStyle_SOLID));
rISet.Put(XFillColorItem(OUString(), Color(0x00ccccff)));
-1
View File
@@ -478,7 +478,6 @@ uno::Reference< io::XStream > getAdditionalStream( const OUString&
return xEmbed;
aPDFFile = OUStringToOString( aSysUPath, osl_getThreadTextEncoding() );
pdfparse::PDFReader aParser;
std::unique_ptr<pdfparse::PDFEntry> pEntry( pdfparse::PDFReader::read( aPDFFile.getStr() ));
if( pEntry )
{
+2 -3
View File
@@ -286,10 +286,9 @@ struct PDFPart : public PDFContainer
virtual PDFEntry* clone() const override;
};
class PDFReader
struct PDFReader
{
public:
PDFReader() {}
PDFReader() = delete;
static std::unique_ptr<PDFEntry> read( const char* pFileName );
#ifdef _WIN32
-2
View File
@@ -214,8 +214,6 @@ typedef int(*PDFFileHdl)(const char*, const char*, PDFFile*);
static int handleFile( const char* pInFile, const char* pOutFile, const char* pPassword, PDFFileHdl pHdl )
{
PDFReader aParser;
int nRet = 0;
std::unique_ptr<PDFEntry> pEntry = pdfparse::PDFReader::read( pInFile );
if( pEntry )
@@ -910,7 +910,6 @@ static bool checkEncryption( const OUString& i_rPa
bool bSuccess = false;
OString aPDFFile = OUStringToOString( i_rPath, osl_getThreadTextEncoding() );
pdfparse::PDFReader aParser;
std::unique_ptr<pdfparse::PDFEntry> pEntry( pdfparse::PDFReader::read( aPDFFile.getStr() ));
if( pEntry )
{
-3
View File
@@ -103,9 +103,6 @@ Reference<ui::XUIElement> SAL_CALL PanelFactory::createUIElement (
Reference<ui::XSidebar> xSidebar (aArguments.getOrDefault("Sidebar", Reference<ui::XSidebar>()));
const sal_uInt64 nBindingsValue (aArguments.getOrDefault("SfxBindings", sal_uInt64(0)));
SfxBindings* pBindings = reinterpret_cast<SfxBindings*>(nBindingsValue);
vcl::EnumContext aContext (
aArguments.getOrDefault("ApplicationName", OUString()),
aArguments.getOrDefault("ContextName", OUString()));
VclPtr<vcl::Window> pParentWindow = VCLUnoHelper::GetWindow(xParentWindow);
if ( ! xParentWindow.is() || pParentWindow==nullptr)
+2 -3
View File
@@ -40,10 +40,9 @@ public:
XGradient aGradient;
};
class GradTransformer
struct GradTransformer
{
public:
GradTransformer() {}
GradTransformer() = delete;
static void GradToVec(GradTransGradient const & rG, GradTransVector& rV,
const SdrObject* pObj);
-1
View File
@@ -1371,7 +1371,6 @@ void SdrHdlGradient::FromIAOToItem(SdrObject* _pObj, bool bSetItemOnObject, bool
// from IAO positions and colors to gradient
const SfxItemSet& rSet = _pObj->GetMergedItemSet();
GradTransformer aGradTransformer;
GradTransGradient aOldGradTransGradient;
GradTransGradient aGradTransGradient;
GradTransVector aGradTransVector;
-2
View File
@@ -1318,7 +1318,6 @@ void SdrMarkView::AddDragModeHdl(SdrDragMode eMode)
}
// set values and transform to vector set
GradTransformer aGradTransformer;
GradTransVector aGradTransVector;
GradTransGradient aGradTransGradient;
@@ -1359,7 +1358,6 @@ void SdrMarkView::AddDragModeHdl(SdrDragMode eMode)
if(eFillStyle == drawing::FillStyle_GRADIENT)
{
// set values and transform to vector set
GradTransformer aGradTransformer;
GradTransVector aGradTransVector;
GradTransGradient aGradTransGradient;
Size aHdlSize(15, 15);
-1
View File
@@ -2149,7 +2149,6 @@ bool SdrEdgeObj::ImpFindConnector(const Point& rPt, const SdrPageView& rPV, SdrO
size_t no=pOL->GetObjCount();
bool bFnd = false;
SdrObjConnection aTestCon;
SdrObjConnection aBestCon;
while (no>0 && !bFnd) {
// issue: group objects on different layers return LayerID=0!
-1
View File
@@ -1106,7 +1106,6 @@ void SwFrameShell::ExecFrameStyle(SfxRequest const & rReq)
}
aBoxItem = aNewBox;
SvxBorderLine aDestBorderLine;
if( aBoxItem->GetTop() != nullptr )
aBoxItem->SetLine(&aBorderLine, SvxBoxItemLine::TOP);
-1
View File
@@ -567,7 +567,6 @@ void SwSrcView::StartSearchAndReplace(const SvxSearchItem& rSearchItem,
bool bRecursive)
{
TextView* pTextView = aEditWin->GetTextView();
TextSelection aSel;
TextPaM aPaM;
bool bForward = !rSearchItem.GetBackward();
-1
View File
@@ -150,7 +150,6 @@ executeUnknownAuthDialog(
aArguments.push_back( getContentPart( rXCert->getSubjectName()) );
std::locale aResLocale(Translate::Create("uui"));
ErrorResource aErrorResource(RID_UUI_ERRHDL, aResLocale);
aMessage = Translate::get(STR_UUI_UNKNOWNAUTH_UNTRUSTED, aResLocale);
aMessage = UUIInteractionHelper::replaceMessageWithArguments(
-2
View File
@@ -1048,8 +1048,6 @@ bool Bitmap::CombineSimple(const Bitmap& rMask, BmpCombine eCombine)
const long nWidth = std::min(pMaskAcc->Width(), pAcc->Width());
const long nHeight = std::min(pMaskAcc->Height(), pAcc->Height());
const Color aColBlack(COL_BLACK);
BitmapColor aPixel;
BitmapColor aMaskPixel;
const BitmapColor aWhite(pAcc->GetBestMatchingColor(COL_WHITE));
const BitmapColor aBlack(pAcc->GetBestMatchingColor(aColBlack));
const BitmapColor aMaskBlack(pMaskAcc->GetBestMatchingColor(aColBlack));
-1
View File
@@ -1108,7 +1108,6 @@ bool ImplWriteDIBPalette( SvStream& rOStm, BitmapReadAccess const & rAcc )
const sal_uLong nPalSize = nColors * 4UL;
std::unique_ptr<sal_uInt8[]> pEntries(new sal_uInt8[ nPalSize ]);
sal_uInt8* pTmpEntry = pEntries.get();
BitmapColor aPalColor;
for( sal_uInt16 i = 0; i < nColors; i++ )
{