Commit Graph
2984 Commits
Author SHA1 Message Date
Stephan Bergmann 17cf2c278d Fix misuse of TagDecl::hasDefinition
...that started to cause false

> In file included from svl/source/items/itemiter.cxx:20:
> include/svl/itemiter.hxx:25:1: error: SfxPoolItem subclass SfxPoolItem declares new fields, but does not override operator== [loplugin:sfxpoolitem]
> class SfxPoolItem;
> ^~~~~~~~~~~~~~~~~

etc. now as a side effect of
<https://github.com/llvm/llvm-project/commit/b6121432da79c4b3d21f191864ff6c583e2e62eb>
"[C++20] Fix a crash with modules."

Change-Id: Ibbf7a7c840ecea2605d6ea76afd04a2c2720e54d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146544
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-02-03 15:38:03 +00:00
Noel Grandin fbfe06dcbd loplugin:unusedfields
Change-Id: I6acce1578d21da0ac014410289def3dd500b4de3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146356
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-01-31 12:59:22 +00:00
Noel Grandin 7ba513361d loplugin:virtualdead
GetPDFAnchorStructureElementId was added in commit 6e5d59c2ca, but
was unused even there

Change-Id: Id0624cac2854f5406ca93a4c495632fc3c1d0e74
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146354
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-01-30 17:29:08 +00:00
Stephan Bergmann 5d22865a14 Missing include for llvm::Optional
...with recent Clang 17 trunk after
<https://github.com/llvm/llvm-project/commit/125f4457a54a550846732763ee36b1447ec8d66e>
"[clang] Remove clang::Optional"

Change-Id: If33406604a614a65dd17e269a0a5c167ea263328
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146347
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-01-30 14:55:14 +00:00
Stephan Bergmann 022085ece4 New loplugin:unoaggregation
"Find classes that derive from css::uno::XAggregation, but which implement
queryInterface in violation of the protocol laid out in the documentation at
udkapi/com/sun/star/uno/XAggregation.idl (which implies that such a class either
doesn't actually make use of the deprecated XAggregation mechanism, which should
thus be removed from that class hierarchy, or that its implementation of
queryInterface needs to be fixed)." (compilerplugins/clang/unoaggregation.cxx)

The basesHaveOnlyPureQueryInterface check in
compilerplugins/clang/unoaggregation.cxx is "a crude approximation (but which
appears to work OK)" to filter out any queryInterface base implementations of
class hierarchies supporting XAggregation (i.e.,
cppu::OWeakAggObject::queryInterface).  It only fails for the odd
ChartDocumentWrapper::queryInterface, which manually implements the XAggregation
functionality rather than (indirectly) deriving from OWeakAggObject.  But
changing that manual implementation looks tricky, so leave that alone for now
and add a loplugin warning suppression there, and leave proper clean up for
later.

Change-Id: Ib16e26237bd703e60b0d9cb7134cb39840842d54
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145912
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-01-20 20:26:36 +00:00
Noel Grandin 32c8b03f61 improve loplugin:refcounting
to catch places where we are converting a weak reference to a strong
reference, and then using a pointer to store the result

Change-Id: I69b132907b574e5c6974fadf18bd9658107d3a0d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145877
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-01-20 12:58:40 +00:00
Andrea Gelmini a5e092b53f Fix typo to complete commit 613baf1573
See https://gerrit.libreoffice.org/c/core/+/145241

Change-Id: Ic9c229fc891ce81c52c7886055a0a3474020f233
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145392
Tested-by: Jenkins
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2023-01-13 16:31:45 +00:00
Stephan Bergmann e001703df4 Merge OSingleFactoryHelper into OFactoryComponentHelper
Change-Id: I7faf7a3ad54c80bd3c53525c92c26c0f980110f9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145423
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-01-13 07:50:57 +00:00
Caolán McNamara 4557bd79fe merge duplicate CairoTextRender impls
drop getSurfaceOffset because both impls just set these to 0, so its
a no opt

Change-Id: Ie4f28d57fb8a170c7a46d3cafceef3e049c26e2f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145325
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2023-01-12 11:33:24 +00:00
Stephan Bergmann 1f9317e341 loplugin:reservedid (clang-cl)
...after ef53355355 "Rudimentary support for
dynamic_cast on UNO proxy objects" added those

> extern "C" IMAGE_DOS_HEADER const __ImageBase;

Change-Id: I4d9cf2b7617180d66a8527e0e36631f81e0fb18d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145379
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-01-12 09:01:16 +00:00
Stephan Bergmann ec98e77690 Merge comphelper::OAccessibleContextHelper into 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-06 19:02:05 +00:00
Vasily Melenchuk f011a13b3e writerfilter: removed remains of GAP_HALF define and its usage
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-06 07:26:15 +00:00
Bogdan B 06468a15d5 Remove unused imports from compilerplugins/clang
Change-Id: I923ace7bedf022d49222e71c96c7e4c20f90e6cb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142521
Tested-by: Jenkins
Reviewed-by: Hossein <hossein@libreoffice.org>
2023-01-02 04:39:16 +00:00
Adolfo Jayme Barrientos 56cc13e854 Bump copyright year to 2023
Change-Id: I699112a3e554013bab75b82d1eae00098216c886
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144893
Tested-by: Jenkins
Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
2023-01-01 10:12:56 +00:00
Stephan Bergmann 28f248a339 Make namespace checks look through LinkageSpecs
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-22 10:44:35 +00:00
Stephan Bergmann 1bd8f26a91 Revert "fix compile error in compilerplugins"
This reverts commit 99b5e216f1.  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-20 10:24:14 +00:00
Noel Grandin 8fe55893af Adapt to PPCallbacks::InclusionDirective change in Clang 16 trunk
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-20 07:52:20 +00:00
Noel Grandin 99b5e216f1 fix compile error in compilerplugins
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 b5023fa9ab
    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-20 07:25:27 +00:00
