summaryrefslogtreecommitdiff
path: root/compilerplugins
AgeCommit message (Collapse)Author
2023-01-06Merge comphelper::OAccessibleContextHelper into ↵Stephan Bergmann
comphelper::OCommonAccessibleComponent Change-Id: I586ae8fe2842fd879ae2ae506c659d06dda16843 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145160 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-01-06writerfilter: removed remains of GAP_HALF define and its usageVasily Melenchuk
Change-Id: I8dee16f923686f557c8213d9a7870392bd5fe9bf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145090 Tested-by: Jenkins Reviewed-by: Vasily Melenchuk <vasily.melenchuk@cib.de>
2023-01-02Remove unused imports from compilerplugins/clangBogdan B
Change-Id: I923ace7bedf022d49222e71c96c7e4c20f90e6cb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142521 Tested-by: Jenkins Reviewed-by: Hossein <hossein@libreoffice.org>
2023-01-01Bump copyright year to 2023Adolfo Jayme Barrientos
Change-Id: I699112a3e554013bab75b82d1eae00098216c886 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144893 Tested-by: Jenkins Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
2022-12-22Make namespace checks look through LinkageSpecsStephan Bergmann
My clang-cl --with-visual-studio=2022preview build against VS 2022 Preview 17.5.0 Preview 2.0 had started to fail with > [build CPT] compilerplugins/clang/test/getstr.cxx > error: 'error' diagnostics expected but not seen: > File compilerplugins/clang/test/getstr.cxx Line 42: directly use object of type '{{(rtl::)?}}OString' in a call of 'operator <<', instead of calling 'getStr' first [loplugin:getstr] > File compilerplugins/clang/test/getstr.cxx Line 48: directly use object of type 'S' (aka 'rtl::OString') in a call of 'operator <<', instead of calling 'getStr' first [loplugin:getstr] > File compilerplugins/clang/test/getstr.cxx Line 49: directly use object of type 'rtl::OString' in a call of 'operator <<', instead of calling 'getStr' first [loplugin:getstr] > File compilerplugins/clang/test/getstr.cxx Line 55: directly use object of type 'rtl::OString' in a call of 'operator <<', instead of calling 'getStr' first [loplugin:getstr] > File compilerplugins/clang/test/getstr.cxx Line 57: directly use object of type '{{(rtl::)?}}OString' in a call of 'operator <<', instead of calling 'getStr' first [loplugin:getstr] > 5 errors generated. apparently because C:/Program Files/Microsoft Visual Studio/2022/Preview/VC/Tools/MSVC/14.35.32124/include/ostream now contains [...] > _EXPORT_STD extern "C++" template <class _Elem, class _Traits> > class basic_ostream : virtual public basic_ios<_Elem, _Traits> { // control insertions into a stream buffer [...] with a wrapping extern "C++", so the call to StdNamespace() in > if (!loplugin::TypeCheck(expr->getArg(0)->getType()) > .ClassOrStruct("basic_ostream") > .StdNamespace()) //TODO: check template args in compilerplugins/clang/getstr.cxx no longer matched Change-Id: Iaeb461d5aa855a8602c5c6f791407c08a1c5d309 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144735 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-12-20Revert "fix compile error in compilerplugins"Stephan Bergmann
This reverts commit 99b5e216f107259d6e402896800282948997c4fa. It should only have been necessary after <https://github.com/llvm/llvm-project/commit/205c0589f918f95d2f2c586a01bea2716d73d603> "Revert '[clang] Convert OptionalFileEntryRefDegradesToFileEntryPtr to std::optional'" dropped the #include <optional> from clang/include/clang/Lex/PPCallbacks.h, and has been obsoleted by 3d7181caf3444d086be910545047550bac618968 "Adapt to PPCallbacks::InclusionDirective change in Clang 16 trunk". Change-Id: I89238a779fdda4c3ba15de93a4e647051e5844b1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144594 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-12-20Adapt to PPCallbacks::InclusionDirective change in Clang 16 trunkNoel Grandin
Attempt to follow the unfolding debate here, it was std::optional briefly, but then that was reverted with commit 205c0589f918f95d2f2c586a01bea2716d73d603 Revert "[clang] Convert OptionalFileEntryRefDegradesToFileEntryPtr to std::optional" and then a different changed landed with commit 854c10f8d185286d941307e1033eb492e085c203 Date: Tue Dec 20 00:15:11 2022 +0100 [Clang] Prepare for llvm::Optional becoming std::optional. Change-Id: I0068960a45695014405437206d8d4565562b0af9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144575 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-12-20fix compile error in compilerpluginsNoel Grandin
home/noel/libo2/compilerplugins/clang/includeform.cxx:33:9: error: no template named 'optional' in namespace 'std'; did you mean 'Optional'? std::optional<FileEntryRef> File, after commit b5023fa9abea248831271df99df0810351bd8c21 Date: Mon Dec 19 13:16:29 2022 +0100 Adapt to clang::PPCallbacks::InclusionDirective change in Clang 16 trunk Change-Id: I7acbfeac4fd138a1f6ae89f8b4b8cf918da04e30 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144574 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-12-20new loplugin:implinheritancehelperNoel Grandin
Look for places we should be using ImplInheritanceHelper, which handles various boilerplate for us Change-Id: Icff6babf682c95b60aca86e6d6c2e2181eefc2f4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144444 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-12-19Avoid -Werror,-Wdeprecated-declarationsStephan Bergmann
...when building against recent Clang 16 trunk, > In file included from compilerplugins/clang/sharedvisitor/sharedvisitor.cxx:30: > In file included from compilerplugins/clang/cppunitassertequals.cxx:13: > compilerplugins/clang/compat.hxx:40:14: error: 'value' is deprecated: std::optional::value is throwing. Use *X instead [-Werror,-Wdeprecated-declarations] > return o.value(); > ^~~~~ > *X > compilerplugins/clang/pointerbool.cxx:118:52: note: in instantiation of function template specialization 'compat::value<llvm::APSInt>' requested here > if (compat::has_value(ret) && (compat::value(ret) == 1 || compat::value(ret) == 0)) > ^ > ~/llvm/inst/include/llvm/ADT/Optional.h:273:3: note: 'value' has been explicitly marked deprecated here > LLVM_DEPRECATED("std::optional::value is throwing. Use *X instead", "*X") > ^ > ~/llvm/inst/include/llvm/Support/Compiler.h:143:50: note: expanded from macro 'LLVM_DEPRECATED' > #define LLVM_DEPRECATED(MSG, FIX) __attribute__((deprecated(MSG, FIX))) > ^ Change-Id: I4320c279a464e52ad608df2a340f62795558a7b8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144472 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-12-19Adapt to clang::PPCallbacks::InclusionDirective change in Clang 16 trunkStephan Bergmann
<https://github.com/llvm/llvm-project/commit/8f0df9f3bbc6d7f3d5cbfd955c5ee4404c53a75d> "[clang] Convert OptionalFileEntryRefDegradesToFileEntryPtr to std::optional" Change-Id: I60bf4a770d6037edcfe0129591fd46941c8903db Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144471 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-12-16Merge sdr::table::TableDesignUser into sdr::table::SdrTableObjImplStephan Bergmann
Change-Id: Ia7841447df4a7db1b5dd9fad93cab66fbca48981 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144316 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-12-07loplugin:unusedmethodsNoel Grandin
Change-Id: I5497d5b39620ff9fde09af923d3e41dedbab3326 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143774 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-12-07loplugin:unusedfieldsNoel Grandin
Change-Id: I4c9c27e5fd8193b87ac46318671f787939f2d64e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143773 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-12-07loplugin:singlevalfieldsNoel Grandin
Change-Id: Ic7dd2cb433add02ecc72eee0c85dd7f0efe1d47b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143771 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-12-06weld InformationDialog info dialogCaolán McNamara
Change-Id: I6a3631fe06a1b46164f01d706ecefd7252509382 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143740 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-12-06Resolves: tdf#121297 weld Presentation MinimizerCaolán McNamara
Change-Id: Ifdf1746bc9f6567a1aded233a4350f6828604c9e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143678 Tested-by: Caolán McNamara <caolanm@redhat.com> Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-11-29New loplugin:crosscastStephan Bergmann
...inspired by 2fa426da15a12e2a63554247e3c1c3f8c0ec5c24 "Fix dynamic_cast after splitting OutputDevice and vcl::Window class hierarchies": "Find uses of dynamic_cast that cast between unrelated classes, which is suspicious and might indicate a bug. The heuristic used to consider two classes unrelated is that neither derives from the other (directly or indirectly) and they do not both virtually derive (directly or indirectly) from a common third class. Additionally, class definitions can be attributed with SAL_LOPLUGIN_ANNOTATE("crosscast") (from sal/types.h) to suppress false warnings about known-good cases casting from or to such a class." (quoting compilerplugins/clang/crosscast.cxx) This found two additional errors, 7a82ea5c79adee70eddf74ac53347544766a91b0 "Fix presumed typo" and fc6aa9e49973c845915754caf765ff57e5b0cd59 "fix assert", and one still-open case that looks like an error, see the TODO comment in sw/source/core/unocore/unodraw.cxx. In addition to that it flagged another 102 uses of dynamic_cast as suspicious, which have all been addressed, at least for now, by marking certain classes as SAL_LOPLUGIN_ANNOTATE("crosscast"), see below. (Where this commit also adds that generic SAL_LOPLUGIN_ANNOTATE mechanism to include/sal/types.h.) However, some of those annotations might benefit from further inspection and clean up similar to recent 8858962ec09478c203d43feb58f550bb36af37bb "Introduce ParagraphProeprtiesPropertyMap", 8467aa93e2038b3030e1add94e0ca6cc4ad44032 "Replace a dynamic_cast with UNO_QUERY", a534361141d69096d896e6e0552d19f3138eeeb3 "Fold OldBasicPassword into basic::SfxScriptLibraryContainer", and 589e03fb4c3b05bf3742c0cb8b366322ffdf1fa9 "[PATCH] Replace some dynamic_cast with UNO_QUERY". * canvas/source/cairo/cairo_repainttarget.hxx RepaintTarget: > canvas/source/cairo/cairo_cachedbitmap.cxx:62:34: error: suspicious dynamic cross cast from 'com::sun::star::rendering::XCanvas *' to 'RepaintTarget *' [loplugin:crosscast] > RepaintTarget* pTarget = dynamic_cast< RepaintTarget* >(rTargetCanvas.get()); * canvas/source/cairo/cairo_surfaceprovider.hxx SurfaceProvider: > canvas/source/cairo/cairo_canvashelper.cxx:301:45: error: suspicious dynamic cross cast from 'com::sun::star::rendering::XBitmap *' to 'SurfaceProvider *' [loplugin:crosscast] > SurfaceProvider* pSurfaceProvider = dynamic_cast<SurfaceProvider*>( xBitmap.get() ); * canvas/source/vcl/repainttarget.hxx RepaintTarget: > canvas/source/vcl/cachedbitmap.cxx:73:34: error: suspicious dynamic cross cast from 'com::sun::star::rendering::XCanvas *' to 'RepaintTarget *' [loplugin:crosscast] > RepaintTarget* pTarget = dynamic_cast< RepaintTarget* >(rTargetCanvas.get()); * chart2/inc/ChartModel.hxx ChartModel: > chart2/source/controller/dialogs/dlg_ChartType_UNO.cxx:82:31: error: suspicious dynamic cross cast from 'com::sun::star::awt::XWindow *' to 'ChartModel *' [loplugin:crosscast] > ChartModel* pChartModel = dynamic_cast<ChartModel*>(rParent.get()); * chart2/source/controller/inc/TabPageNotifiable.hxx TabPageNotifiable: > chart2/source/controller/dialogs/tp_RangeChooser.cxx:70:28: error: suspicious dynamic cross cast from 'weld::DialogController *' to 'TabPageNotifiable *' [loplugin:crosscast] > , m_pTabPageNotifiable(dynamic_cast<TabPageNotifiable*>(pController)) > chart2/source/controller/dialogs/tp_DataSource.cxx:171:28: error: suspicious dynamic cross cast from 'weld::DialogController *' to 'TabPageNotifiable *' [loplugin:crosscast] > , m_pTabPageNotifiable(dynamic_cast<TabPageNotifiable*>(pController)) * include/drawinglayer/primitive2d/svggradientprimitive2d.hxx SvgGradientHelper: > drawinglayer/source/primitive2d/svggradientprimitive2d.cxx:582:59: error: suspicious dynamic cross cast from 'const BasePrimitive2D *' to 'const SvgGradientHelper *' [loplugin:crosscast] > const SvgGradientHelper* pSvgGradientHelper = dynamic_cast< const SvgGradientHelper* >(&rPrimitive); > drawinglayer/source/primitive2d/svggradientprimitive2d.cxx:819:59: error: suspicious dynamic cross cast from 'const BasePrimitive2D *' to 'const SvgGradientHelper *' [loplugin:crosscast] > const SvgGradientHelper* pSvgGradientHelper = dynamic_cast< const SvgGradientHelper* >(&rPrimitive); * include/editeng/unotext.hxx SvxUnoTextRangeBase: > writerfilter/source/dmapper/DomainMapper_Impl.cxx:7645:62: error: suspicious dynamic cross cast from 'com::sun::star::text::XTextCursor *' to 'SvxUnoTextRangeBase *' [loplugin:crosscast] > SvxUnoTextRangeBase* pDrawText = dynamic_cast<SvxUnoTextRangeBase*>(xCrsr.get()); * include/embeddedobj/embeddedupdate.hxx EmbeddedUpdate: > svtools/source/misc/embedhlp.cxx:932:35: error: suspicious dynamic cross cast from 'com::sun::star::embed::XEmbeddedObject *' to 'embed::EmbeddedUpdate *' [loplugin:crosscast] > embed::EmbeddedUpdate* pObj = dynamic_cast<embed::EmbeddedUpdate*> (GetObject().get()); * include/oox/core/contexthandler2.hxx ContextHandler2Helper: > oox/source/core/contexthandler2.cxx:183:21: error: suspicious dynamic cross cast from 'const ContextHandler2Helper' to 'const ContextHandler &' [loplugin:crosscast] > ContextHandler( dynamic_cast< ContextHandler const & >( rParent ) ), * include/oox/mathml/export.hxx FormulaExportBase: > oox/source/export/shapes.cxx:2475:42: error: suspicious dynamic cross cast from 'com::sun::star::frame::XModel *' to 'oox::FormulaExportBase *' [loplugin:crosscast] > oox::FormulaExportBase *const pMagic(dynamic_cast<oox::FormulaExportBase*>(xMathModel.get())); * include/oox/mathml/import.hxx FormulaImportBase: > oox/source/drawingml/shape.cxx:1298:25: error: suspicious dynamic cross cast from 'com::sun::star::uno::XInterface *' to 'oox::FormulaImportBase *' [loplugin:crosscast] > dynamic_cast<oox::FormulaImportBase*>(xMathModel.get())); > writerfilter/source/ooxml/OOXMLFastContextHandler.cxx:2287:38: error: suspicious dynamic cross cast from 'SfxBaseModel' to 'oox::FormulaImportBase &' [loplugin:crosscast] > oox::FormulaImportBase& import = dynamic_cast<oox::FormulaImportBase&>(dynamic_cast<SfxBaseModel&>(*component)); > writerfilter/source/rtftok/rtfdocumentimpl.cxx:2973:33: error: suspicious dynamic cross cast from 'SfxBaseModel' to 'oox::FormulaImportBase &' [loplugin:crosscast] > auto& rImport = dynamic_cast<oox::FormulaImportBase&>( > writerfilter/source/dmapper/DomainMapper_Impl.cxx:3000:53: error: suspicious dynamic cross cast from 'com::sun::star::uno::XInterface *' to 'oox::FormulaImportBase *' [loplugin:crosscast] > if( oox::FormulaImportBase* formulaimport = dynamic_cast< oox::FormulaImportBase* >( xInterface.get())) * include/sfx2/Metadatable.hxx Metadatable: > sw/source/core/doc/docbm.cxx:1837:17: error: suspicious dynamic cross cast from 'const IBookmark *const' to 'const ::sfx2::Metadatable *' [loplugin:crosscast] > dynamic_cast< ::sfx2::Metadatable const* >(pBookmark)); > sw/source/core/doc/docbm.cxx:1924:13: error: suspicious dynamic cross cast from '::sw::mark::IBookmark *const' to '::sfx2::Metadatable *' [loplugin:crosscast] > dynamic_cast< ::sfx2::Metadatable* >(pBookmark)); > sw/source/core/doc/DocumentContentOperationsManager.cxx:342:21: error: suspicious dynamic cross cast from 'const sw::mark::IMark *const' to 'const ::sfx2::Metadatable *' [loplugin:crosscast] > dynamic_cast< ::sfx2::Metadatable const* >(pMark)); > sw/source/core/doc/DocumentContentOperationsManager.cxx:344:21: error: suspicious dynamic cross cast from '::sw::mark::IMark *const' to '::sfx2::Metadatable *' [loplugin:crosscast] > dynamic_cast< ::sfx2::Metadatable * >(pNewMark)); > sw/source/core/unocore/unobkm.cxx:381:12: error: suspicious dynamic cross cast from '::sw::mark::IMark *' to '::sfx2::Metadatable *' [loplugin:crosscast] > return dynamic_cast< ::sfx2::Metadatable* >(m_pImpl->m_pRegisteredBookmark); > sw/source/core/undo/rolbck.cxx:635:13: error: suspicious dynamic cross cast from 'const ::sw::mark::IBookmark *const' to 'const ::sfx2::Metadatable *' [loplugin:crosscast] > dynamic_cast< ::sfx2::Metadatable const* >(pBookmark)); > sw/source/core/undo/rolbck.cxx:713:13: error: suspicious dynamic cross cast from '::sw::mark::IBookmark *const' to '::sfx2::Metadatable *' [loplugin:crosscast] > dynamic_cast< ::sfx2::Metadatable* >(pBookmark)); * include/sfx2/digitalsignatures.hxx DigitalSignatures: > sfx2/source/doc/docfile.cxx:3999:25: error: suspicious dynamic cross cast from 'com::sun::star::security::XDocumentDigitalSignatures *' to 'sfx2::DigitalSignatures *' [loplugin:crosscast] > auto xModelSigner = dynamic_cast<sfx2::DigitalSignatures*>(xSigner.get()); * include/sfx2/sidebar/IContextChangeReceiver.hxx IContextChangeReceiver: > sfx2/source/sidebar/SidebarPanelBase.cxx:105:11: error: suspicious dynamic cross cast from 'pointer' (aka 'PanelLayout *') to 'IContextChangeReceiver *' [loplugin:crosscast] > = dynamic_cast<IContextChangeReceiver*>(mxControl.get()); * include/sfx2/sidebar/ILayoutableWindow.hxx ILayoutableWindow: > sfx2/source/sidebar/SidebarPanelBase.cxx:164:44: error: suspicious dynamic cross cast from 'pointer' (aka 'PanelLayout *') to 'ILayoutableWindow *' [loplugin:crosscast] > ILayoutableWindow* pLayoutableWindow = dynamic_cast<ILayoutableWindow*>(mxControl.get()); * include/sfx2/sidebar/SidebarModelUpdate.hxx SidebarModelUpdate: > sfx2/source/sidebar/SidebarPanelBase.cxx:189:40: error: suspicious dynamic cross cast from 'pointer' (aka 'PanelLayout *') to 'SidebarModelUpdate *' [loplugin:crosscast] > SidebarModelUpdate* pModelUpdate = dynamic_cast<SidebarModelUpdate*>(mxControl.get()); * include/sfx2/xmldump.hxx XmlDump: > svtools/source/misc/embedhlp.cxx:290:27: error: suspicious dynamic cross cast from 'com::sun::star::util::XCloseable *' to 'sfx2::XmlDump *' [loplugin:crosscast] > auto pComponent = dynamic_cast<sfx2::XmlDump*>(mxObj->getComponent().get()); * include/svl/stylesheetuser.hxx StyleSheetUser: > sd/source/core/stlsheet.cxx:294:48: error: suspicious dynamic cross cast from 'SfxListener *' to 'svl::StyleSheetUser *' [loplugin:crosscast] > const svl::StyleSheetUser* const pUser(dynamic_cast<svl::StyleSheetUser*>(pListener)); * include/svl/undo.hxx SfxRepeatTarget: > starmath/source/action.cxx:45:5: error: suspicious dynamic cross cast from 'SfxRepeatTarget' to 'SmDocShell &' [loplugin:crosscast] > dynamic_cast< SmDocShell & >(rDocSh).SetFormat(aNewFormat); * include/svx/ipolypolygoneditorcontroller.hxx IPolyPolygonEditorController: > sd/source/ui/view/drbezob.cxx:127:22: error: suspicious dynamic cross cast from 'sd::SmartTag *' to 'IPolyPolygonEditorController *' [loplugin:crosscast] > pIPPEC = dynamic_cast< IPolyPolygonEditorController* >( mpView->getSmartTags().getSelected().get() ); > sd/source/ui/view/drbezob.cxx:216:26: error: suspicious dynamic cross cast from 'sd::SmartTag *' to 'IPolyPolygonEditorController *' [loplugin:crosscast] > pIPPEC = dynamic_cast< IPolyPolygonEditorController* >( mpView->getSmartTags().getSelected().get() ); * include/vcl/IContext.hxx IContext: > vcl/source/window/builder.cxx:3650:54: error: suspicious dynamic cross cast from 'vcl::Window *' to 'vcl::IContext *' [loplugin:crosscast] > vcl::IContext* pContextControl = dynamic_cast<vcl::IContext*>(pCurrentChild.get()); * include/vcl/ITiledRenderable.hxx ITiledRenderable: > In file included from test/source/a11y/swaccessibletestbase.cxx:10: > In file included from include/test/a11y/swaccessibletestbase.hxx:22: > include/test/a11y/accessibletestbase.hxx:54:15: error: suspicious dynamic cross cast from 'com::sun::star::lang::XComponent *' to 'vcl::ITiledRenderable *' [loplugin:crosscast] > = dynamic_cast<vcl::ITiledRenderable*>(mxDocument.get()); * include/vcl/NotebookbarContextControl.hxx NotebookbarContextControl: > vcl/source/control/notebookbar.cxx:113:33: error: suspicious dynamic cross cast from 'vcl::Window *' to 'NotebookbarContextControl *' [loplugin:crosscast] > pContextContainer = dynamic_cast<NotebookbarContextControl*>(m_pUIBuilder->get<Window>(OUStringToOString(aName, RTL_TEXTENCODING_UTF8))); * include/vcl/gdimetafiletools.hxx MetafileAccessor: > vcl/source/gdi/impgraph.cxx:716:61: error: suspicious dynamic cross cast from 'drawinglayer::primitive2d::BasePrimitive2D *' to 'const MetafileAccessor *' [loplugin:crosscast] > const MetafileAccessor* pMetafileAccessor = dynamic_cast< const MetafileAccessor* >(pUnoPrimitive->getBasePrimitive2D().get()); * include/vcl/syswin.hxx VclBuilderContainer: > vcl/source/app/salvtables.cxx:7465:11: error: suspicious dynamic cross cast from 'vcl::Window *' to 'VclBuilderContainer *' [loplugin:crosscast] > = dynamic_cast<VclBuilderContainer*>(m_aOwnedToplevel.get())) * include/vcl/toolkit/field.hxx NumericFormatter: > vcl/source/window/builder.cxx:583:37: error: suspicious dynamic cross cast from 'vcl::Window *' to 'NumericFormatter *' [loplugin:crosscast] > NumericFormatter *pTarget = dynamic_cast<NumericFormatter*>(get(elem.m_sID)); * include/vcl/transfer.hxx DragSourceHelper: > svx/source/sdr/contact/sdrmediawindow.cxx:163:47: error: suspicious dynamic cross cast from 'vcl::Window *' to 'DragSourceHelper *' [loplugin:crosscast] > DragSourceHelper* pDragSourceHelper = dynamic_cast< DragSourceHelper* >( pWindow ); * include/vcl/transfer.hxx DropTargetHelper: > svx/source/sdr/contact/sdrmediawindow.cxx:126:47: error: suspicious dynamic cross cast from 'vcl::Window *' to 'DropTargetHelper *' [loplugin:crosscast] > DropTargetHelper* pDropTargetHelper = dynamic_cast< DropTargetHelper* >( pWindow ); > svx/source/sdr/contact/sdrmediawindow.cxx:145:47: error: suspicious dynamic cross cast from 'vcl::Window *' to 'DropTargetHelper *' [loplugin:crosscast] > DropTargetHelper* pDropTargetHelper = dynamic_cast< DropTargetHelper* >( pWindow ); * include/vcl/wizardmachine.hxx IWizardPageController: > vcl/source/control/wizardmachine.cxx:1274:46: error: suspicious dynamic cross cast from 'BuilderPage *' to 'IWizardPageController *' [loplugin:crosscast] > IWizardPageController* pController = dynamic_cast<IWizardPageController*>(pCurrentPage); * include/xmloff/settingsstore.hxx DocumentSettingsSerializer: > xmloff/source/draw/sdxmlimp.cxx:540:15: error: suspicious dynamic cross cast from 'com::sun::star::beans::XPropertySet *' to 'DocumentSettingsSerializer *' [loplugin:crosscast] > pFilter = dynamic_cast<DocumentSettingsSerializer *>(xProps.get()); > xmloff/source/draw/sdxmlexp.cxx:2474:41: error: suspicious dynamic cross cast from 'com::sun::star::beans::XPropertySet *' to 'DocumentSettingsSerializer *' [loplugin:crosscast] > DocumentSettingsSerializer *pFilter(dynamic_cast<DocumentSettingsSerializer *>(xProps.get())); * include/xmloff/xmlimp.hxx SvXMLImport: > sdext/source/pdfimport/sax/emitcontext.cxx:45:37: error: suspicious dynamic cross cast from 'com::sun::star::xml::sax::XDocumentHandler *' to 'SvXMLImport *' [loplugin:crosscast] > if (SvXMLImport *pFastHandler = dynamic_cast<SvXMLImport*>(m_xDocHdl.get())) > writerperfect/source/common/DocumentHandler.cxx:118:37: error: suspicious dynamic cross cast from 'com::sun::star::xml::sax::XDocumentHandler *' to 'SvXMLImport *' [loplugin:crosscast] > if (SvXMLImport* pFastHandler = dynamic_cast<SvXMLImport*>(mxHandler.get())) * reportdesign/inc/RptObject.hxx OObjectBase: > reportdesign/source/ui/report/ViewsWindow.cxx:843:53: error: suspicious dynamic cross cast from 'SdrObject *' to 'OObjectBase *' [loplugin:crosscast] > OObjectBase* pObjBase = dynamic_cast<OObjectBase*>(pObj); > reportdesign/source/core/sdr/ReportUndoFactory.cxx:30:25: error: suspicious dynamic cross cast from 'SdrObject *' to 'OObjectBase *' [loplugin:crosscast] > OObjectBase* pObj = dynamic_cast<OObjectBase*>(&rObject); > reportdesign/source/core/sdr/RptPage.cxx:62:29: error: suspicious dynamic cross cast from 'SdrObject *' to 'OObjectBase *' [loplugin:crosscast] > OObjectBase* pObj = dynamic_cast<OObjectBase*>(GetObj(i)); > reportdesign/source/core/sdr/RptPage.cxx:77:30: error: suspicious dynamic cross cast from 'SdrObject *' to 'OObjectBase *' [loplugin:crosscast] > OObjectBase* pBase = dynamic_cast<OObjectBase*>(GetObj(nPos)); > reportdesign/source/core/sdr/RptPage.cxx:116:28: error: suspicious dynamic cross cast from 'SdrObject *' to 'OObjectBase *' [loplugin:crosscast] > OObjectBase* pObject = dynamic_cast< OObjectBase* >(SdrObject::getSdrObjectFromXShape( _xObject )); > reportdesign/source/core/sdr/RptPage.cxx:184:32: error: suspicious dynamic cross cast from 'SdrObject *' to 'OObjectBase *' [loplugin:crosscast] > OObjectBase* pObjectBase = dynamic_cast< OObjectBase* >( pObj ); > reportdesign/source/core/sdr/ReportDrawPage.cxx:60:29: error: suspicious dynamic cross cast from 'SdrObject *' to 'OObjectBase *' [loplugin:crosscast] > OObjectBase* pBaseObj = dynamic_cast<OObjectBase*>(pObj); > reportdesign/source/ui/report/dlgedfunc.cxx:455:25: error: suspicious dynamic cross cast from 'SdrObject *' to 'OObjectBase *' [loplugin:crosscast] > OObjectBase* pObj = dynamic_cast<OObjectBase*>(_pOverlappedObj); > reportdesign/source/ui/report/SectionView.cxx:177:37: error: suspicious dynamic cross cast from 'SdrObject' to 'OObjectBase &' [loplugin:crosscast] > OObjectBase& rBaseObj = dynamic_cast<OObjectBase&>(*pObj); > reportdesign/source/ui/report/ReportSection.cxx:338:29: error: suspicious dynamic cross cast from 'SdrObject *' to 'OObjectBase *' [loplugin:crosscast] > OObjectBase* pObj = dynamic_cast<OObjectBase*>(pSdrObject); > reportdesign/source/ui/report/ReportSection.cxx:513:38: error: suspicious dynamic cross cast from 'SdrObject' to 'OObjectBase &' [loplugin:crosscast] > OObjectBase& rBase = dynamic_cast<OObjectBase&>(*pObject); > reportdesign/source/ui/report/ReportSection.cxx:644:33: error: suspicious dynamic cross cast from 'SdrObject *' to 'OObjectBase *' [loplugin:crosscast] > OObjectBase* pObj = dynamic_cast<OObjectBase*>(pDlgEdObj); > reportdesign/source/ui/report/ReportSection.cxx:663:35: error: suspicious dynamic cross cast from 'const SdrObject *' to 'const OObjectBase *' [loplugin:crosscast] > const OObjectBase* pObj = dynamic_cast<const OObjectBase*>(pDlgEdObj); > reportdesign/source/ui/report/propbrw.cxx:286:33: error: suspicious dynamic cross cast from 'SdrObject *' to 'OObjectBase *' [loplugin:crosscast] > OObjectBase* pObj = dynamic_cast<OObjectBase*>(pCurrent); > reportdesign/source/ui/report/ViewsWindow.cxx:843:53: error: suspicious dynamic cross cast from 'SdrObject *' to 'OObjectBase *' [loplugin:crosscast] > OObjectBase* pObjBase = dynamic_cast<OObjectBase*>(pObj); * sc/source/ui/inc/IAnyRefDialog.hxx IAnyRefDialog: > sc/source/ui/app/scmod.cxx:1607:42: error: suspicious dynamic cross cast from 'element_type *' (aka 'SfxDialogController *') to 'IAnyRefDialog *' [loplugin:crosscast] > IAnyRefDialog* pRefDlg = dynamic_cast<IAnyRefDialog*>(pChildWnd->GetController().get()); > sc/source/ui/app/scmod.cxx:1646:42: error: suspicious dynamic cross cast from 'element_type *' (aka 'SfxDialogController *') to 'IAnyRefDialog *' [loplugin:crosscast] > IAnyRefDialog* pRefDlg = dynamic_cast<IAnyRefDialog*>(pChildWnd->GetController().get()); > sc/source/ui/app/scmod.cxx:1697:42: error: suspicious dynamic cross cast from 'element_type *' (aka 'SfxDialogController *') to 'IAnyRefDialog *' [loplugin:crosscast] > IAnyRefDialog* pRefDlg = dynamic_cast<IAnyRefDialog*>(pChildWnd->GetController().get()); > sc/source/ui/app/scmod.cxx:1766:42: error: suspicious dynamic cross cast from 'element_type *' (aka 'SfxDialogController *') to 'IAnyRefDialog *' [loplugin:crosscast] > IAnyRefDialog* pRefDlg = dynamic_cast<IAnyRefDialog*>(pChildWnd->GetController().get()); > sc/source/ui/app/scmod.cxx:1813:42: error: suspicious dynamic cross cast from 'element_type *' (aka 'SfxDialogController *') to 'IAnyRefDialog *' [loplugin:crosscast] > IAnyRefDialog* pRefDlg = dynamic_cast<IAnyRefDialog*>(pChildWnd->GetController().get()); > sc/source/ui/app/scmod.cxx:1853:38: error: suspicious dynamic cross cast from 'element_type *' (aka 'SfxDialogController *') to 'IAnyRefDialog *' [loplugin:crosscast] > IAnyRefDialog* pRefDlg = dynamic_cast<IAnyRefDialog*>(pChildWnd->GetController().get()); > sc/source/ui/view/tabview3.cxx:470:30: error: suspicious dynamic cross cast from 'element_type *' (aka 'SfxDialogController *') to 'IAnyRefDialog *' [loplugin:crosscast] > IAnyRefDialog* pRefDlg = dynamic_cast<IAnyRefDialog*>(xDlgController.get()); > sc/source/ui/view/tabview3.cxx:2053:42: error: suspicious dynamic cross cast from 'element_type *' (aka 'SfxDialogController *') to 'IAnyRefDialog *' [loplugin:crosscast] > IAnyRefDialog* pRefDlg = dynamic_cast<IAnyRefDialog*>(pChildWnd->GetController().get()); > sc/source/ui/view/tabvwsh4.cxx:210:46: error: suspicious dynamic cross cast from 'element_type *' (aka 'SfxDialogController *') to 'IAnyRefDialog *' [loplugin:crosscast] > IAnyRefDialog* pRefDlg = dynamic_cast<IAnyRefDialog*>(pController.get()); * sd/source/filter/eppt/epptbase.hxx PPTExBulletProvider: > sd/source/filter/eppt/pptx-epptbase.cxx:497:74: error: suspicious dynamic cross cast from 'PPTWriterBase *' to 'PPTExBulletProvider *' [loplugin:crosscast] > maStyleSheetList.emplace_back( new PPTExStyleSheet( nDefaultTab, dynamic_cast<PPTExBulletProvider*>(this) ) ); * sdext/source/presenter/PresenterViewFactory.hxx CachablePresenterView: > sdext/source/presenter/PresenterViewFactory.cxx:218:36: error: suspicious dynamic cross cast from 'com::sun::star::drawing::framework::XResource *' to 'CachablePresenterView *' [loplugin:crosscast] > CachablePresenterView* pView = dynamic_cast<CachablePresenterView*>(rxView.get()); > sdext/source/presenter/PresenterViewFactory.cxx:274:23: error: suspicious dynamic cross cast from 'com::sun::star::drawing::framework::XView *' to 'CachablePresenterView *' [loplugin:crosscast] > = dynamic_cast<CachablePresenterView*>(iView->second.first.get()); > sdext/source/presenter/PresenterViewFactory.cxx:325:40: error: suspicious dynamic cross cast from 'com::sun::star::drawing::framework::XView *' to 'CachablePresenterView *' [loplugin:crosscast] > CachablePresenterView* pView = dynamic_cast<CachablePresenterView*>(xView.get()); * slideshow/source/inc/cursormanager.hxx CursorManager: > slideshow/source/engine/slide/userpaintoverlay.cxx:449:49: error: suspicious dynamic cross cast from 'CursorManager' to 'Slide &' [loplugin:crosscast] > dynamic_cast<Slide&>(rContext.mrCursorManager), * svx/source/inc/celltypes.hxx TableDesignUser: > svx/source/table/tabledesign.cxx:267:38: error: suspicious dynamic cross cast from 'com::sun::star::util::XModifyListener *' to 'TableDesignUser *' [loplugin:crosscast] > TableDesignUser* pUser = dynamic_cast< TableDesignUser* >( it.next().get() ); * svx/source/inc/tablemodel.hxx ICellRange: > svx/source/table/tablemodel.cxx:285:26: error: suspicious dynamic cross cast from 'com::sun::star::table::XCellRange *' to 'ICellRange *' [loplugin:crosscast] > ICellRange* pRange = dynamic_cast< ICellRange* >( rRange.get() ); * sw/inc/IDocumentUndoRedo.hxx IDocumentUndoRedo: > sw/source/uibase/shells/drwtxtsh.cxx:585:38: error: suspicious dynamic cross cast from 'SfxUndoManager *' to 'IDocumentUndoRedo *' [loplugin:crosscast] > auto* pUndoManager = dynamic_cast<IDocumentUndoRedo*>(GetUndoManager()); * sw/inc/IMark.hxx IFieldmark: > sw/source/core/doc/docbm.cxx:1415:15: error: suspicious dynamic cross cast from 'sw::mark::MarkBase *const' to 'IFieldmark *' [loplugin:crosscast] > : dynamic_cast<IFieldmark*>(*pFieldmark); > sw/source/core/doc/docbm.cxx:1437:16: error: suspicious dynamic cross cast from 'sw::mark::MarkBase *' to 'IFieldmark *' [loplugin:crosscast] > return dynamic_cast<IFieldmark*>(pFieldmark); > sw/source/core/doc/docbm.cxx:1570:37: error: suspicious dynamic cross cast from 'sw::mark::MarkBase *' to 'IFieldmark *' [loplugin:crosscast] > IFieldmark *pMark = dynamic_cast<IFieldmark*>(*aIter); * sw/inc/calbck.hxx BroadcastingModify: > sw/source/core/attr/swatrset.cxx:228:29: error: suspicious dynamic cross cast from 'const sw::BroadcastingModify *' to 'const sw::FormatDropDefiner *' [loplugin:crosscast] > auto pDropDefiner = dynamic_cast<const sw::FormatDropDefiner*>(pModify); > sw/source/core/txtnode/OnlineAccessibilityCheck.cxx:38:28: error: suspicious dynamic cross cast from 'SwNode *' to 'sw::BroadcastingModify *' [loplugin:crosscast] > auto* pBroadcast = dynamic_cast<sw::BroadcastingModify*>(m_pNode); * sw/inc/contentindex.hxx SwContentIndexReg: > sw/source/core/doc/DocumentRedlineManager.cxx:56:20: error: suspicious dynamic cross cast from 'SwNode *' to 'SwContentIndexReg *' [loplugin:crosscast] > assert(dynamic_cast<SwContentIndexReg*>(&pPos->GetNode()) * sw/source/core/inc/flowfrm.hxx SwFlowFrame: > sw/source/core/layout/frmtool.cxx:3044:35: error: suspicious dynamic cross cast from 'SwFrame *' to 'SwFlowFrame *' [loplugin:crosscast] > SwFlowFrame *pFlowFrame = dynamic_cast<SwFlowFrame*>(pSibling); * sw/source/uibase/inc/FrameControl.hxx ISwFrameControl: > sw/source/uibase/docvw/FrameControlsManager.cxx:283:15: error: suspicious dynamic cross cast from 'vcl::Window *' to 'ISwFrameControl *' [loplugin:crosscast] > mpIFace = dynamic_cast<ISwFrameControl *>( pWindow.get() ); * vcl/inc/IPrioritable.hxx IPrioritable: > vcl/source/control/NotebookbarPopup.cxx:40:37: error: suspicious dynamic cross cast from 'vcl::Window *' to 'vcl::IPrioritable *' [loplugin:crosscast] > vcl::IPrioritable* pChild = dynamic_cast<vcl::IPrioritable*>(GetChild(0)); > vcl/source/control/PriorityHBox.cxx:89:43: error: suspicious dynamic cross cast from 'vcl::Window *' to 'vcl::IPrioritable *' [loplugin:crosscast] > vcl::IPrioritable* pPrioritable = dynamic_cast<vcl::IPrioritable*>(pChild); > vcl/source/control/PriorityHBox.cxx:127:32: error: suspicious dynamic cross cast from 'vcl::IPrioritable *' to 'vcl::Window *' [loplugin:crosscast] > vcl::Window* pWindow = dynamic_cast<vcl::Window*>(pPrioritable); > vcl/source/control/PriorityHBox.cxx:142:32: error: suspicious dynamic cross cast from 'vcl::IPrioritable *' to 'vcl::Window *' [loplugin:crosscast] > vcl::Window* pWindow = dynamic_cast<vcl::Window*>(*pChildR); > vcl/source/control/PriorityHBox.cxx:186:43: error: suspicious dynamic cross cast from 'vcl::Window *' to 'vcl::IPrioritable *' [loplugin:crosscast] > vcl::IPrioritable* pPrioritable = dynamic_cast<vcl::IPrioritable*>(pChild); > vcl/source/window/NotebookBarAddonsMerger.cxx:128:19: error: suspicious dynamic cross cast from 'vcl::Window *' to 'vcl::IPrioritable *' [loplugin:crosscast] > = dynamic_cast<vcl::IPrioritable*>(pOptionalParent.get()); > ovcl/source/window/builder.cxx:3643:55: error: suspicious dynamic cross cast from 'vcl::Window *' to 'vcl::IPrioritable *' [loplugin:crosscast] > vcl::IPrioritable* pPrioritable = dynamic_cast<vcl::IPrioritable*>(pCurrentChild.get()); * vcl/inc/jsdialog/jsdialogbuilder.hxx BaseJSWidget: > vcl/jsdialog/executor.cxx:41:26: error: suspicious dynamic cross cast from 'weld::Widget *' to 'BaseJSWidget *' [loplugin:crosscast] > if (auto pJSWidget = dynamic_cast<BaseJSWidget*>(pWidget)) > vcl/jsdialog/executor.cxx:49:26: error: suspicious dynamic cross cast from 'weld::Widget *' to 'BaseJSWidget *' [loplugin:crosscast] > if (auto pJSWidget = dynamic_cast<BaseJSWidget*>(pWidget)) > vcl/jsdialog/executor.cxx:155:49: error: suspicious dynamic cross cast from 'weld::MenuButton *' to 'BaseJSWidget *' [loplugin:crosscast] > BaseJSWidget* pMenuButton = dynamic_cast<BaseJSWidget*>(pButton); * vcl/inc/unx/x11/x11gdiimpl.h X11GraphicsImpl: > vcl/unx/generic/gdi/salgdi.cxx:387:36: error: suspicious dynamic cross cast from 'pointer' (aka 'SalGraphicsImpl *') to 'X11GraphicsImpl *' [loplugin:crosscast] > if( X11GraphicsImpl* x11Impl = dynamic_cast< X11GraphicsImpl* >( mxImpl.get())) * xmlsecurity/inc/certificate.hxx Certificate: > xmlsecurity/source/helper/documentsignaturemanager.cxx:334:33: error: suspicious dynamic cross cast from 'com::sun::star::security::XCertificate *' to 'xmlsecurity::Certificate *' [loplugin:crosscast] > if (auto pCertificate = dynamic_cast<xmlsecurity::Certificate*>(xCert.get())) > xmlsecurity/source/helper/documentsignaturemanager.cxx:381:33: error: suspicious dynamic cross cast from 'com::sun::star::security::XCertificate *' to 'xmlsecurity::Certificate *' [loplugin:crosscast] > if (auto pCertificate = dynamic_cast<xmlsecurity::Certificate*>(xCert.get())) > xmlsecurity/source/component/documentdigitalsignatures.cxx:688:28: error: suspicious dynamic cross cast from 'com::sun::star::security::XCertificate *' to 'xmlsecurity::Certificate *' [loplugin:crosscast] > auto pAuthor = dynamic_cast<xmlsecurity::Certificate*>(xAuthor.get()); > xmlsecurity/source/component/documentdigitalsignatures.cxx:689:26: error: suspicious dynamic cross cast from 'com::sun::star::security::XCertificate *' to 'xmlsecurity::Certificate *' [loplugin:crosscast] > auto pCert = dynamic_cast<xmlsecurity::Certificate*>(xCert.get()); > xmlsecurity/qa/unit/signing/signing.cxx:130:29: error: suspicious dynamic cross cast from 'com::sun::star::security::XCertificate *' to 'xmlsecurity::Certificate *' [loplugin:crosscast] > auto pCertificate = dynamic_cast<xmlsecurity::Certificate*>(xCertificate.get()); Change-Id: If4f9efd8c012d0f650fe670450cf7ac0c8978036 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143458 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-11-25Fold OldBasicPassword into basic::SfxScriptLibraryContainerStephan Bergmann
Change-Id: Iaeaf30f63760185a2b1dd72feb980b94d9931d55 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143253 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-11-23Fix loplugin:redundantcast check for same-type dynamic_castStephan Bergmann
...when the target type is a reference type and the source and target type have different cv qualifiers. (And fix the fallout. And make the tests cover that somewhat more exhaustively; and while at it also test that the plugin can cope with dynamic_cast to void pointers, which is the only legitimate case where a dynamic_cast can involve types that are not (pointers or references to) non-class types.) Change-Id: Ia568ddb5dbc4a84c275db172791c345d95964857 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143133 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-11-22loplugin:unusedfields update the post-process scriptNoel Grandin
(*) ignore temporary fields in lambdas (*) don't ignore the vcl/weld stuff anymore Change-Id: I4cda18f779588409891a2b2f8b1371e60f9b9ac0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143090 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-11-18Related tdf#104597, tdf#151546: Introduce comphelper::string::reverseCodePointsStephan Bergmann
69e9925ded584113e52f84ef0ed7c224079fa061 "sdext.pdfimport: resolves tdf#104597: RTL script text runs are reversed" and f6004e1c457ddab5e0c91e6159875d25130b108a "tdf#151546: RTL text is reversed (Writer pdfimport)" had introduced two calls to comphelper::string::reverseString into sdext. That function reverts on the basis of individual UTF-16 code units, not on the basis of Unicode code points. And while at least some pre-existing callers of that function want the former semantics (see below), these two new callers in sdext apparently want the latter semantics. Therefore, introduce an additional function comphelper::string::reverseCodePoints with the latter semantics. I identified three other places that call comphelper::string::reverseString: * SbRtl_StrReverse in basic/source/runtime/methods1.cxx apparently implements some StrReverse Basic function, where a (presumably non-existing) Basic spec would need to decide which of the two semantics is called for. So leave it alone for now. * SvtFileDialog::IsolateFilterFromPath_Impl in fpicker/source/office/iodlg.cxx reverts a string, operates on it, then reverts (parts of) it back. Whether or not that is the most elegant code, using the latter semantics here would apparently be wrong, as double invocation of comphelper::string::reverseCodePoints is not idempotent when the input is a malformed sequence of UTF-16 code units containing a low surrogate followed by a high surrogate. * AccessibleCell::getCellName in svx/source/table/accessiblecell.cxx apparently always operates on a string consisting only of Latin uppercase letters A--Z, for which both semantics are equivalent. (So we can just as well stick with the simpler comphelper::string::reverseString here.) (Extending the tests in comphelper/qa/string/test_string.cxx ran into an issue where loplugin:stringliteralvar warns about deliberate uses of sal_Unicode arrays rather than UTF-16 string literals wrapped in OUStringLiteral, as those arrays deliberately contain malformed UTF-16 code unit sequences and thus converting them into UTF-16 string literals might be considered inappropriate, see the newly added comment at StringLiteralVar::isPotentiallyInitializedWithMalformedUtf16 in compilerplugins/clang/stringliteralvar.cxx for details. So that loplugin had to be improved here, too.) Change-Id: I641cc32c76b0c5f6339ae44d8aa85df0022ffb05 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142949 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-11-11New loplugin:constmoveStephan Bergmann
"Find occurrences of std::move on const-qualified types. While there might theoretically be legitimate uses for such (for which this plugin would generate false positives and would need to be updated), in practice they tend to point at suspicious code that should be cleaned up in some way." (All issues found for a Linux build have already been addressed with eleven recent commits mentioning in their commit messages: "I came across this code with an upcoming loplugin:constmove that flags suspicious uses of std::move involving const-qualified types.") Change-Id: I891a66eb0ec5f9b7d93536bbccea0359893383df Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142589 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-11-06-Werror,-Wdeprecated-declarations (sprintf, macOS 13 SDK): compilerpluginsStephan Bergmann
Change-Id: I9a4d20cd42d6c836aa74837688a272f849d9d373 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142322 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-11-05loplugin:stringconcatauto: There's no dangling-ref issue with O[U]StringNumberStephan Bergmann
...so it's unclear why 2f5f45921b05904a4be1ff633be09c62cb44ff08 "support O(U)String::number() for fast string concatenation" added that here. On the contrary, variables of type OStringNumber can be useful replacements for calls to std::sprintf (which started to emit deprecation warnings with macOS 13 SDK now), so this is in preparation for follow-up commits that will replace many uses of that across the code base with various alternatives. Change-Id: I6f8508d49dc84773c50f4c33dba38fe08c4c8969 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142318 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-10-26Adapt compilerplugins to recent Clang 16 trunk changeStephan Bergmann
<https://github.com/llvm/llvm-project/commit/1acffe81ee9117691812b9bf8747c03354177d15> "NFC: [clang] Template argument cleanups." Change-Id: I84bc276c21efcc11643ae7003e0fee6c7592130f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141860 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-10-22loplugin:unusedmethodsNoel Grandin
Change-Id: I3c94d68cb85adc2005a5a5e3b03a311732f782c3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141617 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-10-21loplugin:referencecasting look for a new patternNoel Grandin
Change-Id: Ib7ded8db2c513909159f0876389f63b60082a529 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141618 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-10-21loplugin:unnecessaryvirtualNoel Grandin
Make the script filter out more external code Change-Id: I131da451e148e193552ead7c1441b06b726df619 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141616 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-10-18Adapt compilerplugins to recent Clang 16 trunk changeStephan Bergmann
<https://github.com/llvm/llvm-project/commit/bcd9ba2b7e64f6ce54defd2fa73fc8e0fee5707c> "[clang] Track the templated entity in type substitution." Change-Id: I314d1567512dc0332b3c61c95978b0230f52b274 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141462 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-10-17loplugin:redundantcast look for redundant dynamic_cast<T&>Noel Grandin
Change-Id: If5a8e74b7ede80b782b584b4f62ec1b8713fd86d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141445 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-10-14Clean up loplugin:stringviewStephan Bergmann
...after 3d236177be255b2027a997bfc12fe0833ca9a2f7 "Deduplicate O(U)StringConcatenation" changed OStringConcat and OUStringConcat into aliases (so they will get looked through by loplugin::TypeCheck::Struct's use of getAs<clang::RecordType> in compilerplugins/clang/check.hxx), but apparently forgot to drop their respective checks here. (That the then-added check for StringConcat works as intended is verified by compilerplugins/clang/test/stringview.cxx, btw.) Change-Id: I3f8e26998d0a55704f0433a818493ef541fd05eb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141370 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-10-14Clean up loplugin:stringaddStephan Bergmann
...after 3d236177be255b2027a997bfc12fe0833ca9a2f7 "Deduplicate O(U)StringConcatenation" changed OStringConcat and OUStringConcat into aliases (so they can never show up here in a "getUnqualifiedDesugareType"), but apparently forgot to drop their respective checks here. (That the then-added check for StringConcat works as intended is verified by compilerplugins/clang/test/stringadd.cxx, btw.) Change-Id: I2b589d977dbf2a384348cb7ee62acce30031ccec Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141364 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-10-14Fix loplugin:stringconcatautoStephan Bergmann
...after af2879e434fa0dc6b2a626617ed865e4f66eb5ad "Deduplicate stringconcat more" changed the *StringNumberBase::toAsciiUperCase return typr from O[U]StringNumber to the underlying StringNumberBase. (And where that commit had added some odd check for a non-existing "StringNumber" type to compilerplugins/clang/stringconcatauto.cxx, presumably in error.) Change-Id: I622e6ae30fcec8f081c978eaf67ffb716a10ee4e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141363 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-10-13Drop now-redundant %selectStephan Bergmann
...after 3d236177be255b2027a997bfc12fe0833ca9a2f7 "Deduplicate O(U)StringConcatenation" Change-Id: Ib45d021da2bb5745055fa0cdebfd700680bfb787 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141304 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-10-13Adapt CompilerTest_compilerplugins_clang to recent ClangStephan Bergmann
...where at least my recent Clang 16 trunk build now started to fail after af2879e434fa0dc6b2a626617ed865e4f66eb5ad "Deduplicate stringconcat more" with > error: 'error' diagnostics expected but not seen: > File compilerplugins/clang/test/stringview.cxx Line 171 (directive at compilerplugins/clang/test/stringview.cxx:170): instead of an '{{(rtl::)?}}OString' constructed from a 'OStringConcat<rtl::OString, rtl::OString>' (aka 'StringConcat<char, rtl::OString, rtl::OString>'), pass a 'std::string_view' via 'rtl::Concat2View' [loplugin:stringview] > File compilerplugins/clang/test/stringview.cxx Line 196 (directive at compilerplugins/clang/test/stringview.cxx:195): instead of an '{{(rtl::)?}}OUString' constructed from a 'OUStringConcat<rtl::OUString, rtl::OUString>' (aka 'StringConcat<char16_t, rtl::OUString, rtl::OUString>'), pass a 'std::u16string_view' via 'rtl::Concat2View' [loplugin:stringview] > error: 'error' diagnostics seen but not expected: > File compilerplugins/clang/test/stringview.cxx Line 171: instead of an 'OString' constructed from a 'OStringConcat<OString, OString>' (aka 'StringConcat<char, rtl::OString, rtl::OString>'), pass a 'std::string_view' via 'rtl::Concat2View' [loplugin:stringview] > File compilerplugins/clang/test/stringview.cxx Line 196: instead of an 'OUString' constructed from a 'OUStringConcat<OUString, OUString>' (aka 'StringConcat<char16_t, rtl::OUString, rtl::OUString>'), pass a 'std::u16string_view' via 'rtl::Concat2View' [loplugin:stringview] > 4 errors generated. > make[1]: *** [solenv/gbuild/LinkTarget.mk:337: workdir/CxxObject/compilerplugins/clang/test/stringview.o] Error 1 Change-Id: I0b8c7d4a012c40c2c2c3cc8a9e55c52f45e8cfc9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141295 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-10-13Deduplicate stringconcat moreMike Kaganski
In the process, drop ToStringHelper::allowO(U)StringConcat, because we can deduce this information from ToStringHelper's addData itself. To do that, addData was converted to ToStringHelper::operator(), which allows to use std::is_invocable_v on the helper class. Change-Id: Ic77878ca0ff65ada8c0a942191bc11de15b9ad2a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141254 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-10-12tdf#147021 REVERT Use std::size() instead of SAL_N_ELEMENTS() macrojsala
Reverting this changes made by error. See https://gerrit.libreoffice.org/c/core/+/136263/6/compilerplugins/clang/test/constvars.cxx#25 Change-Id: Ica49759682adf55a1f0cef2a842acab603c62dac Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141259 Reviewed-by: Stephan Bergmann <sbergman@redhat.com> Tested-by: Jenkins
2022-10-11Deduplicate O(U)StringConcatenationMike Kaganski
And use an overloaded helper function with a better (?) unified name to show that the result is not an O(U)String. Change-Id: I8956338b05d02bf46a6185828130ea8ef145d46b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141203 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-09-25unwrap SwDelChr to plain SfxHintBjoern Michaelsen
Change-Id: Ief37a8025181b6cc8a6e484e2726d8a8d92f57ea Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140567 Tested-by: Jenkins Reviewed-by: Bjoern Michaelsen <bjoern.michaelsen@libreoffice.org>
2022-09-25unwrap SwInsText to a plain SfxHintBjoern Michaelsen
- also add some constnesss and move some things to private Change-Id: I67a45e1326361b5a8f7e320b3525e74e93b1ef12 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140556 Tested-by: Jenkins Reviewed-by: Bjoern Michaelsen <bjoern.michaelsen@libreoffice.org>
2022-09-24unwrap SwDelText to a plain SfxHintBjoern Michaelsen
Change-Id: I559f8f1e837830426e820dace6226618c5e0fc62 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140210 Tested-by: Jenkins Reviewed-by: Bjoern Michaelsen <bjoern.michaelsen@libreoffice.org>
2022-09-23remove some dead codeNoel Grandin
after commit 590796ca0866168e3129d2abd0a0197114cddcdc Author: Noel Grandin <noelgrandin@gmail.com> Date: Wed Sep 21 20:44:42 2022 +0200 convert TrueTypeTable to C++ class Change-Id: I5c656011ebe37529788cea6a749c07ada2378385 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140433 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-09-21Extend loplugin:redundantcast to some suspicious reinterpret_castStephan Bergmann
Change-Id: I5534939bfbea67d216a17891722a683c53621d36 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140303 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-09-14new loplugin refcountingbaseNoel Grandin
Look for classes that have more than one ref-counting base class. A situation which is going to cause trouble. Which reveals that sdr::table::Cell has two different ref-counting bases, so rather make SdrText extends OWeakObject, which means that Cell can just have one ref-counting base, Change-Id: I8d968270f7b449cff2f29da0bd48fa17181c68c5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139807 Tested-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-09-08Clean up some #includesStephan Bergmann
...after 9e7e95a57b7c16941d9fdc59f806c1f9e4263379 "tdf#147021 Use std::size() instead of SAL_N_ELEMENTS() macro" (and somewhat pedantically use the canonical <iterator> for std::size, even though the existing <vector> defines it, too) Change-Id: Iacf0a0619b496bfe7c6abb0a812b6a1b3eed40c2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139653 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-09-08loplugin:unnecessaryvirtualNoel Grandin
Change-Id: I4461ca826960b194cf45ae4917093f3273b3b0a2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139643 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-09-08loplugin:virtualdeadNoel Grandin
Change-Id: Iceb6916bcc8c211a72fccfa4bbcbb22c96a72050 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139642 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-09-05vcl: Rename LongPress event to GestureLongPressPovilas Kanapickas
We have 5 gesture types: GestureZoom, GestureRotate, GesturePan, GestureSwipe and LongPress. For consistency all of these will use Gesture as a prefix to reduce confusion and for easier grepping throughout the codebase. Change-Id: I8b9e245d011203a19c1172f9833c172f65382cab Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139244 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-09-05vcl: Rename Swipe event to GestureSwipePovilas Kanapickas
We have 5 gesture types: GestureZoom, GestureRotate, GesturePan, Swipe and LongPress. For consistency all of these will use Gesture as a prefix to reduce confusion and for easier grepping throughout the codebase. Change-Id: I8b9e245d011203a19c1172f9833c172f65382caa Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139243 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>