[Libreoffice-commits] core.git: compilerplugins/clang sw/source

2023-11-25 Thread Noel Grandin (via logerrit)
 compilerplugins/clang/fieldcast.results |3 -
 sw/source/ui/misc/glossary.cxx  |5 +-
 sw/source/uibase/inc/unotools.hxx   |6 ++-
 sw/source/uibase/utlui/unotools.cxx |   54 +---
 4 files changed, 29 insertions(+), 39 deletions(-)

New commits:
commit d54ae809aa29fa7a9894c0a1236374fa96e01a43
Author: Noel Grandin 
AuthorDate: Sat Nov 25 11:14:44 2023 +0200
Commit: Noel Grandin 
CommitDate: Sat Nov 25 15:22:28 2023 +0100

loplugin:fieldcast in SwOneExampleFrame

Change-Id: Ic00ad388b2c18d90075db8e8d0d6b114ed13841a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159948
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/compilerplugins/clang/fieldcast.results 
b/compilerplugins/clang/fieldcast.results
index 6fa27d645135..c1ede6ef7ae5 100644
--- a/compilerplugins/clang/fieldcast.results
+++ b/compilerplugins/clang/fieldcast.results
@@ -547,9 +547,6 @@ sw/source/uibase/inc/fldmgr.hxx:103
 sw/source/uibase/inc/swuiccoll.hxx:35
 SwCondCollPage m_pFormat SwFormat *
 SwConditionTextFormatColl
-sw/source/uibase/inc/unotools.hxx:48
-SwOneExampleFrame m_xCursor css::uno::Reference
-OTextCursorHelper
 unoidl/source/unoidl-read.cxx:151
 (anonymous namespace)::Entity entity const rtl::Reference
 unoidl::PublishableEntity
diff --git a/sw/source/ui/misc/glossary.cxx b/sw/source/ui/misc/glossary.cxx
index c7183d5126e1..8b2860c20c29 100644
--- a/sw/source/ui/misc/glossary.cxx
+++ b/sw/source/ui/misc/glossary.cxx
@@ -54,6 +54,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -1042,7 +1043,7 @@ void SwGlossaryDlg::ResumeShowAutoText()
 m_xAutoText = text::AutoTextContainer::create( 
comphelper::getProcessComponentContext() );
 }
 
-uno::Reference< XTextCursor > & xCursor = 
m_xExampleFrame->GetTextCursor();
+rtl::Reference< SwXTextCursor > & xCursor = 
m_xExampleFrame->GetTextCursor();
 if(xCursor.is())
 {
 if (!sShortName.isEmpty())
@@ -1054,7 +1055,7 @@ void SwGlossaryDlg::ResumeShowAutoText()
 uno::Any aEntry(xGroup->getByName(sShortName));
 uno::Reference< XAutoTextEntry >  xEntry;
 aEntry >>= xEntry;
-xEntry->applyTo(xCursor);
+
xEntry->applyTo(static_cast(xCursor.get()));
 }
 }
 }
diff --git a/sw/source/uibase/inc/unotools.hxx 
b/sw/source/uibase/inc/unotools.hxx
index cda9ec73fcd5..e472a2f92706 100644
--- a/sw/source/uibase/inc/unotools.hxx
+++ b/sw/source/uibase/inc/unotools.hxx
@@ -29,6 +29,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #define EX_SHOW_ONLINE_LAYOUT   0x01
 // hard zoom value
@@ -39,13 +40,14 @@
 #define EX_LOCALIZE_TOC_STRINGS 0x08
 
 class SwView;
+class SwXTextCursor;
 
 class SW_DLLPUBLIC SwOneExampleFrame final : public 