Noel Grandin 0a5d85e76f new loplugin:implinheritancehelper
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-20 06:05:13 +00:00
Stephan Bergmann 6c63fca23f Avoid -Werror,-Wdeprecated-declarations
...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-19 19:27:56 +00:00
Stephan Bergmann b5023fa9ab Adapt to clang::PPCallbacks::InclusionDirective change in Clang 16 trunk
<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-19 19:27:36 +00:00
Stephan Bergmann a0133459ad Merge sdr::table::TableDesignUser into sdr::table::SdrTableObjImpl
Change-Id: Ia7841447df4a7db1b5dd9fad93cab66fbca48981
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144316
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-12-16 12:45:55 +00:00
Noel Grandin 7243f7c706 loplugin:unusedmethods
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-07 17:17:33 +00:00
Noel Grandin 39bb374ad9 loplugin:unusedfields
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-07 13:37:24 +00:00
Noel Grandin 3c140c0174 loplugin:singlevalfields
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-07 12:41:15 +00:00
Caolán McNamara 54f7492364 weld InformationDialog info dialog
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-06 19:30:22 +00:00
Caolán McNamara a70ad1568e Resolves: tdf#121297 weld Presentation Minimizer
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-12-06 19:29:38 +00:00
Stephan Bergmann 160689897c New loplugin:crosscast
...inspired by 2fa426da15 "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, 7a82ea5c79 "Fix
presumed typo" and fc6aa9e499 "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 8858962ec0 "Introduce
ParagraphProeprtiesPropertyMap", 8467aa93e2
"Replace a dynamic_cast with UNO_QUERY",
a534361141 "Fold OldBasicPassword into
basic::SfxScriptLibraryContainer", and 589e03fb4c
"[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-29 18:07:23 +01:00
Stephan Bergmann a534361141 Fold OldBasicPassword into basic::SfxScriptLibraryContainer
Change-Id: Iaeaf30f63760185a2b1dd72feb980b94d9931d55
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143253
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-11-25 10:12:38 +01:00
Stephan Bergmann 7255d21f81 Fix loplugin:redundantcast check for same-type dynamic_cast
...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-23 08:48:46 +01:00
Noel Grandin 91436c281b loplugin:unusedfields update the post-process script
(*) 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-22 13:21:36 +01:00
Stephan Bergmann 50d73574b6 Related tdf#104597, tdf#151546: Introduce comphelper::string::reverseCodePoints
69e9925ded "sdext.pdfimport: resolves tdf#104597:
RTL script text runs are reversed" and f6004e1c45
"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-18 19:50:28 +01:00
Stephan Bergmann 4c9093c954 New loplugin:constmove
"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-11 19:37:16 +01:00
Stephan Bergmann 7533d93cdc -Werror,-Wdeprecated-declarations (sprintf, macOS 13 SDK): compilerplugins
Change-Id: I9a4d20cd42d6c836aa74837688a272f849d9d373
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142322
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-11-06 01:14:05 +01:00
Stephan Bergmann e0a5a201d4 loplugin:stringconcatauto: There's no dangling-ref issue with O[U]StringNumber
...so it's unclear why 2f5f45921b "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-11-05 15:50:43 +01:00
Stephan Bergmann 5baeba69bf Adapt compilerplugins to recent Clang 16 trunk change
<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-26 15:06:18 +02:00
Noel Grandin a3c7d78f3d loplugin:unusedmethods
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-22 08:29:54 +02:00
Noel Grandin 767092fe2c loplugin:referencecasting look for a new pattern
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-21 15:50:35 +02:00
Noel Grandin 4d4ce60cf6 loplugin:unnecessaryvirtual
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-21 13:11:33 +02:00
Stephan Bergmann aa674ac4b5 Adapt compilerplugins to recent Clang 16 trunk change
<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-18 08:06:18 +02:00
Noel Grandin 6bde58fa51 loplugin:redundantcast look for redundant dynamic_cast<T&>
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-17 12:00:28 +02:00
Stephan Bergmann 99e0197086 Clean up loplugin:stringview
...after 3d236177be "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-14 16:06:01 +02:00
Stephan Bergmann e3706663a9 Clean up loplugin:stringadd
...after 3d236177be "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-14 15:53:18 +02:00
Stephan Bergmann 8195c98dba Fix loplugin:stringconcatauto
...after af2879e434 "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-14 13:54:26 +02:00
Stephan Bergmann 3b35199a1b Drop now-redundant %select
...after 3d236177be "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-13 19:23:18 +02:00
Stephan Bergmann 5956cecdf6 Adapt CompilerTest_compilerplugins_clang to recent Clang
...where at least my recent Clang 16 trunk build now started to fail after
af2879e434 "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-13 15:37:24 +02:00
Mike Kaganski af2879e434 Deduplicate stringconcat more
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-13 07:18:41 +02:00
jsala b26793b907 tdf#147021 REVERT Use std::size() instead of SAL_N_ELEMENTS() macro
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-12 19:43:08 +02:00
Mike Kaganski 3d236177be Deduplicate O(U)StringConcatenation
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-10-11 12:46:01 +02:00
Bjoern Michaelsen eb1294a607 unwrap SwDelChr to plain SfxHint
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-25 20:01:53 +02:00