weld::CustomWidgetController
 {
 ScopedVclPtr m_xVirDev;
 css::uno::Reference< css::frame::XModel > m_xModel;
 css::uno::Reference< css::frame::XController >m_xController;
-css::uno::Reference< css::text::XTextCursor > m_xCursor;
+rtl::Reference< SwXTextCursor >   m_xCursor;
 
 Idlem_aLoadedIdle;
 Link m_aInitializedLink;
@@ -74,7 +76,7 @@ public:
 virtual ~SwOneExampleFrame() override;
 
 css::uno::Reference< css::frame::XModel > &   GetModel()  {return 
m_xModel;}
-css::uno::Reference< css::text::XTextCursor > &   GetTextCursor() {return 
m_xCursor;}
+rtl::Reference< SwXTextCursor > & GetTextCursor() {return 
m_xCursor;}
 
 void ClearDocument();
 
diff --git a/sw/source/uibase/utlui/unotools.cxx 
b/sw/source/uibase/utlui/unotools.cxx
index 7e72566685e2..93edfaad30a7 100644
--- a/sw/source/uibase/utlui/unotools.cxx
+++ b/sw/source/uibase/utlui/unotools.cxx
@@ -26,6 +26,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -143,8 +144,7 @@ void SwOneExampleFrame::Paint(vcl::RenderContext& 
rRenderContext, const tools::R
 Color aBgColor = 
SW_MOD()->GetColorConfig().GetColorValue(::svtools::DOCCOLOR).nColor;
 m_xVirDev->DrawWallpaper(tools::Rectangle(Point(), aSize), aBgColor);
 
-auto pCursor = dynamic_cast(m_xCursor.get());
-if (pCursor)
+if (m_xCursor)
 {
 uno::Reference xSettings(m_xController, 
uno::UNO_QUERY);
 uno::Reference  xViewProps = 
xSettings->getViewSettings();
@@ -156,7 +156,7 @@ void SwOneExampleFrame::Paint(vcl::RenderContext& 
rRenderContext, const tools::R
 
 m_xVirDev->Push(vcl::PushFlags::ALL);
 m_xVirDev->SetMapMode(MapMode(MapUnit::MapTwip));
-SwDoc *pDoc = pCursor->GetDoc();
+SwDoc *pDoc = m_xCursor->GetDoc();
 SwDocShell* pShell = pDoc->GetDocShell();
 tools::Rectangle aRect(Point(), m_xVirDev->PixelToLogic(aSize));
 pShell->SetVisArea(tools::Rectangle(Point(), 

[Libreoffice-commits] core.git: compilerplugins/clang sw/source

2023-11-22 Thread Noel Grandin (via logerrit)
 compilerplugins/clang/fieldcast.results |3 ---
 sw/source/uibase/dochdl/swdtflvr.cxx|6 +-
 sw/source/uibase/inc/swdtflvr.hxx   |4 +++-
 3 files changed, 4 insertions(+), 9 deletions(-)

New commits:
commit 68a2e50726e2f16354ff45d6768790e076989cb6
Author: Noel Grandin 
AuthorDate: Wed Nov 22 11:41:26 2023 +0200
Commit: Noel Grandin 
CommitDate: Wed Nov 22 18:38:45 2023 +0100

loplugin:fieldcast in SwTransferable

Change-Id: I8e9f157a399f1b305d2e6b6e63da837f0090fd8b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159814
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/compilerplugins/clang/fieldcast.results 
b/compilerplugins/clang/fieldcast.results
index e65cc5123250..0bdabb345340 100644
--- a/compilerplugins/clang/fieldcast.results
+++ b/compilerplugins/clang/fieldcast.results
@@ -565,9 +565,6 @@ sw/source/ui/dialog/swdlgfact.hxx:562
 sw/source/uibase/inc/fldmgr.hxx:103
 SwFieldMgr m_pCurField SwField *
 SwPageNumberField
-sw/source/uibase/inc/swdtflvr.hxx:81
-SwTransferable m_xDdeLink tools::SvRef
-(anonymous namespace)::SwTransferDdeLink
 sw/source/uibase/inc/swuiccoll.hxx:35
 SwCondCollPage m_pFormat SwFormat *
 SwConditionTextFormatColl
diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx 
b/sw/source/uibase/dochdl/swdtflvr.cxx
index 91eb38e0f45c..cb96c08527c6 100644
--- a/sw/source/uibase/dochdl/swdtflvr.cxx
+++ b/sw/source/uibase/dochdl/swdtflvr.cxx
@@ -173,8 +173,6 @@ void collectUIInformation(const OUString& rAction, const 
OUString& aParameters)
 
 }
 
-namespace {
-
 class SwTransferDdeLink : public ::sfx2::SvBaseLink
 {
 OUString m_sName;
@@ -204,8 +202,6 @@ public:
 void Disconnect( bool bRemoveDataAdvise );
 };
 
-}
-
 /// Tracks the boundaries of pasted content and notifies listeners.
 class SwPasteContext
 {
@@ -393,7 +389,7 @@ void SwTransferable::DisconnectDDE()
 {
 if( m_xDdeLink.is() )
 {
-static_cast( m_xDdeLink.get() )->Disconnect( true 
);
+m_xDdeLink->Disconnect( true );
 m_xDdeLink.clear();
 }
 }
diff --git a/sw/source/uibase/inc/swdtflvr.hxx 
b/sw/source/uibase/inc/swdtflvr.hxx
index e7e1849a0dc9..6234bd37294b 100644
--- a/sw/source/uibase/inc/swdtflvr.hxx
+++ b/sw/source/uibase/inc/swdtflvr.hxx
@@ -73,12 +73,14 @@ enum class PasteTableType
 PASTE_TABLE// paste table as nested table
 };
 
+class SwTransferDdeLink;
+
 class SW_DLLPUBLIC SwTransferable final : public TransferableHelper
 {
 friend class SwView_Impl;
 SfxObjectShellLock  m_aDocShellRef;
 TransferableObjectDescriptorm_aObjDesc;
-tools::SvRef  m_xDdeLink;
+tools::SvRef  m_xDdeLink;
 
 SwWrtShell  *m_pWrtShell;
 /* #96392# Added pCreatorView to distinguish SwFrameShell from


[Libreoffice-commits] core.git: compilerplugins/clang sw/source

2022-09-21 Thread Stephan Bergmann (via logerrit)
 compilerplugins/clang/redundantcast.cxx  |   18 ++
 compilerplugins/clang/test/redundantcast.cxx |7 +++
 sw/source/core/inc/frame.hxx |4 ++--
 3 files changed, 27 insertions(+), 2 deletions(-)

New commits:
commit 70f8bddf87537e5ca28758a1f59bda23c0963501
Author: Stephan Bergmann 
AuthorDate: Wed Sep 21 08:41:28 2022 +0200
Commit: Stephan Bergmann 
CommitDate: Wed Sep 21 15:09:26 2022 +0200

Extend loplugin:redundantcast to some suspicious reinterpret_cast

Change-Id: I5534939bfbea67d216a17891722a683c53621d36
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140303
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/compilerplugins/clang/redundantcast.cxx 
b/compilerplugins/clang/redundantcast.cxx
index b95a742cb2a2..8d7de5365d89 100644
--- a/compilerplugins/clang/redundantcast.cxx
+++ b/compilerplugins/clang/redundantcast.cxx
@@ -682,6 +682,24 @@ bool RedundantCast::VisitCXXReinterpretCastExpr(
 return true;
 }
 }
+if (auto const t1 = 
expr->getSubExpr()->getType()->getAs()) {
+if (auto const t2 = expr->getType()->getAs()) {
+if (auto const d1 = t1->getPointeeCXXRecordDecl()) {
+if (auto const d2 = t2->getPointeeCXXRecordDecl()) {
+if (d1->hasDefinition() && d1->isDerivedFrom(d2)) {
+report(
+DiagnosticsEngine::Warning,
+"suspicious reinterpret_cast from derived %0 to 
base %1, maybe this was"
+" meant to be a static_cast",
+expr->getExprLoc())
+<< expr->getSubExprAsWritten()->getType() << 
expr->getTypeAsWritten()
+<< expr->getSourceRange();
+return true;
+}
+}
+}
+}
+}
 return true;
 }
 
diff --git a/compilerplugins/clang/test/redundantcast.cxx 
b/compilerplugins/clang/test/redundantcast.cxx
index 7a102cca5d0a..da570ab7de8f 100644
--- a/compilerplugins/clang/test/redundantcast.cxx
+++ b/compilerplugins/clang/test/redundantcast.cxx
@@ -339,6 +339,13 @@ void testReinterpretConstCast() {
 (void) reinterpret_cast((const_cast())); // 
expected-error-re {{redundant const_cast from 'int *' to 'const int *' within 
reinterpret_cast to fundamental type 'std::size_t' (aka 'unsigned {{.+}}') 
[loplugin:redundantcast]}}
 }
 
+void testSuspiciousReinterpretCast() {
+D * p;
+// expected-error@+1 {{suspicious reinterpret_cast from derived 'D *' to 
base 'S *', maybe this was meant to be a static_cast [loplugin:redundantcast]}}
+(void) reinterpret_cast(p);
+(void) reinterpret_cast(p); // expected no error
+}
+
 void testDynamicCast() {
 
 struct S1 { virtual ~S1(); };
diff --git a/sw/source/core/inc/frame.hxx b/sw/source/core/inc/frame.hxx
index 7cb9dffc27bc..e5b4c4c9bf5c 100644
--- a/sw/source/core/inc/frame.hxx
+++ b/sw/source/core/inc/frame.hxx
@@ -195,7 +195,7 @@ public:
 public:
 FrameAreaWriteAccess(SwFrameAreaDefinition& rTarget) : 
SwRect(rTarget.getFrameArea()), mrTarget(rTarget) {}
 ~FrameAreaWriteAccess();
-void setSwRect(const SwRect& rNew) { *reinterpret_cast< SwRect* 
>(this) = rNew; }
+void setSwRect(const SwRect& rNew) { *static_cast< SwRect* >(this) = 
rNew; }
 };
 
 // same helper for FramePrintArea
@@ -210,7 +210,7 @@ public:
 public:
 FramePrintAreaWriteAccess(SwFrameAreaDefinition& rTarget) : 
SwRect(rTarget.getFramePrintArea()), mrTarget(rTarget) {}
 ~FramePrintAreaWriteAccess();
-void setSwRect(const SwRect& rNew) { *reinterpret_cast< SwRect* 
>(this) = rNew; }
+void setSwRect(const SwRect& rNew) { *static_cast< SwRect* >(this) = 
rNew; }
 };
 
 // RotateFlyFrame3 - Support for Transformations


[Libreoffice-commits] core.git: compilerplugins/clang sw/source

2022-03-28 Thread Stephan Bergmann (via logerrit)
 compilerplugins/clang/casttovoid.cxx  |6 ++
 compilerplugins/clang/test/casttovoid.cxx |2 ++
 sw/source/core/doc/docredln.cxx   |6 +++---
 3 files changed, 11 insertions(+), 3 deletions(-)

New commits:
commit 1e84c0b8d161e05c19c3aa227cbf7de15cc363a3
Author: Stephan Bergmann 
AuthorDate: Mon Mar 28 17:34:58 2022 +0200
Commit: Stephan Bergmann 
CommitDate: Mon Mar 28 23:27:28 2022 +0200

-Werror,-Wunused-but-set-variable

...which was apparently meant as a "Possible debugger breakpoint" in
DBG_UTIL-only sw_DebugRedline.  The obvious fix is to mark nDummy as 
volatile,
but increment of a volatile variable is deprecated, so replace those with 
reads
of the variable, but which triggered false loplugin:casttovoid so fix that 
too.

Change-Id: I07376e665caa4fd9befaba06d261a50df7a63a10
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132237
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/compilerplugins/clang/casttovoid.cxx 
b/compilerplugins/clang/casttovoid.cxx
index 63f1efdd85a5..bddfcb4da503 100644
--- a/compilerplugins/clang/casttovoid.cxx
+++ b/compilerplugins/clang/casttovoid.cxx
@@ -202,6 +202,9 @@ public:
 if (var == nullptr) {
 return true;
 }
+if (var->getType().isVolatileQualified()) {
+return true;
+}
 auto & usage = vars_[var->getCanonicalDecl()];
 if (!castToVoid_.empty() && castToVoid_.top().sub == expr) {
 usage.castToVoid.push_back(castToVoid_.top().cast);
@@ -506,6 +509,9 @@ private:
 if (var == nullptr) {
 return;
 }
+if (var->getType().isVolatileQualified()) {
+return;
+}
 auto & usage = vars_[var->getCanonicalDecl()];
 if (usage.firstConsumption != nullptr) {
 return;
diff --git a/compilerplugins/clang/test/casttovoid.cxx 
b/compilerplugins/clang/test/casttovoid.cxx
index c3b5eee17c96..3d8c22b49c7e 100644
--- a/compilerplugins/clang/test/casttovoid.cxx
+++ b/compilerplugins/clang/test/casttovoid.cxx
@@ -115,6 +115,8 @@ int main() {
 int n8 = 0;
 ASSERT(USE(USE(n8 == 0)));
 (void) n8;
+int volatile n9 = 0;
+(void) n9;
 return n1 // expected-note 8 {{first consumption is here 
[loplugin:casttovoid]}}
 + n2 // expected-note {{first consumption is here 
[loplugin:casttovoid]}}
 + n3;
diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx
index bb139a1b1781..428f67026f29 100644
--- a/sw/source/core/doc/docredln.cxx
+++ b/sw/source/core/doc/docredln.cxx
@@ -69,13 +69,13 @@ using namespace com::sun::star;
 const SwRedlineTable& rTable = 
pDoc->getIDocumentRedlineAccess().GetRedlineTable();
 for( SwRedlineTable::size_type n = 0; n < rTable.size(); ++n )
 {
-SwRedlineTable::size_type nDummy = 0;
+volatile SwRedlineTable::size_type nDummy = 0;
 const SwRangeRedline* pCurrent = rTable[ n ];
 const SwRangeRedline* pNext = n+1 < rTable.size() ? rTable[ n+1 ] 
: nullptr;
 if( pCurrent == pNext )
-++nDummy;
+(void) nDummy;
 if( n == nWatch )
-++nDummy; // Possible debugger breakpoint
+(void) nDummy; // Possible debugger breakpoint
 }
 }
 


[Libreoffice-commits] core.git: compilerplugins/clang sw/source

2022-02-17 Thread Stephan Bergmann (via logerrit)
 compilerplugins/clang/stringview.cxx  |   16 
 compilerplugins/clang/test/stringview.cxx |   27 +++
 sw/source/filter/ww8/ww8par2.cxx  |5 ++---
 3 files changed, 45 insertions(+), 3 deletions(-)

New commits:
commit ee373f34ae1509e8d9fffaf4b5140ee9c35e8d41
Author: Stephan Bergmann 
AuthorDate: Thu Feb 17 19:06:17 2022 +0100
Commit: Stephan Bergmann 
CommitDate: Thu Feb 17 21:45:49 2022 +0100

Extend loplugin:stringview to O[U]StringBuffer::makeStringAndClear

...at least when called on an rvalue.  (The lvalue case would often be 
trickier
to act upon, if the cleared object is still used later on.)

Change-Id: I006e618da004b2127e9ed7381911c2d7b00b1169
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130110
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/compilerplugins/clang/stringview.cxx 
b/compilerplugins/clang/stringview.cxx
index 1f7783a3f3b3..94ba6f150f1b 100644
--- a/compilerplugins/clang/stringview.cxx
+++ b/compilerplugins/clang/stringview.cxx
@@ -282,6 +282,22 @@ void StringView::handleCXXMemberCallExpr(CXXMemberCallExpr 
const* expr)
 }
 return;
 }
+if (auto const dc2 = dc1.Function("makeStringAndClear"))
+{
+if (dc2.Class("OStringBuffer").Namespace("rtl").GlobalNamespace()
+|| dc2.Class("OUStringBuffer").Namespace("rtl").GlobalNamespace())
+{
+auto const obj = expr->getImplicitObjectArgument();
+if (!(obj->isLValue() || obj->getType()->isPointerType()))
+{
+report(DiagnosticsEngine::Warning,
+   "rather than call makeStringAndClear on an rvalue, pass 
with a view",
+   expr->getExprLoc())
+<< expr->getSourceRange();
+}
+}
+return;
+}
 if (auto const dc2 = dc1.Function("toString"))
 {
 if (dc2.Class("OStringBuffer").Namespace("rtl").GlobalNamespace()
diff --git a/compilerplugins/clang/test/stringview.cxx 
b/compilerplugins/clang/test/stringview.cxx
index a679ec59ea45..7e637175e259 100644
--- a/compilerplugins/clang/test/stringview.cxx
+++ b/compilerplugins/clang/test/stringview.cxx
@@ -10,6 +10,7 @@
 #include 
 
 #include 
+#include 
 
 #include 
 #include 
@@ -81,6 +82,32 @@ void f1(OStringBuffer s1)
 // expected-error@+1 {{rather than call toString, pass with a view 
[loplugin:stringview]}}
 ConstructWithView(s1.toString());
 }
+void makeStringAndClear(OUStringBuffer s)
+{
+call_view(s.makeStringAndClear());
+ConstructWithView(s.makeStringAndClear());
+call_view(()->makeStringAndClear());
+ConstructWithView(()->makeStringAndClear());
+// expected-error@+1 {{rather than call makeStringAndClear on an rvalue, 
pass with a view [loplugin:stringview]}}
+call_view(std::move(s).makeStringAndClear());
+// expected-error@+1 {{rather than call makeStringAndClear on an rvalue, 
pass with a view [loplugin:stringview]}}
+ConstructWithView(std::move(s).makeStringAndClear());
+// expected-error@+1 {{rather than call makeStringAndClear on an rvalue, 
pass with a view [loplugin:stringview]}}
+call_view((s).copy(1).makeStringAndClear());
+// expected-error@+1 {{rather than call makeStringAndClear on an rvalue, 
pass with a view [loplugin:stringview]}}
+ConstructWithView(s.copy(1).makeStringAndClear());
+}
+void makeStringAndClear(OStringBuffer s)
+{
+call_view(s.makeStringAndClear());
+ConstructWithView(s.makeStringAndClear());
+call_view(()->makeStringAndClear());
+ConstructWithView(()->makeStringAndClear());
+// expected-error@+1 {{rather than call makeStringAndClear on an rvalue, 
pass with a view [loplugin:stringview]}}
+call_view(std::move(s).makeStringAndClear());
+// expected-error@+1 {{rather than call makeStringAndClear on an rvalue, 
pass with a view [loplugin:stringview]}}
+ConstructWithView(std::move(s).makeStringAndClear());
+}
 }
 
 namespace test2
diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx
index d3df4f76656f..b7ce97387f59 100644
--- a/sw/source/filter/ww8/ww8par2.cxx
+++ b/sw/source/filter/ww8/ww8par2.cxx
@@ -636,7 +636,7 @@ void SwWW8ImplReader::SetAnlvStrings(SwNumFormat , int 
nLevel, WW8_ANLV con
 bool bListSymbol = pF && ( pF->aFFNBase.chs == 2 );  // 
Symbol/WingDings/...
 
 sal_uInt32 nLen = rAV.cbTextBefore + rAV.cbTextAfter;
-OUStringBuffer sText(nLen);
+OUStringBuffer sText(static_cast(nLen));
 if (m_bVer67)
 {
 if (nLen > nElements)
@@ -725,8 +725,7 @@ void SwWW8ImplReader::SetAnlvStrings(SwNumFormat , int 
nLevel, WW8_ANLV con
 }
 if( rAV.cbTextAfter )
 {
-sSuffix = rNum.GetSuffix();
-sSuffix += sText.copy( rAV.cbTextBefore, 
rAV.cbTextAfter).makeStringAndClear();
+sSuffix = rNum.GetSuffix() + sText.subView( rAV.cbTextBefore, 
rAV.cbTextAfter);
 }
 if 

[Libreoffice-commits] core.git: compilerplugins/clang sw/source xmloff/source

2020-12-04 Thread Noel Grandin (via logerrit)
 compilerplugins/clang/xmlimport.cxx|3 +++
 sw/source/filter/xml/xmlfmt.cxx|2 +-
 xmloff/source/draw/XMLNumberStyles.cxx |   10 +-
 xmloff/source/table/XMLTableImport.cxx |2 +-
 4 files changed, 10 insertions(+), 7 deletions(-)

New commits:
commit ef80ef57f50cf41afa461fc8c188e40436194f1a
Author: Noel Grandin 
AuthorDate: Fri Dec 4 19:42:56 2020 +0200
Commit: Noel Grandin 
CommitDate: Fri Dec 4 20:19:32 2020 +0100

call createFastChildContextFallback in more places

to make my fastparser work easier to manage

Change-Id: If98592f016cd35ca13b48d9df363e32fb1095b55
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107233
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/compilerplugins/clang/xmlimport.cxx 
b/compilerplugins/clang/xmlimport.cxx
index b18554dfc768..a15c3c63f057 100644
--- a/compilerplugins/clang/xmlimport.cxx
+++ b/compilerplugins/clang/xmlimport.cxx
@@ -58,6 +58,9 @@ public:
 if (loplugin::isSamePathname(fn, SRCDIR
  
"/xmloff/source/text/XMLIndexBibliographySourceContext.cxx"))
 return false;
+// calling mxSlaveContext
+if (loplugin::isSamePathname(fn, SRCDIR 
"/xmloff/source/draw/XMLNumberStyles.cxx"))
+return false;
 return true;
 }
 
diff --git a/sw/source/filter/xml/xmlfmt.cxx b/sw/source/filter/xml/xmlfmt.cxx
index fa0b31a5e78d..50a6aead1671 100644
--- a/sw/source/filter/xml/xmlfmt.cxx
+++ b/sw/source/filter/xml/xmlfmt.cxx
@@ -608,7 +608,7 @@ css::uno::Reference< css::xml::sax::XFastContextHandler > 
SwXMLItemSetStyleConte
 pTextStyle->startFastElement( nElement, xTmpAttrList.get() );
 rStyles.AddStyle( *pTextStyle );
 }
-return pTextStyle->createFastChildContext( nElement, xAttrList );
+return pTextStyle->createFastChildContextFallback( nElement, 
xAttrList );
 }
 default:
 XMLOFF_WARN_UNKNOWN_ELEMENT("sw", nElement);
diff --git a/xmloff/source/draw/XMLNumberStyles.cxx 
b/xmloff/source/draw/XMLNumberStyles.cxx
index 1696fc038ac8..44c85b8e2bfd 100644
--- a/xmloff/source/draw/XMLNumberStyles.cxx
+++ b/xmloff/source/draw/XMLNumberStyles.cxx
@@ -492,7 +492,7 @@ private:
 bool mbTextual;
 bool mbDecimal02;
 OUString maText;
-css::uno::Reference< css::xml::sax::XFastContextHandler > mxSlaveContext;
+SvXMLImportContextRef mxSlaveContext;
 
 public:
 
@@ -500,7 +500,7 @@ public:
 sal_Int32 nElement,
 const css::uno::Reference< css::xml::sax::XFastAttributeList>& 
xAttrList,
 SdXMLNumberFormatImportContext* pParent,
-const css::uno::Reference< css::xml::sax::XFastContextHandler >& 
rSlaveContext );
+const SvXMLImportContextRef& rSlaveContext );
 
 virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL 
createFastChildContext(
 sal_Int32 nElement, const css::uno::Reference< 
css::xml::sax::XFastAttributeList >& AttrList ) override;
@@ -519,7 +519,7 @@ 
SdXMLNumberFormatMemberImportContext::SdXMLNumberFormatMemberImportContext(
 sal_Int32 nElement,
 const css::uno::Reference< css::xml::sax::XFastAttributeList>& xAttrList,
 SdXMLNumberFormatImportContext* pParent,
-const css::uno::Reference< css::xml::sax::XFastContextHandler >& 
rSlaveContext )
+const SvXMLImportContextRef& rSlaveContext )
 :   SvXMLImportContext(rImport),
 mpParent( pParent ),
 maNumberStyle( SvXMLImport::getNameFromToken(nElement) ),
@@ -555,7 +555,7 @@ css::uno::Reference< css::xml::sax::XFastContextHandler > 
SdXMLNumberFormatMembe
 sal_Int32 nElement,
 const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
 {
-return mxSlaveContext->createFastChildContext( nElement, xAttrList );
+return mxSlaveContext->createFastChildContextFallback( nElement, xAttrList 
);
 }
 
 void SdXMLNumberFormatMemberImportContext::startFastElement(
@@ -707,7 +707,7 @@ css::uno::Reference< css::xml::sax::XFastContextHandler > 
SdXMLNumberFormatImpor
 const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
 {
 return new SdXMLNumberFormatMemberImportContext( GetImport(), nElement, 
xAttrList,
-this, SvXMLNumFormatContext::createFastChildContext( nElement, 
xAttrList ) );
+this, 
_cast(*SvXMLNumFormatContext::createFastChildContext(
 nElement, xAttrList )) );
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/table/XMLTableImport.cxx 
b/xmloff/source/table/XMLTableImport.cxx
index af931822cbe6..7a54c1478acc 100644
--- a/xmloff/source/table/XMLTableImport.cxx
+++ b/xmloff/source/table/XMLTableImport.cxx
@@ -199,7 +199,7 @@ SvXMLImportContextRef XMLProxyContext::CreateChildContext( 
sal_uInt16 nPrefix, c
  css::uno::Reference< css::xml::sax::XFastContextHandler > 
XMLProxyContext::createFastChildContext( sal_Int32 nElement, const Reference< 

[Libreoffice-commits] core.git: compilerplugins/clang sw/source

2020-11-03 Thread Stephan Bergmann (via logerrit)
 compilerplugins/clang/toolslong.cxx |   17 +
 sw/source/core/doc/doccomp.cxx  |3 ++-
 2 files changed, 19 insertions(+), 1 deletion(-)

New commits:
commit 64e58879c4445bfc733d337c53ac7dc1748fdbb9
Author: Stephan Bergmann 
AuthorDate: Tue Nov 3 08:33:19 2020 +0100
Commit: Stephan Bergmann 
CommitDate: Tue Nov 3 22:29:36 2020 +0100

Avoid UBSan pointer-overflow

...as seen with recently introduced UITest_writer_tests
UITEST_TEST_NAME=compareDocuments.compareDocuments.test_tdf137855, but 
where the
unsigned sal_uLong (aka sal_uIntPtr) value is apparently meant to wrap 
around
and address an element of m_pMemory at a negative index from m_pBDiag:

> sw/source/core/doc/doccomp.cxx:832:13: runtime error: addition of 
unsigned offset to 0x6250014a90d0 overflowed to 0x6250014a90b8
>  #0 in (anonymous namespace)::Compare::CompareSequence::Compare(unsigned 
long, unsigned long, unsigned long, unsigned long) at 
sw/source/core/doc/doccomp.cxx:832:13
>  #1 in (anonymous 
namespace)::Compare::CompareSequence::CompareSequence((anonymous 
namespace)::CompareData&, (anonymous namespace)::CompareData&, (anonymous 
namespace)::Compare::MovedData const&, (anonymous 
namespace)::Compare::MovedData const&) at sw/source/core/doc/doccomp.cxx:794:5
>  #2 in (anonymous namespace)::Compare::Compare(unsigned long, (anonymous 
namespace)::CompareData&, (anonymous namespace)::CompareData&) at 
sw/source/core/doc/doccomp.cxx:605:25
>  #3 in (anonymous namespace)::CompareData::CompareLines((anonymous 
namespace)::CompareData&) at sw/source/core/doc/doccomp.cxx:440:17
>  #4 in SwDoc::CompareDoc(SwDoc const&) at 
sw/source/core/doc/doccomp.cxx:1877:13
>  #5 in SwEditShell::CompareDoc(SwDoc const&) at 
sw/source/core/edit/editsh.cxx:877:34
>  #6 in SwView::InsertMedium(unsigned short, std::unique_ptr >, short) at 
sw/source/uibase/uiview/view2.cxx:2377:39
>  #7 in SwView::DialogClosedHdl(sfx2::FileDialogHelper*) at 
sw/source/uibase/uiview/view2.cxx:2574:26
[...]

Using std::make_signed_t where its canonic type happens to be `long` 
requires a
workaround for old Clang to avoid a false

> CXXFunctionalCastExpr, suspicious cast from 'sal_uLong' (aka 'unsigned 
long') to 'std::make_signed_t' (aka 'long') [loplugin:toolslong]

warning.

Change-Id: I07413ba06051f75d80832a4772ab1c541805b259
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105234
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/compilerplugins/clang/toolslong.cxx 
b/compilerplugins/clang/toolslong.cxx
index 719b5b0caca5..b0d6a78d35ab 100644
--- a/compilerplugins/clang/toolslong.cxx
+++ b/compilerplugins/clang/toolslong.cxx
@@ -17,6 +17,8 @@
 #include "clang/AST/Attr.h"
 #include "clang/Basic/Builtins.h"
 
+#include "config_clang.h"
+
 #include "check.hxx"
 #include "compat.hxx"
 #include "plugin.hxx"
@@ -32,6 +34,21 @@ bool isLong(QualType type)
 // some parts of the STL have ::difference_type => long
 if (type->getAs() || type->getAs())
 return false;
+#if CLANG_VERSION < 8
+// Prior to  "[AST] Get aliased type info 
from an aliased
+// TemplateSpecialization" in Clang 8, if type is a 
TemplateSpecializationType on top of a
+// TypedefType, the above getAs returned null (as it 
unconditionally desugared the
+// TemplateSpecializationType to the underlying canonic type, not to any 
aliased type), so re-
+// check with the TemplateSpecializationType's aliased type:
+if (auto const t = type->getAs())
+{
+if (t->isTypeAlias())
+{
+return isLong(t->getAliasedType());
+}
+}
+#endif
 if (type->isSpecificBuiltinType(BuiltinType::Kind::Long))
 return true;
 auto arrayType = type->getAsArrayTypeUnsafe();
diff --git a/sw/source/core/doc/doccomp.cxx b/sw/source/core/doc/doccomp.cxx
index 1b81e89ab4c8..cabd1ff97401 100644
--- a/sw/source/core/doc/doccomp.cxx
+++ b/sw/source/core/doc/doccomp.cxx
@@ -47,6 +47,7 @@
 
 #include 
 #include 
+#include 
 #include 
 
 using namespace ::com::sun::star;
@@ -829,7 +830,7 @@ void Compare::CompareSequence::Compare( sal_uLong nStt1, 
sal_uLong nEnd1,
 /* Find a point of correspondence in the middle of the files.  */
 
 d = CheckDiag( nStt1, nEnd1, nStt2, nEnd2,  );
-b = m_pBDiag[ d ];
+b = m_pBDiag[ std::make_signed_t(d) ];
 
 if( 1 != c )
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: compilerplugins/clang sw/source

2020-10-02 Thread Caolán McNamara (via logerrit)
 compilerplugins/clang/unusedmethods.results |   12 
 sw/source/uibase/inc/numfmtlb.hxx   |7 ---
 2 files changed, 19 deletions(-)

New commits:
commit 59b3a0413a742f86078da4772b2a5f4cc83e9e3c
Author: Caolán McNamara 
AuthorDate: Thu Oct 1 20:41:35 2020 +0100
Commit: Caolán McNamara 
CommitDate: Fri Oct 2 09:43:06 2020 +0200

drop these unused inlines

Change-Id: I566be7eaf2ee73d3dac8c137ba783eea960cb586
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103778
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/compilerplugins/clang/unusedmethods.results 
b/compilerplugins/clang/unusedmethods.results
index a87d0d4ebaaf..79339f02f1d4 100644
--- a/compilerplugins/clang/unusedmethods.results
+++ b/compilerplugins/clang/unusedmethods.results
@@ -1530,18 +1530,6 @@ sw/source/core/text/txtpaint.hxx:78
  DbgRect::DbgRect(class OutputDevice *,const class tools::Rectangle 
&,const _Bool,class Color)
 sw/source/filter/ww8/docxsdrexport.hxx:73
 class sax_fastparser::FastAttributeList * 
DocxSdrExport::getFlyWrapAttrList()
-sw/source/uibase/inc/numfmtlb.hxx:130
-_Bool SwNumFormatTreeView::get_value_changed_from_saved() const
-sw/source/uibase/inc/numfmtlb.hxx:131
-void SwNumFormatTreeView::save_value()
-sw/source/uibase/inc/numfmtlb.hxx:132
-void SwNumFormatTreeView::show()
-sw/source/uibase/inc/numfmtlb.hxx:133
-void SwNumFormatTreeView::hide()
-sw/source/uibase/inc/numfmtlb.hxx:139
-void SwNumFormatTreeView::set_sensitive(_Bool)
-sw/source/uibase/inc/numfmtlb.hxx:140
-void SwNumFormatTreeView::connect_changed(const class Link &)
 sw/source/uibase/inc/swcont.hxx:85
 _Bool SwContent::operator==(const class SwContent &) const
 test/source/sheet/xsubtotalfield.cxx:28
diff --git a/sw/source/uibase/inc/numfmtlb.hxx 
b/sw/source/uibase/inc/numfmtlb.hxx
index 1fedd19c1157..a5776659130a 100644
--- a/sw/source/uibase/inc/numfmtlb.hxx
+++ b/sw/source/uibase/inc/numfmtlb.hxx
@@ -127,17 +127,10 @@ public:
 virtual void set_id(int nPos, const OUString& rId) override { 
mxControl->set_id(nPos, rId); }
 OUStringget_selected_text() const { return 
mxControl->get_selected_text(); }
 boolget_visible() const { return mxControl->get_visible(); }
-boolget_value_changed_from_saved() const { return 
mxControl->get_value_changed_from_saved(); }
-voidsave_value() { return mxControl->save_value(); }
-voidshow() { mxControl->show(); }
-voidhide() { mxControl->hide(); }
 int get_selected_index() const { return 
mxControl->get_selected_index(); }
 voidset_visible(bool bVisible) { 
mxControl->set_visible(bVisible); }
 voidselect(int nPos) { mxControl->select(nPos); }
 voidconnect_row_activated(const Link& 
rLink) { mxControl->connect_row_activated(rLink); }
-
-voidset_sensitive(bool bSensitive) { 
mxControl->set_sensitive(bSensitive); }
-voidconnect_changed(const Link& rLink) 
{ mxControl->connect_changed(rLink); }
 };
 
 #endif
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: compilerplugins/clang sw/source

2020-07-30 Thread Noel Grandin (via logerrit)
 compilerplugins/clang/flatten.cxx   |7 
 sw/source/uibase/utlui/attrdesc.cxx |   26 +--
 sw/source/uibase/utlui/bookctrl.cxx |   58 +++
 sw/source/uibase/utlui/glbltree.cxx |   28 +--
 sw/source/uibase/utlui/navicfg.cxx  |   58 +++
 sw/source/uibase/utlui/navipi.cxx   |   87 +--
 sw/source/uibase/utlui/tmplctrl.cxx |   66 
 sw/source/uibase/utlui/uitool.cxx   |   44 ++---
 sw/source/uibase/utlui/unotools.cxx |   50 +++---
 sw/source/uibase/wrtsh/navmgr.cxx   |   82 +--
 sw/source/uibase/wrtsh/select.cxx   |   34 ++--
 sw/source/uibase/wrtsh/wrtsh1.cxx   |  266 ++--
 sw/source/uibase/wrtsh/wrtsh2.cxx   |   76 +-
 13 files changed, 443 insertions(+), 439 deletions(-)

New commits:
commit 6af041b8160a7193ed24df9a1adc117dda61cd65
Author: Noel Grandin 
AuthorDate: Thu Jul 30 10:41:56 2020 +0200
Commit: Noel Grandin 
CommitDate: Thu Jul 30 12:18:29 2020 +0200

loplugin:flatten in sw/uibase/utl..sw/uibase/wrtsh

Change-Id: I9010524952ce3b99a62e53dbf715a72c86a89b01
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99766
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/compilerplugins/clang/flatten.cxx 
b/compilerplugins/clang/flatten.cxx
index bac4ae8a4370..a615b8366b63 100644
--- a/compilerplugins/clang/flatten.cxx
+++ b/compilerplugins/clang/flatten.cxx
@@ -427,7 +427,7 @@ llvm::Optional Flatten::invertCondition(Expr 
const * condExpr, Sour
 // an if statement will automatically invoke a bool-conversion method
 if (auto memberCallExpr = dyn_cast(condExpr))
 {
-if (isa(memberCallExpr->getMethodDecl()))
+if (memberCallExpr->getMethodDecl() && 
isa(memberCallExpr->getMethodDecl()))
 condExpr = 
memberCallExpr->getImplicitObjectArgument()->IgnoreImpCasts();
 }
 
@@ -665,6 +665,11 @@ std::string Flatten::getSourceAsString(SourceRange range)
 // in case it happens during code replacement
 return "clang returned bad pointers";
 }
+if (p2 - p1 > 64 * 1024) {
+// workaround clang weirdness, but don't return empty string
+// in case it happens during code replacement
+return "clang returned overlay large source range";
+}
 return std::string( p1, p2 - p1);
 }
 
diff --git a/sw/source/uibase/utlui/attrdesc.cxx 
b/sw/source/uibase/utlui/attrdesc.cxx
index a839c436f725..98c092246a81 100644
--- a/sw/source/uibase/utlui/attrdesc.cxx
+++ b/sw/source/uibase/utlui/attrdesc.cxx
@@ -68,20 +68,20 @@ void SwAttrSet::GetPresentation(
 {
 rText.clear();
 OUString aStr;
-if( Count() )
+if( !Count() )
+return;
+
+SfxItemIter aIter( *this );
+const SfxPoolItem* pItem = aIter.GetCurItem();
+const IntlWrapper aInt(SvtSysLocale().GetUILanguageTag());
+do
 {
-SfxItemIter aIter( *this );
-const SfxPoolItem* pItem = aIter.GetCurItem();
-const IntlWrapper aInt(SvtSysLocale().GetUILanguageTag());
-do
-{
-pItem->GetPresentation(ePres, eCoreMetric, ePresMetric, aStr, 
aInt);
-if( rText.getLength() && aStr.getLength() )
-rText += ", ";
-rText += aStr;
-pItem = aIter.NextItem();
-} while (pItem);
-}
+pItem->GetPresentation(ePres, eCoreMetric, ePresMetric, aStr, aInt);
+if( rText.getLength() && aStr.getLength() )
+rText += ", ";
+rText += aStr;
+pItem = aIter.NextItem();
+} while (pItem);
 }
 
 bool SwFormatCharFormat::GetPresentation
diff --git a/sw/source/uibase/utlui/bookctrl.cxx 
b/sw/source/uibase/utlui/bookctrl.cxx
index ea9c1d7429f5..aa1f84506d0e 100644
--- a/sw/source/uibase/utlui/bookctrl.cxx
+++ b/sw/source/uibase/utlui/bookctrl.cxx
@@ -103,39 +103,39 @@ void SwBookmarkControl::Paint( const UserDrawEvent&  )
 
 void SwBookmarkControl::Command( const CommandEvent& rCEvt )
 {
-if ( rCEvt.GetCommand() == CommandEventId::ContextMenu &&
-!GetStatusBar().GetItemText( GetId() ).isEmpty() )
+if ( rCEvt.GetCommand() != CommandEventId::ContextMenu ||
+GetStatusBar().GetItemText( GetId() ).isEmpty())
+return;
+
+ScopedVclPtrInstance aPop;
+SwWrtShell* pWrtShell = ::GetActiveWrtShell();
+if( !(pWrtShell && pWrtShell->getIDocumentMarkAccess()->getAllMarksCount() 
> 0) )
+return;
+
+IDocumentMarkAccess* const pMarkAccess = 
pWrtShell->getIDocumentMarkAccess();
+IDocumentMarkAccess::const_iterator_t ppBookmarkStart = 
pMarkAccess->getBookmarksBegin();
+sal_uInt16 nPopupId = 1;
+std::map aBookmarkIdx;
+for(IDocumentMarkAccess::const_iterator_t ppBookmark = ppBookmarkStart;
+ppBookmark != pMarkAccess->getBookmarksEnd();
+++ppBookmark)
 {
-ScopedVclPtrInstance aPop;
-SwWrtShell* pWrtShell = ::GetActiveWrtShell();
-if( pWrtShell && 
pWrtShell->getIDocumentMarkAccess()->getAllMarksCount() > 0 )
+

[Libreoffice-commits] core.git: compilerplugins/clang sw/source

2020-05-20 Thread Noel Grandin (via logerrit)
 compilerplugins/clang/unusedfields.only-used-in-constructor.results |   28 

 compilerplugins/clang/unusedfields.readonly.results |8 --
 compilerplugins/clang/unusedfields.untouched.results|   32 
+-
 compilerplugins/clang/unusedfields.writeonly.results|   14 ++--
 sw/source/core/inc/txtfrm.hxx   |1 
 sw/source/core/text/txtfrm.cxx  |1 
 6 files changed, 43 insertions(+), 41 deletions(-)

New commits:
commit 1854f1ddf6ffaddff92d3209f15b68a53f91d2b1
Author: Noel Grandin 
AuthorDate: Tue May 19 18:27:34 2020 +0200
Commit: Noel Grandin 
CommitDate: Wed May 20 08:41:49 2020 +0200

loplugin:unusedfields

Change-Id: If179d0a13f3c9f7a49e3efe9027a64368ed600a0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94544
Tested-by: Jenkins
Tested-by: Noel Grandin 
Reviewed-by: Noel Grandin 

diff --git 
a/compilerplugins/clang/unusedfields.only-used-in-constructor.results 
b/compilerplugins/clang/unusedfields.only-used-in-constructor.results
index bd57ae985122..d86845605b51 100644
--- a/compilerplugins/clang/unusedfields.only-used-in-constructor.results
+++ b/compilerplugins/clang/unusedfields.only-used-in-constructor.results
@@ -9,9 +9,9 @@ avmedia/source/vlc/wrapper/Types.hxx:43
 avmedia/source/vlc/wrapper/Types.hxx:44
 libvlc_event_t::(anonymous union)::(anonymous) dummy2 const char *
 avmedia/source/vlc/wrapper/Types.hxx:45
-libvlc_event_t::(anonymous) padding struct (anonymous struct at 
/home/noel/libo/avmedia/source/vlc/wrapper/Types.hxx:42:7)
+libvlc_event_t::(anonymous) padding struct (anonymous struct at 
/home/noel/libo2/avmedia/source/vlc/wrapper/Types.hxx:42:7)
 avmedia/source/vlc/wrapper/Types.hxx:46
-libvlc_event_t u union (anonymous union at 
/home/noel/libo/avmedia/source/vlc/wrapper/Types.hxx:40:5)
+libvlc_event_t u union (anonymous union at 
/home/noel/libo2/avmedia/source/vlc/wrapper/Types.hxx:40:5)
 avmedia/source/vlc/wrapper/Types.hxx:52
 libvlc_track_description_t psz_name char *
 basegfx/source/polygon/b2dpolygontriangulator.cxx:112
@@ -86,6 +86,8 @@ cppcanvas/source/mtfrenderer/textaction.cxx:1641
 cppcanvas::internal::(anonymous namespace)::OutlineAction maTextLineInfo 
const tools::TextLineInfo
 cppu/source/threadpool/threadpool.cxx:361
 _uno_ThreadPool dummy sal_Int32
+cppu/source/typelib/typelib.cxx:60
+(anonymous namespace)::AlignSize_Impl nInt16 sal_Int16
 cppu/source/uno/check.cxx:38
 (anonymous namespace)::C1 n1 sal_Int16
 cppu/source/uno/check.cxx:67
@@ -118,8 +120,6 @@ cppu/source/uno/check.cxx:107
 (anonymous namespace)::P p2 double
 cppu/source/uno/check.cxx:115
 (anonymous namespace)::second a int
-cppu/source/uno/check.cxx:120
-(anonymous namespace)::AlignSize_Impl nInt16 sal_Int16
 cppu/source/uno/check.cxx:126
 (anonymous namespace)::Char1 c1 char
 cppu/source/uno/check.cxx:130
@@ -170,8 +170,6 @@ dbaccess/source/core/dataaccess/connection.hxx:102
 dbaccess::OConnection m_nInAppend std::atomic
 dbaccess/source/core/inc/databasecontext.hxx:85
 dbaccess::ODatabaseContext m_aBasicDLL class BasicDLL
-desktop/qa/desktop_lib/test_desktop_lib.cxx:2782
-  class AllSettings &
 drawinglayer/inc/texture/texture3d.hxx:61
 drawinglayer::texture::GeoTexSvxBitmapEx maBitmap class Bitmap
 drawinglayer/inc/texture/texture3d.hxx:63
@@ -432,6 +430,8 @@ pyuno/source/module/pyuno_impl.hxx:237
 pyuno::stRuntimeImpl ob_base PyObject
 reportdesign/source/core/api/ReportDefinition.cxx:236
 reportdesign::(anonymous namespace)::OStyle m_aSize awt::Size
+reportdesign/source/filter/xml/xmlExport.cxx:1231
+  sal_Int32
 sal/qa/osl/condition/osl_Condition.cxx:72
 osl_Condition::ctors bRes1 _Bool
 sal/qa/osl/condition/osl_Condition.cxx:202
@@ -632,7 +632,7 @@ sdext/source/pdfimport/pdfparse/pdfparse.cxx:266
 (anonymous namespace)::PDFGrammar::definition trailer rule
 sfx2/inc/autoredactdialog.hxx:101
 SfxAutoRedactDialog m_xDocShell class SfxObjectShellLock
-sfx2/source/dialog/basedlgs.cxx:45
+sfx2/source/dialog/basedlgs.cxx:47
 SfxModelessDialog_Impl aMoveIdle class Idle
 sfx2/source/doc/doctempl.cxx:102
 DocTempl::(anonymous namespace)::DocTempl_EntryData_Impl mxObjShell class 
SfxObjectShellLock
@@ -732,6 +732,8 @@ sw/source/core/crsr/crbm.cxx:64
 (anonymous namespace)::CursorStateHelper m_aSaveState class 
SwCursorSaveState
 sw/source/core/inc/swfont.hxx:980
 SvStatistics nGetStretchTextSize sal_uInt16
+sw/source/core/inc/txtfrm.hxx:223
+SwTextFrame mbHasBlinkPortions _Bool
 sw/source/core/layout/dbg_lay.cxx:171
 SwImplEnterLeave nAction enum DbgAction
 sw/source/core/text/inftxt.cxx:565
@@ -840,17 +842,17 @@ vcl/unx/gtk3/gtk3gloactiongroup.cxx:27
 (anonymous namespace)::GLOAction parent_instance GObject
 vcl/unx/gtk3/gtk3glomenu.cxx:14
 GLOMenu parent_instance const GMenuModel

[Libreoffice-commits] core.git: compilerplugins/clang sw/source

2019-11-29 Thread Caolán McNamara (via logerrit)
 compilerplugins/clang/unnecessaryvirtual.results |2 --
 sw/source/ui/dbui/mmaddressblockpage.hxx |2 +-
 2 files changed, 1 insertion(+), 3 deletions(-)

New commits:
commit b24fc665c83f734b29e3aeb69150fb1a2fa46331
Author: Caolán McNamara 
AuthorDate: Fri Nov 29 12:10:32 2019 +
Commit: Caolán McNamara 
CommitDate: Fri Nov 29 18:10:48 2019 +0100

unnecessary virtual

Change-Id: I918a8c51e55919555108c075d396b04b4dcafbd1
Reviewed-on: https://gerrit.libreoffice.org/84061
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/compilerplugins/clang/unnecessaryvirtual.results 
b/compilerplugins/clang/unnecessaryvirtual.results
index c2ba2ddd41eb..568273d4d5b5 100644
--- a/compilerplugins/clang/unnecessaryvirtual.results
+++ b/compilerplugins/clang/unnecessaryvirtual.results
@@ -220,8 +220,6 @@ sw/inc/flypos.hxx:37
 void SwPosFlyFrame::~SwPosFlyFrame()
 sw/source/core/inc/dflyobj.hxx:55
 void SwFlyDrawObj::SetTextBox(_Bool,)
-sw/source/ui/dbui/mmaddressblockpage.hxx:239
-class weld::TreeView * 
SwCustomizeAddressBlockDialog::get_drag_source()const
 vcl/inc/salframe.hxx:145
 void SalFrame::SetRepresentedURL(const class rtl::OUString &,)
 vcl/inc/salframe.hxx:191
diff --git a/sw/source/ui/dbui/mmaddressblockpage.hxx 
b/sw/source/ui/dbui/mmaddressblockpage.hxx
index 2fc3f7e54e1f..6d173043f171 100644
--- a/sw/source/ui/dbui/mmaddressblockpage.hxx
+++ b/sw/source/ui/dbui/mmaddressblockpage.hxx
@@ -236,7 +236,7 @@ public:
 void UpdateFields();
 
 // for dragging from the TreeViews, return the active source
-virtual weld::TreeView* get_drag_source() const { return 
m_xAddressElementsLB->get_drag_source(); }
+weld::TreeView* get_drag_source() const { return 
m_xAddressElementsLB->get_drag_source(); }
 boolHasItem(sal_Int32 nUserData);
 
 void SetAddress(const OUString& rAddress);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: compilerplugins/clang sw/source

2019-11-20 Thread Stephan Bergmann (via logerrit)
 compilerplugins/clang/redundantfcast.cxx  |7 +
 compilerplugins/clang/test/redundantfcast.cxx |   96 ++
 sw/source/core/unocore/unodraw.cxx|6 +
 3 files changed, 107 insertions(+), 2 deletions(-)

New commits:
commit df24a0dc144c8f963f8567c17b2d1a1090558cdb
Author: Stephan Bergmann 
AuthorDate: Wed Nov 20 11:43:12 2019 +0100
Commit: Stephan Bergmann 
CommitDate: Wed Nov 20 20:53:01 2019 +0100

loplugin:redundantfcast: Don't warn about cast from braced-init-list

...in non-deduced context.  That means that the necessary cast in
84322944980f6e2f9d4a531de7a6803797156968 "Simplify sequence initialization"
(cf. ) no longer causes a false
positive, and doesn't need to use comphelper::OUStringLiteralList.

Change-Id: I788da61cc0be82d2166653760e527bb18e366c99
Reviewed-on: https://gerrit.libreoffice.org/83291
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/compilerplugins/clang/redundantfcast.cxx 
b/compilerplugins/clang/redundantfcast.cxx
index 260fe1852417..5084d5a29ab3 100644
--- a/compilerplugins/clang/redundantfcast.cxx
+++ b/compilerplugins/clang/redundantfcast.cxx
@@ -105,6 +105,13 @@ public:
 // something useful
 if (t1.getCanonicalType().getTypePtr() != paramClassOrStructType)
 continue;
+// Don't warn about (necessary) cast from braced-init-list in 
non-deduced contexts:
+if 
(lvalueType->getPointeeType()->getAs() != nullptr
+&& 
loplugin::TypeCheck(t1).ClassOrStruct("initializer_list").StdNamespace()
+&& 
isa(compat::getSubExprAsWritten(functionalCast)))
+{
+continue;
+}
 
 if (m_Seen.insert(arg->getExprLoc()).second)
 {
diff --git a/compilerplugins/clang/test/redundantfcast.cxx 
b/compilerplugins/clang/test/redundantfcast.cxx
index 985aa8c02994..255c1d44b2a7 100644
--- a/compilerplugins/clang/test/redundantfcast.cxx
+++ b/compilerplugins/clang/test/redundantfcast.cxx
@@ -13,6 +13,7 @@
 #include "tools/color.hxx"
 
 #include 
+#include 
 #include 
 
 void method1(OUString const&); // expected-note {{in call to method here 
[loplugin:redundantfcast]}}
@@ -105,4 +106,99 @@ void f2()
 }
 }
 
+namespace test7
+{
+// expected-note@+1 6 {{in call to method here [loplugin:redundantfcast]}}
+void f1(std::initializer_list const&);
+// expected-note@+1 6 {{in call to method here [loplugin:redundantfcast]}}
+template  void f2(std::initializer_list const&);
+// expected-note@+1 4 {{in call to method here [loplugin:redundantfcast]}}
+template  void f3(T const&);
+// expected-note@+1 4 {{in call to method here [loplugin:redundantfcast]}}
+template  void f4(T const&...);
+void f5(int, ...);
+void g(std::initializer_list il)
+{
+f1(il);
+f2(il);
+f3(il);
+f4(il);
+f5(0, il);
+// expected-error@+1 {{redundant functional cast from 
'std::initializer_list' to 'std::initializer_list' 
[loplugin:redundantfcast]}}
+f1(std::initializer_list(il));
+// expected-error@+1 {{redundant functional cast from 
'std::initializer_list' to 'std::initializer_list' 
[loplugin:redundantfcast]}}
+f2(std::initializer_list(il));
+// expected-error@+1 {{redundant functional cast from 
'std::initializer_list' to 'std::initializer_list' 
[loplugin:redundantfcast]}}
+f3(std::initializer_list(il));
+// expected-error@+1 {{redundant functional cast from 
'std::initializer_list' to 'std::initializer_list' 
[loplugin:redundantfcast]}}
+f4(std::initializer_list(il));
+// expected-error@+1 {{redundant functional cast from 
'std::initializer_list' to 'std::initializer_list' 
[loplugin:redundantfcast]}}
+f5(0, std::initializer_list(il));
+f1({});
+f1(std::initializer_list{}); // should warn, but not modelled as 
CXXFunctionalCastExpr
+// expected-error@+1 {{redundant functional cast from 
'std::initializer_list' to 'std::initializer_list' 
[loplugin:redundantfcast]}}
+f1(std::initializer_list({}));
+// f2({}); //error
+f2(std::initializer_list{}); // should warn, but not modelled as 
CXXFunctionalCastExpr
+// expected-error@+1 {{redundant functional cast from 
'std::initializer_list' to 'std::initializer_list' 
[loplugin:redundantfcast]}}
+f2(std::initializer_list({}));
+// f3({}); //error
+f3(std::initializer_list{}); // (not modelled as 
CXXFunctionalCastExpr anyway)
+// expected-error@+1 {{redundant functional cast from 
'std::initializer_list' to 'std::initializer_list' 
[loplugin:redundantfcast]}}
+f3(std::initializer_list({})); // arguably rather subtle, remove 
"("...")"
+// f4({}); //error
+f4(std::initializer_list{}); // (not modelled as 
CXXFunctionalCastExpr anyway)
+// expected-error@+1 {{redundant functional cast from 
'std::initializer_list' to 'std::initializer_list' 
[loplugin:redundantfcast]}}
+

[Libreoffice-commits] core.git: compilerplugins/clang sw/source

2019-10-22 Thread Noel Grandin (via logerrit)
 compilerplugins/clang/singlevalfields.could-be-bool.results |   12 
 compilerplugins/clang/singlevalfields.results   |  302 
 sw/source/core/inc/UndoSplitMove.hxx|1 
 sw/source/core/undo/unmove.cxx  |   14 
 4 files changed, 125 insertions(+), 204 deletions(-)

New commits:
commit 8d686c1e6afd1e09534dcd1ef9d299455f52836a
Author: Noel Grandin 
AuthorDate: Mon Oct 21 13:06:02 2019 +0200
Commit: Noel Grandin 
CommitDate: Tue Oct 22 11:16:19 2019 +0200

loplugin:singlevalfields

Change-Id: I92c5634b16862abe1c73c20cfe66abe92f58bb88
Reviewed-on: https://gerrit.libreoffice.org/81303
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/compilerplugins/clang/singlevalfields.could-be-bool.results 
b/compilerplugins/clang/singlevalfields.could-be-bool.results
index 986c5d4b1766..26ab650d1206 100644
--- a/compilerplugins/clang/singlevalfields.could-be-bool.results
+++ b/compilerplugins/clang/singlevalfields.could-be-bool.results
@@ -11,7 +11,7 @@ dbaccess/source/ui/inc/tabletree.hxx:149
 dbaui::TableTreeListBox m_nTextColumn
 int
 desktop/source/app/main.c:29
-/media/disk2/libo4/desktop/source/app/main.c g_Exiting
+/media/disk2/libo7/desktop/source/app/main.c g_Exiting
 int
 editeng/source/misc/hangulhanja.cxx:79
 editeng::HangulHanjaConversion_Impl m_eConvType
@@ -74,10 +74,10 @@ sd/qa/unit/tiledrendering/tiledrendering.cxx:956
 ViewCallback m_nPart
 int
 soltools/cpp/_tokens.c:35
-/media/disk2/libo4/soltools/cpp/_tokens.c EBCDIC_ExternTokenDetected
+/media/disk2/libo7/soltools/cpp/_tokens.c EBCDIC_ExternTokenDetected
 int
 soltools/cpp/_tokens.c:36
-/media/disk2/libo4/soltools/cpp/_tokens.c EBCDIC_StartTokenDetected
+/media/disk2/libo7/soltools/cpp/_tokens.c EBCDIC_StartTokenDetected
 int
 soltools/cpp/cpp.h:121
 includelist always
@@ -100,7 +100,7 @@ sw/source/uibase/inc/tautofmt.hxx:48
 vcl/inc/unx/i18n_ic.hxx:32
 SalI18N_InputContext mbUseable
 int
-vcl/inc/unx/salframe.h:128
+vcl/inc/unx/salframe.h:127
 X11SalFrame mbInputFocus
 int
 vcl/unx/generic/app/saldata.cxx:449
@@ -110,13 +110,13 @@ vcl/unx/generic/app/saldata.cxx:502
 X11SalData::XError bOnce
 int
 vcl/unx/generic/app/sm.cxx:184
-/media/disk2/libo4/vcl/unx/generic/app/sm.cxx nSmDel
+/media/disk2/libo7/vcl/unx/generic/app/sm.cxx nSmDel
 int
 vcl/workben/icontest.cxx:145
 IconTestApp nRet
 int
 workdir/LexTarget/l10ntools/source/cfglex.cxx:2293
-/media/disk2/libo4/workdir/LexTarget/l10ntools/source/cfglex.cxx bText
+/media/disk2/libo7/workdir/LexTarget/l10ntools/source/cfglex.cxx bText
 int
 writerfilter/source/dmapper/PageBordersHandler.hxx:54
 writerfilter::dmapper::PageBordersHandler m_eOffsetFrom
diff --git a/compilerplugins/clang/singlevalfields.results 
b/compilerplugins/clang/singlevalfields.results
index f7ff385efe8a..6f557d352558 100644
--- a/compilerplugins/clang/singlevalfields.results
+++ b/compilerplugins/clang/singlevalfields.results
@@ -7,9 +7,6 @@ avmedia/source/framework/soundhandler.hxx:123
 basctl/source/basicide/baside2.hxx:88
 basctl::EditorWindow aHighlighter
 0
-basctl/source/inc/bastype2.hxx:182
-basctl::TreeListBox nMode
-7
 basctl/source/inc/dlged.hxx:132
 basctl::DlgEditor aMarkIdle
 basctl DlgEditor Mark
@@ -43,9 +40,6 @@ bridges/source/jni_uno/jni_uno2java.cxx:389
 chart2/source/controller/dialogs/DataBrowser.cxx:211
 chart::impl::SeriesHeader m_aUpdateDataTimer
 UpdateDataTimer
-chart2/source/controller/dialogs/DataBrowser.hxx:161
-chart::DataBrowser m_bLiveUpdate
-1
 chart2/source/controller/inc/ChartController.hxx:382
 chart::ChartController m_aLifeTimeManager
 0
@@ -127,7 +121,7 @@ cui/source/inc/linkdlg.hxx:46
 cui/source/inc/thesdlg.hxx:32
 SvxThesaurusDialog m_aModifyIdle
 cui SvxThesaurusDialog LookUp Modify
-cui/source/options/optgdlg.cxx:1054
+cui/source/options/optgdlg.cxx:1056
 LanguageConfig_Impl aLanguageOptions
 0
 cui/source/options/optjava.hxx:60
@@ -136,10 +130,7 @@ cui/source/options/optjava.hxx:60
 dbaccess/source/ui/inc/directsql.hxx:64
 dbaui::DirectSQLDialog m_aHighlighter
 1
-dbaccess/source/ui/inc/indexdialog.hxx:43
-dbaui::DbaIndexDialog m_bEditingActive
-0
-desktop/source/app/app.cxx:503
+desktop/source/app/app.cxx:505
 desktop::Desktop::Init bTryHardOfficeconfigBroken
 0
 desktop/source/app/cmdlineargs.hxx:137
@@ -203,19 +194,19 @@ helpcompiler/inc/BasCodeTagger.hxx:29
 BasicCodeTagger m_Highlighter
 0
 i18npool/source/localedata/localedata.cxx:51
-/media/disk2/libo4/i18npool/source/localedata/localedata.cxx lcl_DATA_EN
+/media/disk2/libo7/i18npool/source/localedata/localedata.cxx lcl_DATA_EN
 localedata_en
 i18npool/source/localedata/localedata.cxx:52
-/media/disk2/libo4/i18npool/source/localedata/localedata.cxx lcl_DATA_ES
+

[Libreoffice-commits] core.git: compilerplugins/clang sw/source

2019-10-18 Thread Noel Grandin (via logerrit)
 compilerplugins/clang/virtualdead.unusedparams.results |3 ---
 sw/source/core/inc/cntfrm.hxx  |2 +-
 sw/source/core/inc/flowfrm.hxx |2 +-
 sw/source/core/inc/sectfrm.hxx |2 +-
 sw/source/core/inc/tabfrm.hxx  |2 +-
 sw/source/core/layout/calcmove.cxx |2 +-
 sw/source/core/layout/flowfrm.cxx  |2 +-
 sw/source/core/layout/sectfrm.cxx  |2 +-
 sw/source/core/layout/tabfrm.cxx   |6 +++---
 9 files changed, 10 insertions(+), 13 deletions(-)

New commits:
commit 2ac038e2b3e2ac70a4a351e21528f00da33e04ec
Author: Noel Grandin 
AuthorDate: Thu Oct 17 13:57:35 2019 +0200
Commit: Noel Grandin 
CommitDate: Fri Oct 18 10:30:10 2019 +0200

loplugin:virtualdead unused param in SwFlowFrame::ShouldBwdMoved

Change-Id: Ife69fe8c9023682278c02d037d35d15bd015f127
Reviewed-on: https://gerrit.libreoffice.org/81014
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/compilerplugins/clang/virtualdead.unusedparams.results 
b/compilerplugins/clang/virtualdead.unusedparams.results
index 5e0802e4a386..3573570aa806 100644
--- a/compilerplugins/clang/virtualdead.unusedparams.results
+++ b/compilerplugins/clang/virtualdead.unusedparams.results
@@ -325,9 +325,6 @@ sw/inc/swcrsr.hxx:161
 sw/source/core/access/acccontext.hxx:348
 _Bool SwAccessibleContext::SetSelectedState(_Bool,)
 0
-sw/source/core/inc/flowfrm.hxx:145
-_Bool SwFlowFrame::ShouldBwdMoved(class SwLayoutFrame *,_Bool,_Bool &,)
-101
 sw/source/core/inc/txmsrt.hxx:145
 void SwTOXSortTabBase::FillText(class SwTextNode &,const class SwIndex 
&,unsigned short,const class SwRootFrame *const,)const
 1100
diff --git a/sw/source/core/inc/cntfrm.hxx b/sw/source/core/inc/cntfrm.hxx
index 526938433267..2daec8fdd81a 100644
--- a/sw/source/core/inc/cntfrm.hxx
+++ b/sw/source/core/inc/cntfrm.hxx
@@ -49,7 +49,7 @@ class SAL_DLLPUBLIC_RTTI SwContentFrame: public SwFrame, 
public SwFlowFrame
 void UpdateAttr_( const SfxPoolItem*, const SfxPoolItem*, sal_uInt8 &,
   SwAttrSetChg *pa = nullptr, SwAttrSetChg *pb = nullptr );
 
-virtual bool ShouldBwdMoved( SwLayoutFrame *pNewUpper, bool, bool& ) 
override;
+virtual bool ShouldBwdMoved( SwLayoutFrame *pNewUpper, bool& ) override;
 
 const SwContentFrame* ImplGetNextContentFrame( bool bFwd ) const;
 
diff --git a/sw/source/core/inc/flowfrm.hxx b/sw/source/core/inc/flowfrm.hxx
index cf06172d0c06..078ef9326837 100644
--- a/sw/source/core/inc/flowfrm.hxx
+++ b/sw/source/core/inc/flowfrm.hxx
@@ -142,7 +142,7 @@ protected:
 bool CheckMoveFwd( bool& rbMakePage, bool bKeep, bool 
bIgnoreMyOwnKeepValue );
 bool MoveFwd( bool bMakePage, bool bPageBreak, bool bMoveAlways = false );
 bool MoveBwd( bool  );
-virtual bool ShouldBwdMoved( SwLayoutFrame *pNewUpper, bool bHead, bool 
 )=0;
+virtual bool ShouldBwdMoved( SwLayoutFrame *pNewUpper, bool  )=0;
 
 public:
 SwFlowFrame( SwFrame  );
diff --git a/sw/source/core/inc/sectfrm.hxx b/sw/source/core/inc/sectfrm.hxx
index d9ebecd78f97..3b890b385e2a 100644
--- a/sw/source/core/inc/sectfrm.hxx
+++ b/sw/source/core/inc/sectfrm.hxx
@@ -58,7 +58,7 @@ class SwSectionFrame: public SwLayoutFrame, public SwFlowFrame
 
 protected:
 virtual void MakeAll(vcl::RenderContext* pRenderContext) override;
-virtual bool ShouldBwdMoved( SwLayoutFrame *pNewUpper, bool bHead, bool 
 ) override;
+virtual bool ShouldBwdMoved( SwLayoutFrame *pNewUpper, bool  ) 
override;
 virtual void Format( vcl::RenderContext* pRenderContext, const 
SwBorderAttrs *pAttrs = nullptr ) override;
 virtual void Modify( const SfxPoolItem*, const SfxPoolItem* ) override;
 virtual void SwClientNotify( const SwModify&, const SfxHint& ) override;
diff --git a/sw/source/core/inc/tabfrm.hxx b/sw/source/core/inc/tabfrm.hxx
index 69e07ac9c692..95da935cd079 100644
--- a/sw/source/core/inc/tabfrm.hxx
+++ b/sw/source/core/inc/tabfrm.hxx
@@ -100,7 +100,7 @@ class SwTabFrame: public SwLayoutFrame, public SwFlowFrame
 SwAttrSetChg *pa = nullptr,
 SwAttrSetChg *pb = nullptr );
 
-virtual bool ShouldBwdMoved( SwLayoutFrame *pNewUpper, bool bHead, bool 
 ) override;
+virtual bool ShouldBwdMoved( SwLayoutFrame *pNewUpper, bool  ) 
override;
 
 virtual void DestroyImpl() override;
 virtual ~SwTabFrame() override;
diff --git a/sw/source/core/layout/calcmove.cxx 
b/sw/source/core/layout/calcmove.cxx
index a986773f422a..a8f4da4e79a4 100644
--- a/sw/source/core/layout/calcmove.cxx
+++ b/sw/source/core/layout/calcmove.cxx
@@ -50,7 +50,7 @@
 // Move methods
 
 /// Return value tells whether the Frame should be moved.
-bool SwContentFrame::ShouldBwdMoved( SwLayoutFrame *pNewUpper, bool, bool & )
+bool SwContentFrame::ShouldBwdMoved( SwLayoutFrame *pNewUpper, bool & )
 {
 if ( 

[Libreoffice-commits] core.git: compilerplugins/clang sw/source

2019-10-18 Thread Noel Grandin (via logerrit)
 compilerplugins/clang/virtualdead.unusedparams.results |3 ---
 sw/source/core/inc/SwXMLTextBlocks.hxx |2 +-
 sw/source/core/inc/swblocks.hxx|2 +-
 sw/source/core/swg/SwXMLTextBlocks.cxx |2 +-
 sw/source/core/swg/swblocks.cxx|2 +-
 5 files changed, 4 insertions(+), 7 deletions(-)

New commits:
commit 4c1ad48b4203f995dd7a7a3ac177e1ca010c252d
Author: Noel Grandin 
AuthorDate: Thu Oct 17 13:49:00 2019 +0200
Commit: Noel Grandin 
CommitDate: Fri Oct 18 09:40:38 2019 +0200

loplugin:virtualdead unused param in SwImpBlocks::Rename

Change-Id: Ifed3e1e89a2d67b08d96d89424e83c49160cb3fe
Reviewed-on: https://gerrit.libreoffice.org/81010
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/compilerplugins/clang/virtualdead.unusedparams.results 
b/compilerplugins/clang/virtualdead.unusedparams.results
index 1f333031f148..5e0802e4a386 100644
--- a/compilerplugins/clang/virtualdead.unusedparams.results
+++ b/compilerplugins/clang/virtualdead.unusedparams.results
@@ -328,9 +328,6 @@ sw/source/core/access/acccontext.hxx:348
 sw/source/core/inc/flowfrm.hxx:145
 _Bool SwFlowFrame::ShouldBwdMoved(class SwLayoutFrame *,_Bool,_Bool &,)
 101
-sw/source/core/inc/swblocks.hxx:109
-class ErrCode SwImpBlocks::Rename(unsigned short,const class rtl::OUString 
&,const class rtl::OUString &,)
-110
 sw/source/core/inc/txmsrt.hxx:145
 void SwTOXSortTabBase::FillText(class SwTextNode &,const class SwIndex 
&,unsigned short,const class SwRootFrame *const,)const
 1100
diff --git a/sw/source/core/inc/SwXMLTextBlocks.hxx 
b/sw/source/core/inc/SwXMLTextBlocks.hxx
index 47589cc01d91..3d1feb1ec01c 100644
--- a/sw/source/core/inc/SwXMLTextBlocks.hxx
+++ b/sw/source/core/inc/SwXMLTextBlocks.hxx
@@ -57,7 +57,7 @@ public:
 static OUString GeneratePackageName ( const OUString& rShort );
 virtual ~SwXMLTextBlocks() override;
 virtual ErrCode Delete( sal_uInt16 ) override;
-virtual ErrCode Rename( sal_uInt16, const OUString&, const OUString& ) 
override;
+virtual ErrCode Rename( sal_uInt16, const OUString& ) override;
 virtual void  ClearDoc() override;
 virtual ErrCode GetDoc( sal_uInt16 ) override;
 virtual ErrCode BeginPutDoc( const OUString&, const OUString& ) override;
diff --git a/sw/source/core/inc/swblocks.hxx b/sw/source/core/inc/swblocks.hxx
index ae20aac45b82..0d7fdb294aba 100644
--- a/sw/source/core/inc/swblocks.hxx
+++ b/sw/source/core/inc/swblocks.hxx
@@ -106,7 +106,7 @@ public:
 voidSetBaseURL( const OUString& rURL ) { m_sBaseURL = 
rURL; }
 
 virtual ErrCode Delete( sal_uInt16 ) = 0;
-virtual ErrCode Rename( sal_uInt16, const OUString&, const OUString& ) = 0;
+virtual ErrCode Rename( sal_uInt16, const OUString& ) = 0;
 virtual ErrCode GetDoc( sal_uInt16 ) = 0;
 virtual ErrCode BeginPutDoc( const OUString&, const OUString& ) = 0;
 virtual ErrCode PutDoc() = 0;
diff --git a/sw/source/core/swg/SwXMLTextBlocks.cxx 
b/sw/source/core/swg/SwXMLTextBlocks.cxx
index 2a74d155751d..a46d7d67039d 100644
--- a/sw/source/core/swg/SwXMLTextBlocks.cxx
+++ b/sw/source/core/swg/SwXMLTextBlocks.cxx
@@ -184,7 +184,7 @@ ErrCode SwXMLTextBlocks::Delete( sal_uInt16 n )
 return ERRCODE_NONE;
 }
 
-ErrCode SwXMLTextBlocks::Rename( sal_uInt16 nIdx, const OUString& rNewShort, 
const OUString& )
+ErrCode SwXMLTextBlocks::Rename( sal_uInt16 nIdx, const OUString& rNewShort )
 {
 OSL_ENSURE( xBlkRoot.is(), "No storage set" );
 if(!xBlkRoot.is())
diff --git a/sw/source/core/swg/swblocks.cxx b/sw/source/core/swg/swblocks.cxx
index ace092727f1a..8afeecea9432 100644
--- a/sw/source/core/swg/swblocks.cxx
+++ b/sw/source/core/swg/swblocks.cxx
@@ -339,7 +339,7 @@ void SwTextBlocks::Rename( sal_uInt16 n, const OUString* s, 
const OUString* l )
 {
 // Set the new entry in the list before we do that!
 aNew = GetAppCharClass().uppercase( aNew );
-nErr = pImp->Rename( n, aNew, aLong );
+nErr = pImp->Rename( n, aNew );
 if( !nErr )
 {
 bool bOnlyText = pImp->m_aNames[ n ]->bIsOnlyText;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: compilerplugins/clang sw/source

2019-10-18 Thread Noel Grandin (via logerrit)
 compilerplugins/clang/virtualdead.unusedparams.results |3 ---
 sw/source/filter/xml/xmlexpit.cxx  |   14 +++---
 sw/source/filter/xml/xmlexpit.hxx  |   10 ++
 sw/source/filter/xml/xmliteme.cxx  |   12 ++--
 4 files changed, 7 insertions(+), 32 deletions(-)

New commits:
commit ecfc3689320798e75f0836974ef917a6b83ad535
Author: Noel Grandin 
AuthorDate: Thu Oct 17 13:17:12 2019 +0200
Commit: Noel Grandin 
CommitDate: Fri Oct 18 09:40:22 2019 +0200

loplugin:virtualdead unused params in 
SvXMLExportItemMapper::handleElementItem

Change-Id: Ib77a29d23d8a67fab8441d369b2ff4660c1f99bc
Reviewed-on: https://gerrit.libreoffice.org/81009
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/compilerplugins/clang/virtualdead.unusedparams.results 
b/compilerplugins/clang/virtualdead.unusedparams.results
index 73274db75fc5..1f333031f148 100644
--- a/compilerplugins/clang/virtualdead.unusedparams.results
+++ b/compilerplugins/clang/virtualdead.unusedparams.results
@@ -340,9 +340,6 @@ sw/source/filter/ww8/wrtww8.hxx:798
 sw/source/filter/ww8/wrtww8.hxx:863
 void MSWordExportBase::OutputGrfNode(const class SwGrfNode &,)
 0
-sw/source/filter/xml/xmlexpit.hxx:84
-void SvXMLExportItemMapper::handleElementItem(class SvXMLExport &,const 
struct SvXMLItemMapEntry &,const class SfxPoolItem &,const class 
SvXMLUnitConverter &,const class SfxItemSet &,enum SvXmlExportFlags,)const
-011000
 vcl/inc/outdev.h:122
 _Bool ImplGlyphFallbackFontSubstitution::FindFontSubstitute(class 
FontSelectPattern &,class LogicalFontInstance *,class rtl::OUString &,)const
 101
diff --git a/sw/source/filter/xml/xmlexpit.cxx 
b/sw/source/filter/xml/xmlexpit.cxx
index 8b09189ba403..0fc88cbba90d 100644
--- a/sw/source/filter/xml/xmlexpit.cxx
+++ b/sw/source/filter/xml/xmlexpit.cxx
@@ -239,9 +239,7 @@ void SvXMLExportItemMapper::exportXML( const SvXMLExport& 
rExport,
 
 void SvXMLExportItemMapper::exportElementItems(
   SvXMLExport& rExport,
-  const SvXMLUnitConverter& rUnitConverter,
   const SfxItemSet ,
-  SvXmlExportFlags nFlags,
   const std::vector  ) const
 {
 const size_t nCount = rIndexArray.size();
@@ -259,8 +257,7 @@ void SvXMLExportItemMapper::exportElementItems(
 if(pItem)
 {
 rExport.IgnorableWhitespace();
-handleElementItem( rExport, rEntry, *pItem, rUnitConverter,
-   rSet, nFlags);
+handleElementItem( rEntry, *pItem );
 bItemsExported = true;
 }
 }
@@ -314,8 +311,7 @@ void SvXMLExportItemMapper::exportXML( SvXMLExport& rExport,
 
 SvXMLElementExport aElem( rExport, XML_NAMESPACE_STYLE, ePropToken,
   false, false );
-exportElementItems( rExport, rUnitConverter,
-rSet, SvXmlExportFlags::IGN_WS, aIndexArray );
+exportElementItems( rExport, rSet, aIndexArray );
 }
 }
 
@@ -334,12 +330,8 @@ void SvXMLExportItemMapper::handleSpecialItem( 
SvXMLAttributeList& /*rAttrList*/
 /** this method is called for every item that has the
 MID_SW_FLAG_ELEMENT_EXPORT flag set */
 void SvXMLExportItemMapper::handleElementItem(
-SvXMLExport& /*rExport*/,
 const SvXMLItemMapEntry& /*rEntry*/,
-const SfxPoolItem& /*rItem*/,
-const SvXMLUnitConverter& /*rUnitConverter*/,
-const SfxItemSet& /*rSet*/,
-SvXmlExportFlags /*nFlags*/ ) const
+const SfxPoolItem& /*rItem*/ ) const
 {
 OSL_FAIL( "element item not handled in xml export" );
 }
diff --git a/sw/source/filter/xml/xmlexpit.hxx 
b/sw/source/filter/xml/xmlexpit.hxx
index f3f07c33c351..7639dd063c65 100644
--- a/sw/source/filter/xml/xmlexpit.hxx
+++ b/sw/source/filter/xml/xmlexpit.hxx
@@ -53,9 +53,7 @@ protected:
 const SfxItemSet *pSet ) const;
 
 void exportElementItems(  SvXMLExport& rExport,
-  const SvXMLUnitConverter& rUnitConverter,
   const SfxItemSet ,
-  SvXmlExportFlags nFlags,
   const std::vector  ) 
const;
 
 static const SfxPoolItem* GetItem( const SfxItemSet ,
@@ -81,12 +79,8 @@ public:
 
 /** this method is called for every item that has the
 MID_SW_FLAG_ELEMENT_EXPORT flag set */
-virtual void handleElementItem( SvXMLExport& rExport,
-const SvXMLItemMapEntry& rEntry,
-const SfxPoolItem& rItem,
-const SvXMLUnitConverter& rUnitConverter,
-const SfxItemSet& rSet,
-   

[Libreoffice-commits] core.git: compilerplugins/clang sw/source

2019-10-18 Thread Noel Grandin (via logerrit)
 compilerplugins/clang/virtualdead.unusedparams.results |3 ---
 sw/source/filter/xml/xmlimpit.cxx  |6 ++
 sw/source/filter/xml/xmlimpit.hxx  |3 +--
 sw/source/filter/xml/xmlitemi.cxx  |6 ++
 4 files changed, 5 insertions(+), 13 deletions(-)

New commits:
commit 933592b2010e50f17d6fd2489a019b1be9cd
Author: Noel Grandin 
AuthorDate: Thu Oct 17 13:12:25 2019 +0200
Commit: Noel Grandin 
CommitDate: Fri Oct 18 09:15:42 2019 +0200

loplugin:virtualdead unused param in 
SvXMLImportItemMapper::handleSpecialItem

Change-Id: Ie1a8fdafb64f6374ae9108dbb47592b044703cc9
Reviewed-on: https://gerrit.libreoffice.org/81008
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/compilerplugins/clang/virtualdead.unusedparams.results 
b/compilerplugins/clang/virtualdead.unusedparams.results
index 6f7c786361d9..73274db75fc5 100644
--- a/compilerplugins/clang/virtualdead.unusedparams.results
+++ b/compilerplugins/clang/virtualdead.unusedparams.results
@@ -343,9 +343,6 @@ sw/source/filter/ww8/wrtww8.hxx:863
 sw/source/filter/xml/xmlexpit.hxx:84
 void SvXMLExportItemMapper::handleElementItem(class SvXMLExport &,const 
struct SvXMLItemMapEntry &,const class SfxPoolItem &,const class 
SvXMLUnitConverter &,const class SfxItemSet &,enum SvXmlExportFlags,)const
 011000
-sw/source/filter/xml/xmlimpit.hxx:48
-_Bool SvXMLImportItemMapper::handleSpecialItem(const struct 
SvXMLItemMapEntry &,class SfxPoolItem &,class SfxItemSet &,const class 
rtl::OUString &,const class SvXMLUnitConverter &,const class SvXMLNamespaceMap 
&,)
-10
 vcl/inc/outdev.h:122
 _Bool ImplGlyphFallbackFontSubstitution::FindFontSubstitute(class 
FontSelectPattern &,class LogicalFontInstance *,class rtl::OUString &,)const
 101
diff --git a/sw/source/filter/xml/xmlimpit.cxx 
b/sw/source/filter/xml/xmlimpit.cxx
index 0ba10f9cfd25..2436e2e4f1c8 100644
--- a/sw/source/filter/xml/xmlimpit.cxx
+++ b/sw/source/filter/xml/xmlimpit.cxx
@@ -133,8 +133,7 @@ void SvXMLImportItemMapper::importXML( SfxItemSet& rSet,
 else
 {
 bPut = handleSpecialItem( *pEntry, *pNewItem, rSet,
-  rValue, rUnitConverter,
-  rNamespaceMap );
+  rValue, rUnitConverter );
 }
 
 if( bPut )
@@ -192,8 +191,7 @@ SvXMLImportItemMapper::handleSpecialItem(  const 
SvXMLItemMapEntry& /*rEntry*/,
 SfxPoolItem& /*rItem*/,
 SfxItemSet& /*rSet*/,
 const OUString& /*rValue*/,
-const SvXMLUnitConverter& 
/*rUnitConverter*/,
-const SvXMLNamespaceMap& 
/*rNamespaceMap*/ )
+const SvXMLUnitConverter& 
/*rUnitConverter*/ )
 {
 OSL_FAIL( "unsupported special item in xml import" );
 return false;
diff --git a/sw/source/filter/xml/xmlimpit.hxx 
b/sw/source/filter/xml/xmlimpit.hxx
index d6c19b20bea3..ff6920faac17 100644
--- a/sw/source/filter/xml/xmlimpit.hxx
+++ b/sw/source/filter/xml/xmlimpit.hxx
@@ -49,8 +49,7 @@ public:
 SfxPoolItem& rItem,
 SfxItemSet& rSet,
 const OUString& rValue,
-const SvXMLUnitConverter& rUnitConverter,
-const SvXMLNamespaceMap& rNamespaceMap );
+const SvXMLUnitConverter& rUnitConverter );
 
 /** this method is called for every item that has the
 MID_SW_FLAG_NO_ITEM_IMPORT flag set */
diff --git a/sw/source/filter/xml/xmlitemi.cxx 
b/sw/source/filter/xml/xmlitemi.cxx
index b14f28bc7534..e6542b33157d 100644
--- a/sw/source/filter/xml/xmlitemi.cxx
+++ b/sw/source/filter/xml/xmlitemi.cxx
@@ -63,8 +63,7 @@ public:
 SfxPoolItem& rItem,
 SfxItemSet& rSet,
 const OUString& rValue,
-const SvXMLUnitConverter& rUnitConverter,
-const SvXMLNamespaceMap& rNamespaceMap ) 
override;
+const SvXMLUnitConverter& rUnitConverter ) 
override;
 
 virtual bool
 handleNoItem(SvXMLItemMapEntry const& rEntry,
@@ -114,8 +113,7 @@ bool SwXMLImportTableItemMapper_Impl::handleSpecialItem(
 SfxPoolItem& rItem,
 SfxItemSet& rItemSet,
 const OUString& rValue,
-const SvXMLUnitConverter& 

[Libreoffice-commits] core.git: compilerplugins/clang sw/source

2019-10-17 Thread Noel Grandin (via logerrit)
 compilerplugins/clang/virtualdead.unusedparams.results |6 --
 sw/source/ui/dbui/mmoutputtypepage.cxx |8 +--
 sw/source/uibase/dbui/dbmgr.cxx|5 --
 sw/source/uibase/dbui/maildispatcher.cxx   |   36 ++---
 sw/source/uibase/inc/imaildsplistener.hxx  |4 -
 5 files changed, 12 insertions(+), 47 deletions(-)

New commits:
commit 6fe42f2050948f1d12bfb804e4c8fe1b82a6aa1d
Author: Noel Grandin 
AuthorDate: Thu Oct 17 13:09:47 2019 +0200
Commit: Noel Grandin 
CommitDate: Fri Oct 18 07:25:00 2019 +0200

loplugin:virtualdead unused params in IMailDispatcherListener

Change-Id: I0cc6a813db88efc98673400447d98e50c32bc720
Reviewed-on: https://gerrit.libreoffice.org/80962
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/compilerplugins/clang/virtualdead.unusedparams.results 
b/compilerplugins/clang/virtualdead.unusedparams.results
index 041439172418..6f7c786361d9 100644
--- a/compilerplugins/clang/virtualdead.unusedparams.results
+++ b/compilerplugins/clang/virtualdead.unusedparams.results
@@ -346,12 +346,6 @@ sw/source/filter/xml/xmlexpit.hxx:84
 sw/source/filter/xml/xmlimpit.hxx:48
 _Bool SvXMLImportItemMapper::handleSpecialItem(const struct 
SvXMLItemMapEntry &,class SfxPoolItem &,class SfxItemSet &,const class 
rtl::OUString &,const class SvXMLUnitConverter &,const class SvXMLNamespaceMap 
&,)
 10
-sw/source/uibase/inc/imaildsplistener.hxx:44
-void IMailDispatcherListener::idle(class rtl::Reference,)
-0
-sw/source/uibase/inc/imaildsplistener.hxx:50
-void IMailDispatcherListener::mailDelivered(class rtl::Reference,class com::sun::star::uno::Reference,)
-01
 vcl/inc/outdev.h:122
 _Bool ImplGlyphFallbackFontSubstitution::FindFontSubstitute(class 
FontSelectPattern &,class LogicalFontInstance *,class rtl::OUString &,)const
 101
diff --git a/sw/source/ui/dbui/mmoutputtypepage.cxx 
b/sw/source/ui/dbui/mmoutputtypepage.cxx
index cdf6fa59b065..e5d0b2e8528d 100644
--- a/sw/source/ui/dbui/mmoutputtypepage.cxx
+++ b/sw/source/ui/dbui/mmoutputtypepage.cxx
@@ -121,9 +121,8 @@ class SwMailDispatcherListener_Impl : public 
IMailDispatcherListener
 public:
 explicit SwMailDispatcherListener_Impl(SwSendMailDialog& rParentDlg);
 
-virtual void idle(::rtl::Reference xMailDispatcher) 
override;
-virtual void mailDelivered(::rtl::Reference 
xMailDispatcher,
-uno::Reference< mail::XMailMessage> xMailMessage) override;
+virtual void idle() override;
+virtual void mailDelivered(uno::Reference< mail::XMailMessage> 
xMailMessage) override;
 virtual void mailDeliveryError(::rtl::Reference 
xMailDispatcher,
 uno::Reference< mail::XMailMessage> xMailMessage, const 
OUString& sErrorMessage) override;
 
@@ -135,14 +134,13 @@ 
SwMailDispatcherListener_Impl::SwMailDispatcherListener_Impl(SwSendMailDialog& r
 {
 }
 
-void SwMailDispatcherListener_Impl::idle(::rtl::Reference 
/*xMailDispatcher*/)
+void SwMailDispatcherListener_Impl::idle()
 {
 SolarMutexGuard aGuard;
 m_rSendMailDialog.AllMailsSent();
 }
 
 void SwMailDispatcherListener_Impl::mailDelivered(
-::rtl::Reference /*xMailDispatcher*/,
 uno::Reference< mail::XMailMessage> xMailMessage)
 {
 SolarMutexGuard aGuard;
diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx
index 4eeb3a32a3a9..c127143bf848 100644
--- a/sw/source/uibase/dbui/dbmgr.cxx
+++ b/sw/source/uibase/dbui/dbmgr.cxx
@@ -1078,10 +1078,9 @@ public:
 explicit MailDispatcherListener_Impl( SwDBManager  )
 : m_rDBManager( rDBManager ) {}
 
-virtual void idle( ::rtl::Reference ) override {}
+virtual void idle() override {}
 
-virtual void mailDelivered( ::rtl::Reference,
- uno::Reference< mail::XMailMessage> xMessage ) override
+virtual void mailDelivered( uno::Reference< mail::XMailMessage> xMessage ) 
override
 {
 osl::MutexGuard aGuard( m_rDBManager.m_pImpl->m_aAllEmailSendMutex );
 if ( m_rDBManager.m_pImpl->m_xLastMessage == xMessage )
diff --git a/sw/source/uibase/dbui/maildispatcher.cxx 
b/sw/source/uibase/dbui/maildispatcher.cxx
index e55e61bfb8ae..185d0d74eb55 100644
--- a/sw/source/uibase/dbui/maildispatcher.cxx
+++ b/sw/source/uibase/dbui/maildispatcher.cxx
@@ -31,43 +31,17 @@ typedef std::vector< 
::rtl::Reference > MailDispatcherL
 
 namespace /* private */
 {
-/* Generic event notifier for started,
-   stopped, and idle events which are
-   very similarly */
-class GenericEventNotifier
-{
-public:
-// pointer to virtual function typedef
-typedef void 
(IMailDispatcherListener::*GenericNotificationFunc_t)(::rtl::Reference);
-
-GenericEventNotifier(
-GenericNotificationFunc_t notification_function,
-::rtl::Reference const & mail_dispatcher) :
-

[Libreoffice-commits] core.git: compilerplugins/clang sw/source

2019-05-05 Thread Andrea Gelmini (via logerrit)
 compilerplugins/clang/store/cascadingassignop.cxx |2 +-
 compilerplugins/clang/store/cascadingcondop.cxx   |2 +-
 sw/source/filter/ww8/writerhelper.hxx |2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 65a60e13bb17d2653ff867f095c1590cc1a41c49
Author: Andrea Gelmini 
AuthorDate: Sat May 4 08:50:33 2019 +
Commit: Julien Nabet 
CommitDate: Sun May 5 10:14:07 2019 +0200

Fix typo

Change-Id: I87fa75d2aab64031426ce0560344908bd81d413c
Reviewed-on: https://gerrit.libreoffice.org/71816
Reviewed-by: Julien Nabet 
Tested-by: Julien Nabet 

diff --git a/compilerplugins/clang/store/cascadingassignop.cxx 
b/compilerplugins/clang/store/cascadingassignop.cxx
index 660689b9c77b..a1098ee0642c 100644
--- a/compilerplugins/clang/store/cascadingassignop.cxx
+++ b/compilerplugins/clang/store/cascadingassignop.cxx
@@ -15,7 +15,7 @@
 This is a compile check.
 
 It checks for complex statements with conditional operators in conditional
-operators, which are errorprone, e.g.
+operators, which are error prone, e.g.
  Thing foo = IsBar() ? ( IsBaz() ? b1 : b2 ) : b3;
 
 However, it finds 556 cases in sw/source alone, thus likely needs some more
diff --git a/compilerplugins/clang/store/cascadingcondop.cxx 
b/compilerplugins/clang/store/cascadingcondop.cxx
index 8164e4614f6b..f2687e76922d 100644
--- a/compilerplugins/clang/store/cascadingcondop.cxx
+++ b/compilerplugins/clang/store/cascadingcondop.cxx
@@ -15,7 +15,7 @@
 This is a compile check.
 
 It checks for complex statements with conditional operators in conditional
-operators, which are errorprone, e.g.
+operators, which are error prone, e.g.
  Thing foo = IsBar() ? ( IsBaz() ? b1 : b2 ) : b3;
 
 However, it finds 556 cases in sw/source alone, thus likely needs some more
diff --git a/sw/source/filter/ww8/writerhelper.hxx 
b/sw/source/filter/ww8/writerhelper.hxx
index 9d8d6fbcdb17..80430bcca9d7 100644
--- a/sw/source/filter/ww8/writerhelper.hxx
+++ b/sw/source/filter/ww8/writerhelper.hxx
@@ -209,7 +209,7 @@ namespace sw
 /** Provide a dynamic_cast style cast for SfxPoolItems
 
 A SfxPoolItem generally need to be cast back to its original type
-to be useful, which is both tedious and errorprone. So item_cast is
+to be useful, which is both tedious and error prone. So item_cast 
is
 a helper template to aid the process and test if the cast is
 correct.
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: compilerplugins/clang sw/source

2018-12-11 Thread Libreoffice Gerrit user
 compilerplugins/clang/unusedfields.only-used-in-constructor.results |   48 
+---
 compilerplugins/clang/unusedfields.readonly.results |   12 +-
 compilerplugins/clang/unusedfields.untouched.results|   48 
+---
 compilerplugins/clang/unusedfields.writeonly.results|   56 
+-
 sw/source/core/inc/UndoTable.hxx|4 
 sw/source/core/undo/untbl.cxx   |   21 +--
 6 files changed, 67 insertions(+), 122 deletions(-)

New commits:
commit a8c1db54830fda16c5f5a9399bf11616570342da
Author: Noel Grandin 
AuthorDate: Tue Dec 11 09:03:58 2018 +0200
Commit: Noel Grandin 
CommitDate: Tue Dec 11 10:37:52 2018 +0100

loplugin:unusedfields

Change-Id: I9f11c29a5bcb3512717ad01962f5645de96afe0b
Reviewed-on: https://gerrit.libreoffice.org/64918
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git 
a/compilerplugins/clang/unusedfields.only-used-in-constructor.results 
b/compilerplugins/clang/unusedfields.only-used-in-constructor.results
index bf7b314ad9de..0e242983d41a 100644
--- a/compilerplugins/clang/unusedfields.only-used-in-constructor.results
+++ b/compilerplugins/clang/unusedfields.only-used-in-constructor.results
@@ -74,32 +74,6 @@ connectivity/source/inc/flat/EResultSet.hxx:42
 connectivity::flat::OFlatResultSet m_bBookmarkable _Bool
 connectivity/source/inc/java/lang/Object.hxx:45
 connectivity::SDBThreadAttach m_aGuard jvmaccess::class 
VirtualMachine::AttachGuard
-cppcanvas/source/inc/implrenderer.hxx:158
-cppcanvas::internal::(anonymous) aWorldTransform struct 
cppcanvas::internal::XForm
-cppcanvas/source/inc/implrenderer.hxx:159
-cppcanvas::internal::(anonymous) aDevState struct 
cppcanvas::internal::OutDevState
-cppcanvas/source/inc/implrenderer.hxx:255
-cppcanvas::internal::ImplRenderer aWorldTransform struct 
cppcanvas::internal::XForm
-cppcanvas/source/inc/implrenderer.hxx:257
-cppcanvas::internal::ImplRenderer fPageScale float
-cppcanvas/source/inc/implrenderer.hxx:258
-cppcanvas::internal::ImplRenderer nOriginX sal_Int32
-cppcanvas/source/inc/implrenderer.hxx:259
-cppcanvas::internal::ImplRenderer nOriginY sal_Int32
-cppcanvas/source/inc/implrenderer.hxx:260
-cppcanvas::internal::ImplRenderer nHDPI sal_Int32
-cppcanvas/source/inc/implrenderer.hxx:261
-cppcanvas::internal::ImplRenderer nVDPI sal_Int32
-cppcanvas/source/inc/implrenderer.hxx:272
-cppcanvas::internal::ImplRenderer mbMultipart _Bool
-cppcanvas/source/inc/implrenderer.hxx:273
-cppcanvas::internal::ImplRenderer mMFlags sal_uInt16
-cppcanvas/source/inc/implrenderer.hxx:274
-cppcanvas::internal::ImplRenderer mMStream class SvMemoryStream
-cppcanvas/source/inc/implrenderer.hxx:276
-cppcanvas::internal::ImplRenderer mGSStack 
cppcanvas::internal::GraphicStateMap
-cppcanvas/source/inc/implrenderer.hxx:277
-cppcanvas::internal::ImplRenderer mGSContainerStack 
cppcanvas::internal::GraphicStateMap
 cppcanvas/source/mtfrenderer/textaction.cxx:809
 cppcanvas::internal::(anonymous namespace)::EffectTextAction 
maTextLineInfo const tools::TextLineInfo
 cppcanvas/source/mtfrenderer/textaction.cxx:1638
@@ -152,8 +126,6 @@ cppu/source/uno/check.cxx:134
 (anonymous namespace)::Char3 c3 char
 cppu/source/uno/check.cxx:138
 (anonymous namespace)::Char4 chars struct (anonymous namespace)::Char3
-cui/source/customize/cfgutil.cxx:447
-CuiConfigGroupBoxResource_Impl m_sMacros class rtl::OUString
 cui/source/dialogs/colorpicker.cxx:712
 cui::ColorPickerDialog m_aColorPrevious class cui::ColorPreviewControl
 cui/source/factory/dlgfact.cxx:1378
@@ -524,13 +496,11 @@ sc/inc/compiler.hxx:259
 ScCompiler::AddInMap pUpper const char *
 sc/inc/token.hxx:400
 SingleDoubleRefModifier aDub struct ScComplexRefData
-sc/inc/xmlwrap.hxx:104
-ScXMLChartExportWrapper mrMedium class SfxMedium &
 sc/qa/unit/ucalc_column.cxx:104
 aInputs aName const char *
-sc/source/core/data/document.cxx:1225
+sc/source/core/data/document.cxx:1237
 (anonymous namespace)::BroadcastRecalcOnRefMoveHandler aSwitch const 
sc::AutoCalcSwitch
-sc/source/core/data/document.cxx:1226
+sc/source/core/data/document.cxx:1238
 (anonymous namespace)::BroadcastRecalcOnRefMoveHandler aBulk const class 
ScBulkBroadcast
 sc/source/filter/html/htmlpars.cxx:3030
 (anonymous namespace)::CSSHandler::MemStr mp const char *
@@ -584,8 +554,6 @@ sc/source/ui/inc/msgpool.hxx:44
 ScMessagePool aCondFormatDlgItem class ScCondFormatDlgItem
 sc/source/ui/inc/notemark.hxx:46
 ScNoteMarker m_aTimer class Timer
-sc/source/ui/inc/tabbgcolordlg.hxx:56
-ScTabBgColorDlg m_aTabBgColorNoColorText const class rtl::OUString
 sccomp/source/solver/DifferentialEvolution.hxx:35
 DifferentialEvolutionAlgorithm maRandomDevice std::random_device
 sccomp/source/solver/ParticelSwarmOptimization.hxx:56
@@ -633,10 +601,10 @@ 

[Libreoffice-commits] core.git: compilerplugins/clang sw/source

2018-11-21 Thread Libreoffice Gerrit user
 compilerplugins/clang/unusedenumconstants.untouched.results |6 --
 sw/source/core/inc/txtfly.hxx   |2 --
 2 files changed, 8 deletions(-)

New commits:
commit 507dc611bd561c854f228b92ec70348b8e8ddd06
Author: Noel Grandin 
AuthorDate: Wed Nov 21 14:51:08 2018 +0200
Commit: Noel Grandin 
CommitDate: Thu Nov 22 07:39:35 2018 +0100

remove unused PAGESIDE enum

Change-Id: I45185865ec0645040b129885beb97bebafefe70a
Reviewed-on: https://gerrit.libreoffice.org/63747
Reviewed-by: Noel Grandin 
Tested-by: Noel Grandin 

diff --git a/compilerplugins/clang/unusedenumconstants.untouched.results 
b/compilerplugins/clang/unusedenumconstants.untouched.results
index 9eccb025d858..ce531f8143d7 100644
--- a/compilerplugins/clang/unusedenumconstants.untouched.results
+++ b/compilerplugins/clang/unusedenumconstants.untouched.results
@@ -466,12 +466,6 @@ sw/inc/poolfmt.hxx:234
 enum RES_POOL_TABSTYLE_TYPE RES_POOLTABLESTYLE_LO6_SIMPLE_LIST_SHADED
 sw/inc/tblafmt.hxx:286
 enum SwTableAutoFormat::UpdateFlags UPDATE_ALL
-sw/source/core/inc/txtfly.hxx:42
-enum PAGESIDE RIGHT_SIDE
-sw/source/core/inc/txtfly.hxx:42
-enum PAGESIDE LEFT_SIDE
-sw/source/core/inc/txtfly.hxx:42
-enum PAGESIDE DONTKNOW_SIDE
 sw/source/filter/ww8/ww8scan.hxx:388
 enum ePLCFT SEP
 sw/source/filter/ww8/ww8struc.hxx:944
diff --git a/sw/source/core/inc/txtfly.hxx b/sw/source/core/inc/txtfly.hxx
index b3ecc1f07d9c..f8b2979d927f 100644
--- a/sw/source/core/inc/txtfly.hxx
+++ b/sw/source/core/inc/txtfly.hxx
@@ -39,8 +39,6 @@ class SwContourCache;
 
 typedef std::vector< SwAnchoredObject* > SwAnchoredObjList;
 
-enum PAGESIDE { LEFT_SIDE, RIGHT_SIDE, DONTKNOW_SIDE };
-
 /** Contour-cache global variable, initialized/destroyed in txtinit.cxx
 and needed in txtfly.cxx by text wrapping.
   */
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: compilerplugins/clang sw/source

2018-11-21 Thread Libreoffice Gerrit user
 compilerplugins/clang/unusedenumconstants.untouched.results |8 
 sw/source/uibase/inc/tautofmt.hxx   |2 --
 2 files changed, 10 deletions(-)

New commits:
commit ecd6b4f37341977ced8f2c8f508faaf72a1cfa64
Author: Noel Grandin 
AuthorDate: Wed Nov 21 14:25:28 2018 +0200
Commit: Noel Grandin 
CommitDate: Thu Nov 22 07:38:17 2018 +0100

remove unused enum AutoFormatLine

Change-Id: I8e39be5a5f2306121358eaaf07bb026c2f577bf3
Reviewed-on: https://gerrit.libreoffice.org/63744
Reviewed-by: Noel Grandin 
Tested-by: Noel Grandin 

diff --git a/compilerplugins/clang/unusedenumconstants.untouched.results 
b/compilerplugins/clang/unusedenumconstants.untouched.results
index 1ad1d3e44b2f..9eccb025d858 100644
--- a/compilerplugins/clang/unusedenumconstants.untouched.results
+++ b/compilerplugins/clang/unusedenumconstants.untouched.results
@@ -494,14 +494,6 @@ sw/source/uibase/docvw/edtwin.cxx:1570
 enum SwKeyState ColTopBig
 sw/source/uibase/docvw/edtwin.cxx:1571
 enum SwKeyState ColTopSmall
-sw/source/uibase/inc/tautofmt.hxx:36
-enum AutoFormatLine BOTTOM_LINE
-sw/source/uibase/inc/tautofmt.hxx:36
-enum AutoFormatLine LEFT_LINE
-sw/source/uibase/inc/tautofmt.hxx:36
-enum AutoFormatLine RIGHT_LINE
-sw/source/uibase/inc/tautofmt.hxx:36
-enum AutoFormatLine TOP_LINE
 sw/source/uibase/utlui/content.cxx:824
 enum STR_CONTEXT_IDX IDX_STR_LINK_REGION
 sw/source/uibase/utlui/content.cxx:825
diff --git a/sw/source/uibase/inc/tautofmt.hxx 
b/sw/source/uibase/inc/tautofmt.hxx
index fdee21d9e3ab..bfc00a3d97d5 100644
--- a/sw/source/uibase/inc/tautofmt.hxx
+++ b/sw/source/uibase/inc/tautofmt.hxx
@@ -33,8 +33,6 @@ class SwTableAutoFormat;
 class SwTableAutoFormatTable;
 class SwWrtShell;
 
-enum AutoFormatLine { TOP_LINE, BOTTOM_LINE, LEFT_LINE, RIGHT_LINE };
-
 class SwAutoFormatDlg : public SfxDialogController
 {
 OUString const  m_aStrTitle;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: compilerplugins/clang sw/source

2018-11-21 Thread Libreoffice Gerrit user
 compilerplugins/clang/unusedenumconstants.untouched.results |2 -
 sw/source/filter/html/htmlgrin.cxx  |4 +-
 sw/source/filter/html/htmlsect.cxx  |8 ++--
 sw/source/filter/html/htmltab.cxx   |4 +-
 sw/source/filter/html/swhtml.cxx|   22 ++--
 sw/source/filter/html/swhtml.hxx|4 +-
 6 files changed, 21 insertions(+), 23 deletions(-)

New commits:
commit 4d60a038c936011674564e517929de7f9c1080d0
Author: Noel Grandin 
AuthorDate: Wed Nov 21 14:50:27 2018 +0200
Commit: Noel Grandin 
CommitDate: Thu Nov 22 07:37:12 2018 +0100

convert JumpToMarks to scoped enum

and remove unused JUMPTO_FRAME

Change-Id: Ic12350c66612a7be5f930d1cddd0481b397f3c53
Reviewed-on: https://gerrit.libreoffice.org/63746
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/compilerplugins/clang/unusedenumconstants.untouched.results 
b/compilerplugins/clang/unusedenumconstants.untouched.results
index d9f149e6cca0..1ad1d3e44b2f 100644
--- a/compilerplugins/clang/unusedenumconstants.untouched.results
+++ b/compilerplugins/clang/unusedenumconstants.untouched.results
@@ -472,8 +472,6 @@ sw/source/core/inc/txtfly.hxx:42
 enum PAGESIDE LEFT_SIDE
 sw/source/core/inc/txtfly.hxx:42
 enum PAGESIDE DONTKNOW_SIDE
-sw/source/filter/html/swhtml.hxx:408
-enum SwHTMLParser::JumpToMarks JUMPTO_FRAME
 sw/source/filter/ww8/ww8scan.hxx:388
 enum ePLCFT SEP
 sw/source/filter/ww8/ww8struc.hxx:944
diff --git a/sw/source/filter/html/htmlgrin.cxx 
b/sw/source/filter/html/htmlgrin.cxx
index 9527271c2f11..2972d1bc9e59 100644
--- a/sw/source/filter/html/htmlgrin.cxx
+++ b/sw/source/filter/html/htmlgrin.cxx
@@ -798,10 +798,10 @@ IMAGE_SETEVENT:
 pFlyFormat->SetName( sHTMLGrfName );
 
 // maybe jump to graphic
-if( JUMPTO_GRAPHIC == m_eJumpTo && sHTMLGrfName == m_sJmpMark )
+if( JumpToMarks::Graphic == m_eJumpTo && sHTMLGrfName == m_sJmpMark )
 {
 m_bChkJumpMark = true;
-m_eJumpTo = JUMPTO_NONE;
+m_eJumpTo = JumpToMarks::NONE;
 }
 }
 
diff --git a/sw/source/filter/html/htmlsect.cxx 
b/sw/source/filter/html/htmlsect.cxx
index 5ce635e6aa7c..786e637a1b71 100644
--- a/sw/source/filter/html/htmlsect.cxx
+++ b/sw/source/filter/html/htmlsect.cxx
@@ -338,10 +338,10 @@ void SwHTMLParser::NewDivision( HtmlTokenId nToken )
 m_xDoc->InsertSwSection( *m_pPam, aSection, nullptr, , 
false );
 
 // maybe jump to section
-if( JUMPTO_REGION == m_eJumpTo && aName == m_sJmpMark )
+if( JumpToMarks::Region == m_eJumpTo && aName == m_sJmpMark )
 {
 m_bChkJumpMark = true;
-m_eJumpTo = JUMPTO_NONE;
+m_eJumpTo = JumpToMarks::NONE;
 }
 
 SwTextNode* pOldTextNd =
@@ -724,10 +724,10 @@ void SwHTMLParser::NewMultiCol( sal_uInt16 columnsFromCss 
)
 m_xDoc->InsertSwSection( *m_pPam, aSection, nullptr, , 
false );
 
 // Jump to section, if this is requested.
-if( JUMPTO_REGION == m_eJumpTo && aName == m_sJmpMark )
+if( JumpToMarks::Region == m_eJumpTo && aName == m_sJmpMark )
 {
 m_bChkJumpMark = true;
-m_eJumpTo = JUMPTO_NONE;
+m_eJumpTo = JumpToMarks::NONE;
 }
 
 SwTextNode* pOldTextNd =
diff --git a/sw/source/filter/html/htmltab.cxx 
b/sw/source/filter/html/htmltab.cxx
index 955bc98e1e67..b293885853b8 100644
--- a/sw/source/filter/html/htmltab.cxx
+++ b/sw/source/filter/html/htmltab.cxx
@@ -5219,11 +5219,11 @@ std::shared_ptr 
SwHTMLParser::BuildTable(SvxAdjust eParentAdjust,
 m_nParaCnt = m_nParaCnt - std::min(m_nParaCnt, nTableBoxSize);
 
 // Jump to a table if needed
-if( JUMPTO_TABLE == m_eJumpTo && m_xTable->GetSwTable() &&
+if( JumpToMarks::Table == m_eJumpTo && m_xTable->GetSwTable() &&
 m_xTable->GetSwTable()->GetFrameFormat()->GetName() == 
m_sJmpMark )
 {
 m_bChkJumpMark = true;
-m_eJumpTo = JUMPTO_NONE;
+m_eJumpTo = JumpToMarks::NONE;
 }
 
 // If the import was canceled, don't call Show again here since
diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx
index ce6a79f8e0dd..f984100ab9a4 100644
--- a/sw/source/filter/html/swhtml.cxx
+++ b/sw/source/filter/html/swhtml.cxx
@@ -281,7 +281,7 @@ SwHTMLParser::SwHTMLParser( SwDoc* pD, SwPaM& rCursor, 
SvStream& rIn,
 m_nContextStAttrMin( 0 ),
 m_nSelectEntryCnt( 0 ),
 m_nOpenParaToken( HtmlTokenId::NONE ),
-m_eJumpTo( JUMPTO_NONE ),
+m_eJumpTo( JumpToMarks::NONE ),
 #ifdef DBG_UTIL
 m_nContinue( 0 ),
 #endif
@@ -382,7 +382,7 @@ SwHTMLParser::SwHTMLParser( SwDoc* pD, SwPaM& rCursor, 
SvStream& rIn,
 m_sJmpMark = pMed->GetURLObject().GetMark();

[Libreoffice-commits] core.git: compilerplugins/clang sw/source

2018-11-07 Thread Libreoffice Gerrit user
 compilerplugins/clang/readability-redundant-pp.cxx |  129 +
 sw/source/core/doc/dbgoutsw.cxx|2 
 2 files changed, 129 insertions(+), 2 deletions(-)

New commits:
commit 13c247b7fee91b0ffb256e85bcd0cf416b3cd83e
Author: Noel Grandin 
AuthorDate: Wed Nov 7 08:58:45 2018 +0200
Commit: Noel Grandin 
CommitDate: Wed Nov 7 10:49:22 2018 +0100

new loplugin readability-redundant-pp

code originally from vmiklos, copied from dev-tools repo

Change-Id: Iadc2388fec888dde38cb4d59c78691dc1ea94c09
Reviewed-on: https://gerrit.libreoffice.org/62983
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/compilerplugins/clang/readability-redundant-pp.cxx 
b/compilerplugins/clang/readability-redundant-pp.cxx
new file mode 100644
index ..ed7fed1082c9
--- /dev/null
+++ b/compilerplugins/clang/readability-redundant-pp.cxx
@@ -0,0 +1,129 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * Based on LLVM/Clang.
+ *
+ * This file is distributed under the University of Illinois Open Source
+ * License. See LICENSE.TXT for details.
+ *
+ */
+
+#include 
+#include 
+
+#include "plugin.hxx"
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+/// Finds preprocessor usage which is redundant (only #ifndef for now).
+
+namespace loplugin
+{
+struct Entry
+{
+clang::SourceLocation m_aLoc;
+std::string m_aMacroName;
+};
+
+class RedundantPreprocessor : public clang::PPCallbacks, public Plugin
+{
+public:
+explicit RedundantPreprocessor(const InstantiationData& data);
+virtual void run() override;
+void Ifndef(clang::SourceLocation aLoc, const clang::Token& rMacroNameTok,
+const clang::MacroDefinition& rMacroDefinition) override;
+void Ifdef(clang::SourceLocation aLoc, const clang::Token& rMacroNameTok,
+   const clang::MacroDefinition& rMacroDefinition) override;
+void Endif(clang::SourceLocation aLoc, clang::SourceLocation aIfLoc) 
override;
+
+private:
+clang::Preprocessor& m_rPP;
+std::vector m_aDefStack;
+std::vector m_aNotDefStack;
+};
+
+RedundantPreprocessor::RedundantPreprocessor(const InstantiationData& data)
+: Plugin(data)
+, m_rPP(compiler.getPreprocessor())
+{
+
compiler.getPreprocessor().addPPCallbacks(std::unique_ptr(this));
+}
+
+void RedundantPreprocessor::run()
+{
+// nothing, only check preprocessor usage
+}
+
+void RedundantPreprocessor::Ifdef(clang::SourceLocation aLoc, const 
clang::Token& rMacroNameTok,
+  const clang::MacroDefinition& 
/*rMacroDefinition*/)
+{
+if (ignoreLocation(aLoc))
+return;
+
+if (m_rPP.getSourceManager().isInMainFile(aLoc))
+{
+std::string aMacroName = m_rPP.getSpelling(rMacroNameTok);
+for (const auto& rEntry : m_aDefStack)
+{
+if (rEntry.m_aMacroName == aMacroName)
+{
+report(DiagnosticsEngine::Warning, "nested ifdef", aLoc);
+report(DiagnosticsEngine::Note, "previous ifdef", 
rEntry.m_aLoc);
+}
+}
+}
+
+Entry aEntry;
+aEntry.m_aLoc = aLoc;
+aEntry.m_aMacroName = m_rPP.getSpelling(rMacroNameTok);
+m_aDefStack.push_back(aEntry);
+}
+
+void RedundantPreprocessor::Ifndef(clang::SourceLocation aLoc, const 
clang::Token& rMacroNameTok,
+   const clang::MacroDefinition& 
/*rMacroDefinition*/)
+{
+if (ignoreLocation(aLoc))
+return;
+
+if (m_rPP.getSourceManager().isInMainFile(aLoc))
+{
+std::string aMacroName = m_rPP.getSpelling(rMacroNameTok);
+for (const auto& rEntry : m_aNotDefStack)
+{
+if (rEntry.m_aMacroName == aMacroName)
+{
+report(DiagnosticsEngine::Warning, "nested ifndef", aLoc);
+report(DiagnosticsEngine::Note, "previous ifndef", 
rEntry.m_aLoc);
+}
+}
+}
+
+Entry aEntry;
+aEntry.m_aLoc = aLoc;
+aEntry.m_aMacroName = m_rPP.getSpelling(rMacroNameTok);
+m_aNotDefStack.push_back(aEntry);
+}
+
+void RedundantPreprocessor::Endif(clang::SourceLocation /*aLoc*/, 
clang::SourceLocation aIfLoc)
+{
+if (!m_aDefStack.empty())
+{
+if (aIfLoc == m_aDefStack.back().m_aLoc)
+m_aDefStack.pop_back();
+}
+if (!m_aNotDefStack.empty())
+{
+if (aIfLoc == m_aNotDefStack.back().m_aLoc)
+m_aNotDefStack.pop_back();
+}
+}
+
+static Plugin::Registration X("redundantpreprocessor");
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/doc/dbgoutsw.cxx b/sw/source/core/doc/dbgoutsw.cxx
index 9ffbc68866a0..9bd9ab22ef08 100644
--- a/sw/source/core/doc/dbgoutsw.cxx
+++ b/sw/source/core/doc/dbgoutsw.cxx
@@ -513,11 +513,9 @@ static OUString lcl_dbg_out(const SwNode & rNode)
 aTmpStr += 

[Libreoffice-commits] core.git: compilerplugins/clang sw/source

2018-08-20 Thread Libreoffice Gerrit user
 compilerplugins/clang/singlevalfields.results |2 +-
 sw/source/core/inc/UndoSort.hxx   |4 ++--
 sw/source/core/undo/unsort.cxx|2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

New commits:
commit b2f52f4372e65b9af0e6fda588ca8b49e370ec0c
Author: Johnny_M 
AuthorDate: Sat Aug 18 11:44:18 2018 +0200
Commit: Michael Stahl 
CommitDate: Sun Aug 19 18:30:44 2018 +0200

Translate German variable names

Change-Id: I6b5fb91cbf32ce082fb77989e1b9ac5e8ecfe438
Reviewed-on: https://gerrit.libreoffice.org/59283
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/compilerplugins/clang/singlevalfields.results 
b/compilerplugins/clang/singlevalfields.results
index 34b3d39416e8..6ec49ca86374 100644
--- a/compilerplugins/clang/singlevalfields.results
+++ b/compilerplugins/clang/singlevalfields.results
@@ -116,7 +116,7 @@ sw/source/core/inc/frmtool.hxx:260
 SwBorderAttrs m_bBorderDist
 1
 sw/source/core/inc/UndoSort.hxx:38
-SwSortUndoElement::(anonymous union)::(anonymous) nKenn
+SwSortUndoElement::(anonymous union)::(anonymous) nID
 4294967295
 sw/source/filter/html/htmlcss1.cxx:77
 SwCSS1ItemIds nFormatBreak
diff --git a/sw/source/core/inc/UndoSort.hxx b/sw/source/core/inc/UndoSort.hxx
index 293d6a7ae0ae..167aaa4ef625 100644
--- a/sw/source/core/inc/UndoSort.hxx
+++ b/sw/source/core/inc/UndoSort.hxx
@@ -35,7 +35,7 @@ struct SwSortUndoElement
 {
 union {
 struct {
-sal_uLong nKenn;
+sal_uLong nID;
 sal_uLong nSource, nTarget;
 } TXT;
 struct {
@@ -52,7 +52,7 @@ struct SwSortUndoElement
 {
 SORT_TXT_TBL.TXT.nSource = nS;
 SORT_TXT_TBL.TXT.nTarget = nT;
-SORT_TXT_TBL.TXT.nKenn   = 0x;
+SORT_TXT_TBL.TXT.nID   = 0x;
 }
 ~SwSortUndoElement();
 };
diff --git a/sw/source/core/undo/unsort.cxx b/sw/source/core/undo/unsort.cxx
index e70ad166311f..2b2bc5b407f8 100644
--- a/sw/source/core/undo/unsort.cxx
+++ b/sw/source/core/undo/unsort.cxx
@@ -35,7 +35,7 @@
 SwSortUndoElement::~SwSortUndoElement()
 {
 // are there string pointers saved?
-if( 0x != SORT_TXT_TBL.TXT.nKenn ) // Kenn(ung) = identifier
+if( 0x != SORT_TXT_TBL.TXT.nID )
 {
 delete SORT_TXT_TBL.TBL.pSource;
 delete SORT_TXT_TBL.TBL.pTarget;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: compilerplugins/clang sw/source

2018-07-20 Thread Libreoffice Gerrit user
 compilerplugins/clang/useuniqueptr.cxx |   13 +++
 sw/source/filter/html/htmltab.cxx  |   36 +++--
 2 files changed, 29 insertions(+), 20 deletions(-)

New commits:
commit a98d071d32ad15f928e262cdb721fd64032d46a2
Author: Noel Grandin 
AuthorDate: Thu Jul 19 13:08:41 2018 +0200
Commit: Noel Grandin 
CommitDate: Fri Jul 20 15:24:27 2018 +0200

loplugin:useuniqueptr in HTMLTable

Change-Id: I46ece073659444e802bf480996a5797c9f1ec9e8
Reviewed-on: https://gerrit.libreoffice.org/57754
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/compilerplugins/clang/useuniqueptr.cxx 
b/compilerplugins/clang/useuniqueptr.cxx
index 88bbec4a9d59..4d5b7fc0733a 100644
--- a/compilerplugins/clang/useuniqueptr.cxx
+++ b/compilerplugins/clang/useuniqueptr.cxx
@@ -92,7 +92,18 @@ public:
 if (fn == SRCDIR "/comphelper/source/property/MasterPropertySet.cxx"
 || fn == SRCDIR 
"/comphelper/source/property/MasterPropertySetInfo.cxx")
 return;
-
+// SwTableLine::m_aBoxes
+if (fn == SRCDIR "/sw/source/core/table/swtable.cxx")
+return;
+// SwHTMLParser::m_pFormImpl
+if (fn == SRCDIR "/sw/source/filter/html/htmlform.cxx")
+return;
+// SwHTMLParser::m_pPendStack, pNext
+if (fn == SRCDIR "/sw/source/filter/html/htmltab.cxx")
+return;
+// SaveLine::pBox, pNext
+if (fn == SRCDIR "/sw/source/core/undo/untbl.cxx")
+return;
 
 TraverseDecl(compiler.getASTContext().getTranslationUnitDecl());
 }
diff --git a/sw/source/filter/html/htmltab.cxx 
b/sw/source/filter/html/htmltab.cxx
index 9f4816e5d1ff..910a98b524cd 100644
--- a/sw/source/filter/html/htmltab.cxx
+++ b/sw/source/filter/html/htmltab.cxx
@@ -376,8 +376,8 @@ class HTMLTable
 OUString m_aClass;
 OUString m_aDir;
 
-SdrObjects *m_pResizeDrawObjects;// SDR objects
-std::vector *m_pDrawObjectPrcWidths;   // column of draw 
object and its rel. width
+std::unique_ptr m_pResizeDrawObjects;// SDR objects
+std::unique_ptr> m_pDrawObjectPrcWidths;   // 
column of draw object and its rel. width
 
 HTMLTableRows m_aRows; ///< table rows
 HTMLTableColumns m_aColumns;   ///< table columns
@@ -440,7 +440,7 @@ private:
 SwHTMLParser *m_pParser;  // the current parser
 std::unique_ptr m_xParentContents;
 
-HTMLTableContext *m_pContext;// the context of the table
+std::unique_ptr m_pContext;// the context of the 
table
 
 std::shared_ptr m_xLayoutInfo;
 
@@ -597,11 +597,11 @@ public:
 
 bool HasToFly() const { return m_bHasToFly; }
 
-void SetTable( const SwStartNode *pStNd, HTMLTableContext *pCntxt,
+void SetTable( const SwStartNode *pStNd, std::unique_ptr 
pCntxt,
sal_uInt16 nLeft, sal_uInt16 nRight,
const SwTable *pSwTab=nullptr, bool bFrcFrame=false );
 
-HTMLTableContext *GetContext() const { return m_pContext; }
+HTMLTableContext *GetContext() const { return m_pContext.get(); }
 
 const std::shared_ptr& CreateLayoutInfo();
 
@@ -905,9 +905,6 @@ inline SwFrameFormat *HTMLTableColumn::GetFrameFormat( bool 
bBorderLine,
 
 void HTMLTable::InitCtor(const HTMLTableOptions& rOptions)
 {
-m_pResizeDrawObjects = nullptr;
-m_pDrawObjectPrcWidths = nullptr;
-
 m_nRows = 0;
 m_nCurrentRow = 0; m_nCurrentColumn = 0;
 
@@ -1059,10 +1056,10 @@ HTMLTable::~HTMLTable()
 {
 m_pParser->DeregisterHTMLTable(this);
 
-delete m_pResizeDrawObjects;
-delete m_pDrawObjectPrcWidths;
+m_pResizeDrawObjects.reset();
+m_pDrawObjectPrcWidths.reset();
 
-delete m_pContext;
+m_pContext.reset();
 
 // pLayoutInfo has either already been deleted or is now owned by SwTable
 }
@@ -2435,13 +2432,13 @@ void HTMLTable::MakeTable( SwTableBox *pBox, sal_uInt16 
nAbsAvail,
 
 }
 
-void HTMLTable::SetTable( const SwStartNode *pStNd, HTMLTableContext *pCntxt,
+void HTMLTable::SetTable( const SwStartNode *pStNd, 
std::unique_ptr pCntxt,
   sal_uInt16 nLeft, sal_uInt16 nRight,
   const SwTable *pSwTab, bool bFrcFrame )
 {
 m_pPrevStartNode = pStNd;
 m_pSwTable = pSwTab;
-m_pContext = pCntxt;
+m_pContext = std::move(pCntxt);
 
 m_nLeftMargin = nLeft;
 m_nRightMargin = nRight;
@@ -2452,11 +2449,11 @@ void HTMLTable::SetTable( const SwStartNode *pStNd, 
HTMLTableContext *pCntxt,
 void HTMLTable::RegisterDrawObject( SdrObject *pObj, sal_uInt8 nPrcWidth )
 {
 if( !m_pResizeDrawObjects )
-m_pResizeDrawObjects = new SdrObjects;
+m_pResizeDrawObjects.reset(new SdrObjects);
 m_pResizeDrawObjects->push_back( pObj );
 
 if( !m_pDrawObjectPrcWidths )
-m_pDrawObjectPrcWidths = new std::vector;
+m_pDrawObjectPrcWidths.reset(new std::vector);
 m_pDrawObjectPrcWidths->push_back( m_nCurrentRow );
 

[Libreoffice-commits] core.git: compilerplugins/clang sw/source

2018-07-19 Thread Libreoffice Gerrit user
 compilerplugins/clang/useuniqueptr.cxx |4 
 sw/source/core/inc/UndoTable.hxx   |7 +++
 sw/source/core/undo/untbl.cxx  |   18 --
 3 files changed, 15 insertions(+), 14 deletions(-)

New commits:
commit 8a939de0e1bb62843f8801f526dbdb47125bba64
Author: Noel Grandin 
AuthorDate: Wed Jul 18 11:35:46 2018 +0200
Commit: Noel Grandin 
CommitDate: Thu Jul 19 08:13:50 2018 +0200

loplugin:useuniqueptr in SwUndoTableMerge

Change-Id: I0c528c2b12d219f37a2c2fdf2211fce3c51ad9e4
Reviewed-on: https://gerrit.libreoffice.org/57688
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/compilerplugins/clang/useuniqueptr.cxx 
b/compilerplugins/clang/useuniqueptr.cxx
index df087bfeec11..3f563699e1f6 100644
--- a/compilerplugins/clang/useuniqueptr.cxx
+++ b/compilerplugins/clang/useuniqueptr.cxx
@@ -85,6 +85,10 @@ public:
 // ScTabView::pDrawActual and pDrawOld
 if (fn == SRCDIR "/sc/source/ui/view/tabview5.cxx")
 return;
+// SwHTMLParser::m_pPendStack
+if (fn == SRCDIR "/sw/source/filter/html/htmlcss1.cxx")
+return;
+
 
 TraverseDecl(compiler.getASTContext().getTranslationUnitDecl());
 }
diff --git a/sw/source/core/inc/UndoTable.hxx b/sw/source/core/inc/UndoTable.hxx
index c5eecc28793a..15edd3a1c01e 100644
--- a/sw/source/core/inc/UndoTable.hxx
+++ b/sw/source/core/inc/UndoTable.hxx
@@ -221,16 +221,15 @@ public:
 };
 
 class SwUndoMove;
-using SwUndoMoves = std::vector>;
 
 class SwUndoTableMerge : public SwUndo, private SwUndRng
 {
 sal_uLong nTableNode;
-SaveTable* pSaveTable;
+std::unique_ptr pSaveTable;
 std::set m_Boxes;
 std::vector aNewSttNds;
-SwUndoMoves* m_pMoves;
-SwHistory* pHistory;
+std::vector> m_vMoves;
+std::unique_ptr pHistory;
 
 public:
 SwUndoTableMerge( const SwPaM& rTableSel );
diff --git a/sw/source/core/undo/untbl.cxx b/sw/source/core/undo/untbl.cxx
index c2d7e90b9eeb..7ea6694848a4 100644
--- a/sw/source/core/undo/untbl.cxx
+++ b/sw/source/core/undo/untbl.cxx
@@ -1914,20 +1914,18 @@ void SwUndoTableNdsChg::RedoImpl(::sw::UndoRedoContext 
& rContext)
 
 SwUndoTableMerge::SwUndoTableMerge( const SwPaM& rTableSel )
 : SwUndo( SwUndoId::TABLE_MERGE, rTableSel.GetDoc() ), SwUndRng( rTableSel 
)
-, m_pMoves(new SwUndoMoves)
-, pHistory(nullptr)
 {
 const SwTableNode* pTableNd = rTableSel.GetNode().FindTableNode();
 OSL_ENSURE( pTableNd, "Where is the TableNode?" );
-pSaveTable = new SaveTable( pTableNd->GetTable() );
+pSaveTable.reset( new SaveTable( pTableNd->GetTable() ) );
 nTableNode = pTableNd->GetIndex();
 }
 
 SwUndoTableMerge::~SwUndoTableMerge()
 {
-delete pSaveTable;
-delete m_pMoves;
-delete pHistory;
+pSaveTable.reset();
+m_vMoves.clear();
+pHistory.reset();
 }
 
 void SwUndoTableMerge::UndoImpl(::sw::UndoRedoContext & rContext)
@@ -1990,11 +1988,11 @@ CHECKTABLE(pTableNd->GetTable())
 *pBox->GetSttNd()->EndOfSectionNode() ), pColl );
 
 // this was the separator -> restore moved ones
-for (size_t i = m_pMoves->size(); i; )
+for (size_t i = m_vMoves.size(); i; )
 {
 SwTextNode* pTextNd = nullptr;
 sal_Int32 nDelPos = 0;
-SwUndoMove *const pUndo = (*m_pMoves)[ --i ].get();
+SwUndoMove *const pUndo = m_vMoves[ --i ].get();
 if( !pUndo->IsMoveRange() )
 {
 pTextNd = rDoc.GetNodes()[ pUndo->GetDestSttNode() 
]->GetTextNode();
@@ -2093,7 +2091,7 @@ void SwUndoTableMerge::MoveBoxContent( SwDoc* pDoc, 
SwNodeRange& rRg, SwNodeInde
 ++aTmp2;
 pUndo->SetDestRange( aTmp2, rPos, aTmp );
 
-m_pMoves->push_back(std::move(pUndo));
+m_vMoves.push_back(std::move(pUndo));
 }
 
 void SwUndoTableMerge::SetSelBoxes( const SwSelBoxes& rBoxes )
@@ -2116,7 +2114,7 @@ void SwUndoTableMerge::SetSelBoxes( const SwSelBoxes& 
rBoxes )
 void SwUndoTableMerge::SaveCollection( const SwTableBox& rBox )
 {
 if( !pHistory )
-pHistory = new SwHistory;
+pHistory.reset(new SwHistory);
 
 SwNodeIndex aIdx( *rBox.GetSttNd(), 1 );
 SwContentNode* pCNd = aIdx.GetNode().GetContentNode();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: compilerplugins/clang sw/source

2018-07-17 Thread Libreoffice Gerrit user
 compilerplugins/clang/useuniqueptr.cxx  |3 +++
 sw/source/filter/html/htmlnumwriter.cxx |   12 
 sw/source/filter/html/wrthtml.cxx   |   10 +++---
 sw/source/filter/html/wrthtml.hxx   |9 +
 4 files changed, 23 insertions(+), 11 deletions(-)

New commits:
commit 011c6c719f77181f042c68ba92e38847e39c8ca1
Author: Noel Grandin 
AuthorDate: Mon Jul 16 14:40:20 2018 +0200
Commit: Noel Grandin 
CommitDate: Tue Jul 17 12:19:14 2018 +0200

loplugin:useuniqueptr in SwHTMLWriter

Change-Id: I4802e6502addce96bff4831598e852e4fe673af4
Reviewed-on: https://gerrit.libreoffice.org/57521
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/compilerplugins/clang/useuniqueptr.cxx 
b/compilerplugins/clang/useuniqueptr.cxx
index 1cb392f718f8..a9f60c47039f 100644
--- a/compilerplugins/clang/useuniqueptr.cxx
+++ b/compilerplugins/clang/useuniqueptr.cxx
@@ -79,6 +79,9 @@ public:
 // SwLineLayout::m_pNext
 if (fn == SRCDIR "/sw/source/core/text/porlay.cxx")
 return;
+// ODatabaseExport::m_aDestColumns
+if (fn == SRCDIR "/dbaccess/source/ui/misc/DExport.cxx")
+return;
 
 TraverseDecl(compiler.getASTContext().getTranslationUnitDecl());
 }
diff --git a/sw/source/filter/html/htmlnumwriter.cxx 
b/sw/source/filter/html/htmlnumwriter.cxx
index dc21f1cbb0f2..bd0d2dadab8b 100644
--- a/sw/source/filter/html/htmlnumwriter.cxx
+++ b/sw/source/filter/html/htmlnumwriter.cxx
@@ -56,7 +56,7 @@ void SwHTMLWriter::FillNextNumInfo()
 const SwNode* pNd = m_pDoc->GetNodes()[nPos];
 if( pNd->IsTextNode() )
 {
-m_pNextNumRuleInfo = new SwHTMLNumRuleInfo( *pNd->GetTextNode() );
+m_pNextNumRuleInfo.reset( new SwHTMLNumRuleInfo( 
*pNd->GetTextNode() ) );
 
 // Before a table we keep the old level if the same numbering is
 // continued after the table and no new numbering is started.
@@ -78,7 +78,7 @@ void SwHTMLWriter::FillNextNumInfo()
 else
 {
 // In all other case the numbering is over.
-m_pNextNumRuleInfo = new SwHTMLNumRuleInfo;
+m_pNextNumRuleInfo.reset(new SwHTMLNumRuleInfo);
 }
 }
 while( !m_pNextNumRuleInfo );
@@ -86,8 +86,12 @@ void SwHTMLWriter::FillNextNumInfo()
 
 void SwHTMLWriter::ClearNextNumInfo()
 {
-delete m_pNextNumRuleInfo;
-m_pNextNumRuleInfo = nullptr;
+m_pNextNumRuleInfo.reset();
+}
+
+void SwHTMLWriter::SetNextNumInfo( std::unique_ptr pNxt )
+{
+m_pNextNumRuleInfo = std::move(pNxt);
 }
 
 Writer& OutHTML_NumBulListStart( SwHTMLWriter& rWrt,
diff --git a/sw/source/filter/html/wrthtml.cxx 
b/sw/source/filter/html/wrthtml.cxx
index c0347613752e..b2f90146fa7c 100644
--- a/sw/source/filter/html/wrthtml.cxx
+++ b/sw/source/filter/html/wrthtml.cxx
@@ -171,6 +171,11 @@ SwHTMLWriter::~SwHTMLWriter()
 {
 }
 
+std::unique_ptr SwHTMLWriter::ReleaseNextNumInfo()
+{
+return std::move(m_pNextNumRuleInfo);
+}
+
 void SwHTMLWriter::SetupFilterOptions(SfxMedium& rMedium)
 {
 const SfxItemSet* pSet = rMedium.GetItemSet();
@@ -1519,8 +1524,7 @@ HTMLSaveData::HTMLSaveData(SwHTMLWriter& rWriter, 
sal_uLong nStt,
 if( bSaveNum )
 {
 pOldNumRuleInfo = new SwHTMLNumRuleInfo( rWrt.GetNumInfo() );
-pOldNextNumRuleInfo = rWrt.GetNextNumInfo();
-rWrt.SetNextNumInfo( nullptr );
+pOldNextNumRuleInfo = rWrt.ReleaseNextNumInfo();
 }
 else
 {
@@ -1555,7 +1559,7 @@ HTMLSaveData::~HTMLSaveData()
 {
 rWrt.GetNumInfo().Set( *pOldNumRuleInfo );
 delete pOldNumRuleInfo;
-rWrt.SetNextNumInfo( pOldNextNumRuleInfo );
+rWrt.SetNextNumInfo( std::move(pOldNextNumRuleInfo) );
 }
 else
 {
diff --git a/sw/source/filter/html/wrthtml.hxx 
b/sw/source/filter/html/wrthtml.hxx
index 1aff873f8fc8..27ae06bd7bef 100644
--- a/sw/source/filter/html/wrthtml.hxx
+++ b/sw/source/filter/html/wrthtml.hxx
@@ -259,7 +259,7 @@ class SW_DLLPUBLIC SwHTMLWriter : public Writer
 {
 SwHTMLPosFlyFrames *m_pHTMLPosFlyFrames;
 std::unique_ptr m_pNumRuleInfo;// current numbering
-SwHTMLNumRuleInfo *m_pNextNumRuleInfo;
+std::unique_ptr m_pNextNumRuleInfo;
 sal_uInt32 m_nHTMLMode;   // description of export 
configuration
 
 FieldUnit m_eCSS1Unit;
@@ -521,10 +521,11 @@ public:
 
 // Fetch current numbering information of next paragraph. They
 // don't have to exist yet!
-SwHTMLNumRuleInfo *GetNextNumInfo() { return m_pNextNumRuleInfo; }
+SwHTMLNumRuleInfo *GetNextNumInfo() { return m_pNextNumRuleInfo.get(); }
+std::unique_ptr ReleaseNextNumInfo();
 
 // Set the numbering information of next paragraph.
-void SetNextNumInfo( SwHTMLNumRuleInfo *pNxt ) { m_pNextNumRuleInfo=pNxt; }
+void SetNextNumInfo( std::unique_ptr pNxt );
 
 // Fill the numbering information of next paragraph.
 void FillNextNumInfo();
@@ -621,7 +622,7 @@ struct 

[Libreoffice-commits] core.git: compilerplugins/clang sw/source

2018-06-29 Thread Noel Grandin
 compilerplugins/clang/useuniqueptr.cxx |6 ++
 sw/source/core/fields/docufld.cxx  |2 +-
 sw/source/core/fields/textapi.cxx  |2 +-
 sw/source/core/inc/textapi.hxx |2 +-
 4 files changed, 9 insertions(+), 3 deletions(-)

New commits:
commit 35c165e46a1bc22bc4c5b51ec7b03216fa43ec64
Author: Noel Grandin 
Date:   Thu Jun 28 13:48:17 2018 +0200

loplugin:useuniqueptr in SwTextAPIObject

Change-Id: Ied235aefe2cc2ce5e88487503c17e1a54d25ac52
Reviewed-on: https://gerrit.libreoffice.org/56624
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/compilerplugins/clang/useuniqueptr.cxx 
b/compilerplugins/clang/useuniqueptr.cxx
index df6343f61578..d4262c1a33ee 100644
--- a/compilerplugins/clang/useuniqueptr.cxx
+++ b/compilerplugins/clang/useuniqueptr.cxx
@@ -62,6 +62,12 @@ public:
 // sometimes it owns, sometimes it doesn't
 if (fn == SRCDIR "/editeng/source/misc/svxacorr.cxx")
 return;
+// SwDoc::m_PageDescs has weird handling
+if (fn == SRCDIR "/sw/source/core/doc/docnew.cxx")
+return;
+// SwRedlineData::pNext and pExtraData have complex handling
+if (fn == SRCDIR "/sw/source/core/doc/docredln.cxx")
+return;
 
 TraverseDecl(compiler.getASTContext().getTranslationUnitDecl());
 }
diff --git a/sw/source/core/fields/docufld.cxx 
b/sw/source/core/fields/docufld.cxx
index efc433cce0c7..c89f26f4b2e0 100644
--- a/sw/source/core/fields/docufld.cxx
+++ b/sw/source/core/fields/docufld.cxx
@@ -1826,7 +1826,7 @@ void SwPostItField::SetTextObject( OutlinerParaObject* 
pText )
 
 sal_Int32 SwPostItField::GetNumberOfParagraphs() const
 {
-return (mpText) ? mpText->Count() : 1;
+return mpText ? mpText->Count() : 1;
 }
 
 bool SwPostItField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const
diff --git a/sw/source/core/fields/textapi.cxx 
b/sw/source/core/fields/textapi.cxx
index 05372f70faff..89c248eb06cb 100644
--- a/sw/source/core/fields/textapi.cxx
+++ b/sw/source/core/fields/textapi.cxx
@@ -61,7 +61,7 @@ SwTextAPIObject::SwTextAPIObject( SwTextAPIEditSource* p )
 SwTextAPIObject::~SwTextAPIObject() throw()
 {
 pSource->Dispose();
-delete pSource;
+pSource.reset();
 }
 
 struct SwTextAPIEditSource_Impl
diff --git a/sw/source/core/inc/textapi.hxx b/sw/source/core/inc/textapi.hxx
index 4b3fa15628f4..02a138fc764f 100644
--- a/sw/source/core/inc/textapi.hxx
+++ b/sw/source/core/inc/textapi.hxx
@@ -53,7 +53,7 @@ public:
 
 class SwTextAPIObject : public SvxUnoText
 {
-SwTextAPIEditSource* pSource;
+std::unique_ptr pSource;
 public:
 SwTextAPIObject( SwTextAPIEditSource* p);
 virtual ~SwTextAPIObject() throw() override;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: compilerplugins/clang sw/source

2017-11-24 Thread Stephan Bergmann
 compilerplugins/clang/commaoperator.cxx  |8 
 compilerplugins/clang/test/commaoperator.cxx |1 +
 compilerplugins/clang/unnecessaryparen.cxx   |8 
 sw/source/filter/html/htmltab.cxx|4 ++--
 4 files changed, 11 insertions(+), 10 deletions(-)

New commits:
commit 832584eae514ea9cd4b3b42f1a2e9d69a17c5160
Author: Stephan Bergmann 
Date:   Fri Nov 24 11:24:50 2017 +0100

Clean up loplugin:unnecessaryparen blacklist

* rsc/source/parser/rscyacc.cxx no longer exists

* writerfilter/source/rtftok/rtftokenizer.cxx appears to be just fine 
nowadays?

* sw/source/filter/html/htmltab.cxx used redundant parentheses around a 
comma
  operator in a while condition, and I see no reason not to remove them (the
  result requires a---reasonable---tweak to loplugin:commaoperator, though)

Change-Id: I451132c700b0ae5a43b03d704156484df897ad5c
Reviewed-on: https://gerrit.libreoffice.org/45213
Tested-by: Jenkins 
Reviewed-by: Stephan Bergmann 

diff --git a/compilerplugins/clang/commaoperator.cxx 
b/compilerplugins/clang/commaoperator.cxx
index 4e8ea6153e12..0693fc83a07b 100644
--- a/compilerplugins/clang/commaoperator.cxx
+++ b/compilerplugins/clang/commaoperator.cxx
@@ -50,6 +50,14 @@ public:
 return ret;
 }
 
+bool TraverseWhileStmt(WhileStmt * stmt) {
+auto const saved1 = ignore1_;
+ignore1_ = lookThroughExprWithCleanups(stmt->getCond());
+auto const ret = RecursiveASTVisitor::TraverseWhileStmt(stmt);
+ignore1_ = saved1;
+return ret;
+}
+
 bool TraverseParenExpr(ParenExpr * expr) {
 auto const saved1 = ignore1_;
 ignore1_ = expr->getSubExpr();
diff --git a/compilerplugins/clang/test/commaoperator.cxx 
b/compilerplugins/clang/test/commaoperator.cxx
index 199dcf41c243..6abe963ae7a9 100644
--- a/compilerplugins/clang/test/commaoperator.cxx
+++ b/compilerplugins/clang/test/commaoperator.cxx
@@ -22,6 +22,7 @@ int main() {
 S s;
 (s = S(), s = S(), s = S());
 for (s = S(), f(); f(); s = S(), f()) {}
+while (s = S(), f()) {}
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */
diff --git a/compilerplugins/clang/unnecessaryparen.cxx 
b/compilerplugins/clang/unnecessaryparen.cxx
index a7d3d26e6591..3a97c0d39456 100644
--- a/compilerplugins/clang/unnecessaryparen.cxx
+++ b/compilerplugins/clang/unnecessaryparen.cxx
@@ -67,14 +67,6 @@ public:
  return;
 if (loplugin::isSamePathname(fn, WORKDIR 
"/YaccTarget/idlc/source/parser.cxx"))
  return;
-if (loplugin::isSamePathname(fn, WORKDIR 
"/YaccTarget/rsc/source/parser/rscyacc.cxx"))
- return;
-
-// TODO yuck, comma operator at work
-if (loplugin::isSamePathname(fn, SRCDIR 
"/writerfilter/source/rtftok/rtftokenizer.cxx"))
- return;
-if (loplugin::isSamePathname(fn, SRCDIR 
"/sw/source/filter/html/htmltab.cxx"))
- return;
 
 TraverseDecl(compiler.getASTContext().getTranslationUnitDecl());
 }
diff --git a/sw/source/filter/html/htmltab.cxx 
b/sw/source/filter/html/htmltab.cxx
index 2a5f87f16d67..b6e1d5db18bf 100644
--- a/sw/source/filter/html/htmltab.cxx
+++ b/sw/source/filter/html/htmltab.cxx
@@ -1142,7 +1142,7 @@ void HTMLTable::FixRowSpan( sal_uInt16 nRow, sal_uInt16 
nCol,
 {
 sal_uInt16 nRowSpan=1;
 HTMLTableCell *pCell;
-while( ( pCell=GetCell(nRow,nCol), pCell->GetContents()==pCnts ) )
+while( pCell=GetCell(nRow,nCol), pCell->GetContents()==pCnts )
 {
 pCell->SetRowSpan( nRowSpan );
 if( m_pLayoutInfo )
@@ -1404,7 +1404,7 @@ void HTMLTable::FixFrameFormat( SwTableBox *pBox,
   : (nInnerFrameWidth / 2) 
);
 // We only set the item if there's a border or a border 
distance
 // If the latter is missing, there's gonna be a border and 
we'll have to set the distance
-aBoxItem.SetAllDistances((nBDist) ? nBDist : MIN_BORDER_DIST);
+aBoxItem.SetAllDistances(nBDist ? nBDist : MIN_BORDER_DIST);
 pFrameFormat->SetFormatAttr( aBoxItem );
 }
 else
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: compilerplugins/clang sw/source ucb/source vcl/inc xmloff/source

2017-11-24 Thread Noel Grandin
 compilerplugins/clang/countusersofdefaultparams.py |6 --
 sw/source/core/doc/doccomp.cxx |2 +-
 sw/source/core/doc/docfmt.cxx  |2 +-
 sw/source/core/edit/edfcol.cxx |4 ++--
 sw/source/core/inc/UndoAttribute.hxx   |4 ++--
 sw/source/core/inc/flowfrm.hxx |2 +-
 sw/source/core/inc/txtfrm.hxx  |4 ++--
 sw/source/core/inc/unobookmark.hxx |2 +-
 sw/source/core/inc/viewimp.hxx |4 ++--
 sw/source/core/text/blink.cxx  |2 +-
 sw/source/core/text/porlay.cxx |6 +++---
 sw/source/core/text/porlay.hxx |   10 +-
 sw/source/core/text/portab.hxx |2 +-
 sw/source/core/text/txtpaint.hxx   |8 
 sw/source/filter/html/htmltabw.cxx |6 +++---
 sw/source/filter/html/swhtml.hxx   |4 ++--
 sw/source/ui/misc/linenum.cxx  |2 +-
 sw/source/ui/table/convert.cxx |6 +++---
 sw/source/ui/table/instable.cxx|6 +++---
 sw/source/ui/table/tabledlg.cxx|4 ++--
 sw/source/uibase/inc/convert.hxx   |4 ++--
 sw/source/uibase/inc/frmdlg.hxx|2 +-
 sw/source/uibase/inc/instable.hxx  |4 ++--
 sw/source/uibase/inc/linenum.hxx   |2 +-
 sw/source/uibase/inc/swuicnttab.hxx|2 +-
 sw/source/uibase/inc/uiitems.hxx   |4 ++--
 sw/source/uibase/table/tablepg.hxx |2 +-
 ucb/source/ucp/file/filtask.cxx|2 +-
 ucb/source/ucp/file/filtask.hxx|3 +--
 vcl/inc/implimagetree.hxx  |2 +-
 vcl/inc/unx/freetype_glyphcache.hxx|2 +-
 xmloff/source/forms/formattributes.hxx |2 +-
 xmloff/source/style/xmlbahdl.hxx   |3 ++-
 33 files changed, 61 insertions(+), 59 deletions(-)

New commits:
commit 665d085511a64959ceafd869e6331877ed711c80
Author: Noel Grandin 
Date:   Fri Nov 24 10:57:55 2017 +0200

loplugin:countusersofdefaultparams in sw (1)

Change-Id: I0d14f9c375f93079aef21ca4f1132adc4e1fe06c
Reviewed-on: https://gerrit.libreoffice.org/45207
Tested-by: Jenkins 
Reviewed-by: Noel Grandin 

diff --git a/compilerplugins/clang/countusersofdefaultparams.py 
b/compilerplugins/clang/countusersofdefaultparams.py
index a790abfcbd76..c36f91b36dbb 100755
--- a/compilerplugins/clang/countusersofdefaultparams.py
+++ b/compilerplugins/clang/countusersofdefaultparams.py
@@ -9,9 +9,11 @@ callDict = dict()
 
 # clang does not always use exactly the same numbers in the type-parameter 
vars it generates
 # so I need to substitute them to ensure we can match correctly.
-normalizeTypeParamsRegex = re.compile(r"type-parameter-\d+-\d+")
+normalizeTypeParamsRegex1 = re.compile(r"type-parameter-\d+-\d+")
+normalizeTypeParamsRegex2 = re.compile(r"typename enable_if<.*")
 def normalizeTypeParams( line ):
-return normalizeTypeParamsRegex.sub("type-parameter-?-?", line)
+line = normalizeTypeParamsRegex1.sub("type-parameter-?-?", line)
+return normalizeTypeParamsRegex2.sub("type-parameter-?-?", line)
 
 with io.open("loplugin.countusersofdefaultparams.log", "rb", 
buffering=1024*1024) as txt:
 for line in txt:
diff --git a/sw/source/core/doc/doccomp.cxx b/sw/source/core/doc/doccomp.cxx
index 0595503430d9..158e5dd30ac6 100644
--- a/sw/source/core/doc/doccomp.cxx
+++ b/sw/source/core/doc/doccomp.cxx
@@ -334,7 +334,7 @@ protected:
 }
 
 int FindLCS( int *pLcs1, int *pLcs2, int nStt1,
-int nEnd1 = 0, int nStt2 = 0, int nEnd2 = 0 );
+ int nEnd1, int nStt2, int nEnd2 );
 
 public:
 static int IgnoreIsolatedPieces( int *pLcs1, int *pLcs2, int nLen1, int 
nLen2,
diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx
index 2f76561a785e..191d5bcb28bb 100644
--- a/sw/source/core/doc/docfmt.cxx
+++ b/sw/source/core/doc/docfmt.cxx
@@ -1871,7 +1871,7 @@ void SwDoc::ChgFormat(SwFormat & rFormat, const 
SfxItemSet & rSet)
 }
 }
 
-SwUndo * pUndo = new SwUndoFormatAttr(aOldSet, rFormat);
+SwUndo * pUndo = new SwUndoFormatAttr(aOldSet, rFormat, 
/*bSaveDrawPt*/true);
 
 GetIDocumentUndoRedo().AppendUndo(pUndo);
 }
diff --git a/sw/source/core/edit/edfcol.cxx b/sw/source/core/edit/edfcol.cxx
index 5b151e15d081..61a4c15cc939 100644
--- a/sw/source/core/edit/edfcol.cxx
+++ b/sw/source/core/edit/edfcol.cxx
@@ -301,7 +301,7 @@ bool lcl_IsParagraphSignatureField(const 
uno::Reference& xModel,
 uno::Reference lcl_findFieldByRDF(const 
uno::Reference& xModel,

[Libreoffice-commits] core.git: compilerplugins/clang sw/source

2017-08-07 Thread Noel Grandin
 compilerplugins/clang/constparams.cxx |   22 +-
 sw/source/ui/dbui/addresslistdialog.cxx   |2 +-
 sw/source/ui/dbui/createaddresslistdialog.cxx |2 +-
 sw/source/ui/dbui/createaddresslistdialog.hxx |2 +-
 sw/source/ui/dbui/dbtablepreviewdialog.cxx|2 +-
 sw/source/ui/dbui/dbtablepreviewdialog.hxx|2 +-
 sw/source/ui/dbui/mailmergewizard.cxx |2 +-
 sw/source/ui/dbui/mmgreetingspage.cxx |8 
 sw/source/ui/dbui/mmlayoutpage.cxx|6 +++---
 sw/source/ui/dbui/mmlayoutpage.hxx|6 +++---
 sw/source/ui/dbui/mmoutputtypepage.cxx|6 +++---
 sw/source/ui/dbui/mmresultdialogs.cxx |2 +-
 sw/source/ui/frmdlg/frmpage.cxx   |6 +++---
 sw/source/ui/inc/mmresultdialogs.hxx  |2 +-
 sw/source/ui/index/cntex.cxx  |   12 ++--
 sw/source/ui/index/cnttab.cxx |   12 ++--
 sw/source/ui/index/swuiidxmrk.cxx |   10 +-
 sw/source/ui/misc/glossary.cxx|2 +-
 sw/source/ui/misc/linenum.cxx |2 +-
 sw/source/ui/misc/srtdlg.cxx  |4 ++--
 sw/source/ui/misc/titlepage.cxx   |2 +-
 sw/source/ui/table/tabledlg.cxx   |2 +-
 sw/source/ui/table/tautofmt.cxx   |4 ++--
 sw/source/ui/vba/vbaborders.cxx   |8 
 sw/source/ui/vba/vbaborders.hxx   |2 +-
 sw/source/ui/vba/vbadocumentproperties.cxx|4 ++--
 sw/source/ui/vba/vbadocuments.cxx |2 +-
 sw/source/ui/vba/vbalisttemplate.cxx  |2 +-
 sw/source/ui/vba/vbalisttemplate.hxx  |2 +-
 sw/source/ui/vba/vbaoptions.cxx   |2 +-
 sw/source/ui/vba/vbaoptions.hxx   |2 +-
 sw/source/ui/vba/vbaparagraphformat.cxx   |2 +-
 sw/source/ui/vba/vbaparagraphformat.hxx   |2 +-
 sw/source/ui/vba/vbarangehelper.cxx   |2 +-
 sw/source/ui/vba/vbarangehelper.hxx   |2 +-
 sw/source/ui/vba/vbasystem.cxx|2 +-
 sw/source/ui/vba/vbasystem.hxx|2 +-
 sw/source/ui/vba/vbatablehelper.cxx   |4 ++--
 sw/source/ui/vba/vbatablehelper.hxx   |4 ++--
 sw/source/uibase/inc/frmpage.hxx  |6 +++---
 sw/source/uibase/inc/glossary.hxx |2 +-
 sw/source/uibase/inc/linenum.hxx  |2 +-
 sw/source/uibase/inc/mailmergewizard.hxx  |2 +-
 sw/source/uibase/inc/srtdlg.hxx   |2 +-
 sw/source/uibase/inc/swuicnttab.hxx   |8 
 sw/source/uibase/inc/swuiidxmrk.hxx   |   10 +-
 sw/source/uibase/table/tablepg.hxx|2 +-
 47 files changed, 101 insertions(+), 97 deletions(-)

New commits:
commit 959ace5861ca8dbb5fbec7a1954eeeb3b93ae4f3
Author: Noel Grandin 
Date:   Mon Aug 7 14:40:39 2017 +0200

loplugin:constparams in sw part10

Change-Id: I7d708c3e6157d0b8690b433d3363d2c0745b2410
Reviewed-on: https://gerrit.libreoffice.org/40832
Tested-by: Jenkins 
Reviewed-by: Noel Grandin 

diff --git a/compilerplugins/clang/constparams.cxx 
b/compilerplugins/clang/constparams.cxx
index 052e370c507d..a294e45d58c4 100644
--- a/compilerplugins/clang/constparams.cxx
+++ b/compilerplugins/clang/constparams.cxx
@@ -313,6 +313,7 @@ bool ConstParams::checkIfCanBeConst(const Stmt* stmt, const 
ParmVarDecl* parmVar
 return 
isPointerOrReferenceToConst(constructorDecl->getParamDecl(i)->getType());
 }
 }
+return false; // TODO ??
 } else if (auto operatorCallExpr = dyn_cast(parent)) {
 const CXXMethodDecl* calleeMethodDecl = 
dyn_cast_or_null(operatorCallExpr->getDirectCallee());
 if (calleeMethodDecl) {
@@ -343,6 +344,7 @@ bool ConstParams::checkIfCanBeConst(const Stmt* stmt, const 
ParmVarDecl* parmVar
 }
 }
 }
+return false; // TODO ???
 } else if (auto callExpr = dyn_cast(parent)) {
 QualType functionType = callExpr->getCallee()->getType();
 if (functionType->isFunctionPointerType()) {
@@ -382,12 +384,13 @@ bool ConstParams::checkIfCanBeConst(const Stmt* stmt, 
const ParmVarDecl* parmVar
 }
 for (unsigned i = 0; i < callExpr->getNumArgs(); ++i) {
 if (i >= calleeFunctionDecl->getNumParams()) // can happen in 
template code
-break;
+return false;
 if (callExpr->getArg(i) == stmt) {
 return 
isPointerOrReferenceToConst(calleeFunctionDecl->getParamDecl(i)->getType());
 }
 }
 }
+return false; // TODO 
 } else if (isa(parent)) {
 return false;
 } else if (isa(parent)) {
@@ -459,15 +462,16 @@ bool 

[Libreoffice-commits] core.git: compilerplugins/clang sw/source

2016-12-08 Thread Miklos Vajna
 compilerplugins/clang/test/passstuffbyref.cxx |2 +-
 sw/source/uibase/frmdlg/frmmgr.cxx|4 ++--
 sw/source/uibase/inc/frmmgr.hxx   |2 +-
 sw/source/uibase/inc/frmpage.hxx  |2 +-
 sw/source/uibase/inc/numpara.hxx  |2 +-
 5 files changed, 6 insertions(+), 6 deletions(-)

New commits:
commit dc1925e6f05a60935050d088d3b75b85ec6bb989
Author: Miklos Vajna 
Date:   Thu Dec 8 14:21:58 2016 +0100

sw: remove some inline version control in uibase

Change-Id: I7125b6f8593cac2c33916341f5649f57044ad045
Reviewed-on: https://gerrit.libreoffice.org/31761
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins 

diff --git a/compilerplugins/clang/test/passstuffbyref.cxx 
b/compilerplugins/clang/test/passstuffbyref.cxx
index d19b139..d871c5b 100644
--- a/compilerplugins/clang/test/passstuffbyref.cxx
+++ b/compilerplugins/clang/test/passstuffbyref.cxx
@@ -12,7 +12,7 @@
 struct S {
 OUString mv;
 
-// request from vmiklos: make sure we ignore cases where the passed in 
parameter is std::move'd
+// make sure we ignore cases where the passed in parameter is std::move'd
 S(OUString v)
   : mv(std::move(v)) {}
 };
diff --git a/sw/source/uibase/frmdlg/frmmgr.cxx 
b/sw/source/uibase/frmdlg/frmmgr.cxx
index 3961561..9f55d2d 100644
--- a/sw/source/uibase/frmdlg/frmmgr.cxx
+++ b/sw/source/uibase/frmdlg/frmmgr.cxx
@@ -260,7 +260,7 @@ void SwFlyFrameAttrMgr::ValidateMetrics( 
SvxSwFrameValidation& rVal,
 if (bOnlyPercentRefValue)
 return;
 
-// --> OD 2009-09-01 #mongolianlayout#
+// #mongolianlayout#
 if ( m_bIsInVertical || m_bIsInVerticalL2R )
 {
 Point aPos(aBoundRect.Pos());
@@ -458,7 +458,7 @@ void SwFlyFrameAttrMgr::ValidateMetrics( 
SvxSwFrameValidation& rVal,
 rVal.nMaxVPos = -aBoundRect.Height();
 }
 }
-// --> OD 2009-09-01 #mongolianlayout#
+// #mongolianlayout#
 if ( m_bIsInVertical || m_bIsInVerticalL2R )
 {
 //restore width/height exchange
diff --git a/sw/source/uibase/inc/frmmgr.hxx b/sw/source/uibase/inc/frmmgr.hxx
index eb4ac1e..55c5490 100644
--- a/sw/source/uibase/inc/frmmgr.hxx
+++ b/sw/source/uibase/inc/frmmgr.hxx
@@ -56,7 +56,7 @@ class SW_DLLPUBLIC SwFlyFrameAttrMgr
 boolm_bAbsPos,
 m_bNewFrame;
 boolm_bIsInVertical;
-// --> OD 2009-09-01 #mongolianlayout#
+// #mongolianlayout#
 boolm_bIsInVerticalL2R;
 
 // internal calculation for borders
diff --git a/sw/source/uibase/inc/frmpage.hxx b/sw/source/uibase/inc/frmpage.hxx
index cd49e40..6563bb3 100644
--- a/sw/source/uibase/inc/frmpage.hxx
+++ b/sw/source/uibase/inc/frmpage.hxx
@@ -99,7 +99,7 @@ class SwFramePage: public SfxTabPage
 boolm_bNew;
 boolm_bNoModifyHdl;
 boolm_bIsVerticalFrame;  //current frame is in vertical 
environment - strings are exchanged
-// --> OD 2009-08-31 #mongolianlayout#
+// #mongolianlayout#
 boolm_bIsVerticalL2R;
 boolm_bIsInRightToLeft; // current frame is in right-to-left 
environment - strings are exchanged
 boolm_bHtmlMode;
diff --git a/sw/source/uibase/inc/numpara.hxx b/sw/source/uibase/inc/numpara.hxx
index a60dba1..5f0e4f3 100644
--- a/sw/source/uibase/inc/numpara.hxx
+++ b/sw/source/uibase/inc/numpara.hxx
@@ -47,7 +47,7 @@ class SwParagraphNumTabPage : public SfxTabPage
 VclPtr m_pRestartBX;
 VclPtrm_pRestartNF;
 
-// --> OD 2008-04-14 #outlinelevel#
+// #outlinelevel#
 const OUString msOutlineNumbering;
 
 boolbModified : 1;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: compilerplugins/clang sw/source

2014-11-20 Thread Bjoern Michaelsen
 compilerplugins/clang/store/cascadingcondop.cxx |   34 +++-
 compilerplugins/clang/store/cascadingcondop.hxx |4 ++
 sw/source/core/doc/doccorr.cxx  |9 ++
 3 files changed, 39 insertions(+), 8 deletions(-)

New commits:
commit 395d6a96aaee78abc5c4316e010df1e8c05ceca7
Author: Bjoern Michaelsen bjoern.michael...@canonical.com
Date:   Wed Nov 19 17:46:01 2014 +0100

cascading conditional operators, give a hint on complexity

Change-Id: Ie9d0b07a32cc17705db735ea18f70f28d57badd4
Reviewed-on: https://gerrit.libreoffice.org/12990
Reviewed-by: Björn Michaelsen bjoern.michael...@canonical.com
Tested-by: Björn Michaelsen bjoern.michael...@canonical.com

diff --git a/compilerplugins/clang/store/cascadingcondop.cxx 
b/compilerplugins/clang/store/cascadingcondop.cxx
index f18a93b..722b981 100644
--- a/compilerplugins/clang/store/cascadingcondop.cxx
+++ b/compilerplugins/clang/store/cascadingcondop.cxx
@@ -14,8 +14,8 @@
 /*
 This is a compile check.
 
-It checks for conditional operators in conditional operators, which are
-errorprone, e.g.
+It checks for complex statements with conditional operators in conditional
+operators, which are errorprone, e.g.
  Thing foo = IsBar() ? ( IsBaz() ? b1 : b2 ) : b3;
 
 However, it finds 556 cases in sw/source alone, thus likely needs some more
@@ -24,9 +24,19 @@ a certain length in characters (but that needs the 
Context/SourceManager, which
 I havent played with yet).
 */
 
+// the value is rather arbitrary, but code above this number of stmts begins to
+// be smelly
+static const int stmtlimit = 50;
+
 namespace loplugin
 {
 
+struct WalkCounter
+{
+int  stmtcount;
+bool cascading;
+};
+
 // Ctor, nothing special, pass the argument(s).
 CascadingCondOp::CascadingCondOp( const InstantiationData data )
 : Plugin( data )
@@ -41,20 +51,30 @@ void CascadingCondOp::run()
 TraverseDecl( compiler.getASTContext().getTranslationUnitDecl());
 }
 
-void CascadingCondOp::Walk( const Stmt* stmt )
+void CascadingCondOp::Walk( const Stmt* stmt, WalkCounter c )
 {
 for(Stmt::const_child_iterator it = stmt-child_begin(); it != 
stmt-child_end(); ++it)
 {
-if ( const ConditionalOperator* condop = dyn_cast ConditionalOperator 
( *it ))
-report( DiagnosticsEngine::Warning, cascading conditional 
operator, condop-getLocStart());
-Walk(*it);
+++c.stmtcount;
+if ( dyn_cast ConditionalOperator ( *it ))
+c.cascading = true;
+Walk(*it, c);
 }
 }
 
 bool CascadingCondOp::VisitStmt( const Stmt* stmt )
 {
 if ( const ConditionalOperator* condop = dyn_cast ConditionalOperator ( 
stmt ))
-Walk(condop);
+{
+WalkCounter c = { 0, false };
+Walk(condop, c);
+if(c.cascading  c.stmtcount = stmtlimit)
+{
+std::string msg(cascading conditional operator, complexity: );
+msg.append(std::to_string(c.stmtcount));
+report( DiagnosticsEngine::Warning, msg, condop-getLocStart());
+}
+}
 return true;
 }
 
diff --git a/compilerplugins/clang/store/cascadingcondop.hxx 
b/compilerplugins/clang/store/cascadingcondop.hxx
index e648bdf..8d41177 100644
--- a/compilerplugins/clang/store/cascadingcondop.hxx
+++ b/compilerplugins/clang/store/cascadingcondop.hxx
@@ -17,6 +17,8 @@
 namespace loplugin
 {
 
+struct WalkCounter;
+
 // The class implementing the plugin action.
 class CascadingCondOp
 // Inherits from the Clang class that will allow examing the Clang AST 
tree (i.e. syntax tree).
@@ -27,7 +29,7 @@ class CascadingCondOp
 public:
 CascadingCondOp( const InstantiationData data );
 virtual void run() override;
-void Walk( const Stmt* stmt );
+void Walk( const Stmt* stmt, WalkCounter c );
 bool VisitStmt( const Stmt* stmt );
 };
 
diff --git a/sw/source/core/doc/doccorr.cxx b/sw/source/core/doc/doccorr.cxx
index 3cc38fa..981b7da 100644
--- a/sw/source/core/doc/doccorr.cxx
+++ b/sw/source/core/doc/doccorr.cxx
@@ -358,4 +358,13 @@ SwEditShell* SwDoc::GetEditShell()
 return GetEditShell();
 }
 
+//bool foo()
+//{
+//bool b1 = true ? true : false;
+//bool b2 = (true ? true : false) ? true : false;
+//bool b3 = true ? (true ? true : false) : false;
+//bool b4 = true ? true : (true ? true : false);
+//return false;
+//}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits