summaryrefslogtreecommitdiff
path: root/compilerplugins
AgeCommit message (Collapse)Author
2023-06-06add unit test for loplugin:staticmethodsNoel Grandin
Change-Id: Ied72c83dbc364f96e5b78a3cb915b23a1751ac0e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152646 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-06-05Adapt compilerplugins to Clang 17 trunk "Remove llvm::Optional"Stephan Bergmann
(<https://github.com/llvm/llvm-project/commit/397f2e9ebee8d8e45547e90dd05228d7f965df67>) Change-Id: I51acda5951f8250d1a1b47e1c2612199ae7338a2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152618 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-06-04Remove unused starmathdatabase::Identify_Color_HTMLJulien Nabet
Seems to be unused since 88c343b50a1de197394e3e22bf82ff455386a80b "Corrected my previous mess on mathml export with color export 2. Now only exports HTML4 colors and others are treated as #RRGGBB. Now mathml can import #RGB colors. " in 2020 Change-Id: Iac006383146afaa62775e6e76fa203925dce51d3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152585 Reviewed-by: Julien Nabet <serval2412@yahoo.fr> Tested-by: Jenkins
2023-06-03Remove unused SmStructureNode::SetSubNodesBinMo with plain pointers (starmath)Julien Nabet
and keep the remaining one which uses unique_ptr Change-Id: I0e4e4aff5c202897a27dfef97750c14c3c5736bb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152581 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2023-06-03Styles preview cache cleanup on exitSzymon Kłos
Change-Id: I28929d4137008ebcca1733837d0b2112b6859a89 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152563 Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com> Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Szymon Kłos <szymon.klos@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152576 Tested-by: Jenkins
2023-06-03Styles preview widget should cache imagesSzymon Kłos
Change-Id: I3ee370e5d3ef4227681c4a973ac6f24f9aa241e1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152556 Tested-by: Caolán McNamara <caolan.mcnamara@collabora.com> Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152575
2023-05-20loplugin:unusedmethodsNoel Grandin
Change-Id: Ief95f111350808f010539bb733a553007d30a9df Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152006 Reviewed-by: Tomaž Vajngerl <quikee@gmail.com> Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-05-19loplugin:unnecessaryvirtualNoel Grandin
Change-Id: I3a3d4debd83f1a6452721ce704b6b88622b38109 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152004 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-05-19loplugin:virtualdeadNoel Grandin
Change-Id: I089fd6b9281cc35768462e83a7e18588f357df4e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152003 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-05-09merge GalleryFileStorage with GalleryBinaryEngineNoel Grandin
Change-Id: Id948627873db9c646d1a81784dd16f6aa1c2063b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151553 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-05-09merge GalleryFileStorageEntry with GalleryBinaryEngineEntryNoel Grandin
Change-Id: I21b3f49cdf04b021931ab9e1171bfffa5cd76e1f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151552 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-05-09merge GalleryStorageLocations with GalleryBinaryStorageLocationsNoel Grandin
Change-Id: Icf9a942047f212132d7b543cd1b1a857f8f95223 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151551 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-05-06update loplugin:stringview* for o3tl::iterateCodePointsNoel Grandin
And change o3tl::iterateCodePoints to use sal_Int32 for its second param, to integrate better with places where the parameter comes from an UNO API, which cannot use std::size_t Change-Id: I7b9dd2c9bc7f48e6c4a912f039f1b5dae7beae69 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151421 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-05-05Adapt loplugin:unnecessarygetstr to libc++Stephan Bergmann
> [CPT] compilerplugins/clang/test/unnecessarygetstr.cxx > error: 'error' diagnostics expected but not seen: > File compilerplugins/clang/test/unnecessarygetstr.cxx Line 119 (directive at compilerplugins/clang/test/unnecessarygetstr.cxx:118): unnecessary call to 'getStr' when passing to string constructor [loplugin:unnecessarygetstr] because libcxx's <string> declares > template <__enable_if_t<__is_allocator<_Allocator>::value, int> = 0> > _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(const _CharT* __s) and > template <__enable_if_t<__is_allocator<_Allocator>::value, int> = 0> > _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(const _CharT* __s, const _Allocator& __a) instead of single > basic_string(const charT* s, const Allocator& a = Allocator()) Change-Id: I8d64b140618337adfba01c02d5d02fda093628f2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151392 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-05-04Adapt loplugin:randedforcopy to libc++ std::vector<bool>Stephan Bergmann
Seen unhelpful > sc/source/core/data/dpoutput.cxx:882:10: error: Loop variable passed by value, pass by reference instead, e.g. 'const const reference&' [loplugin:rangedforcopy] > for (const auto bCompact: aRowCompactFlags) > ^~~~~~~~~~~~~~~~~~~~ on macOS Change-Id: I9854e2498950951efc640bf31741229631e00e87 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151393 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-05-01replace SwFrameFormats with sw::FrameFormats<SwFrameFormat*>Bjoern Michaelsen
- SwFrameFormats is now completely replaced by stronger typed sw::FrameFormats<>, thus remove it Change-Id: I7e655a83ba8cf01d1e68dccd1804c167e8daca9c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150455 Tested-by: Jenkins Reviewed-by: Bjoern Michaelsen <bjoern.michaelsen@libreoffice.org>
2023-04-24loplugin:unnecessarygetstr extend to more std::string checkingNoel Grandin
suggested by mike kaganski Change-Id: I5f5f254142767aca45a6101abdd84a0163ca6a34 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150936 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-04-24loplugin:unnecessarygetstr extend to createFromAsciiNoel Grandin
idea from mike kaganski Change-Id: I0ecb9cad091d7a048d2ddae73165bf22748f3872 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150907 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-04-21loplugin:unnecessarygetstr extend to checking std::string::c_strNoel Grandin
Change-Id: I17398e2a6a31a2c98ba8e54b5c8045f22aee8759 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150749 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-04-17loplugin:stringadd: Adapt O[U]StringBuffer ctor detection for WindowsStephan Bergmann
...where sal_Int32 is not int, so a literal argument like 16 actually calls the O[U]StringBuffer(T length, std::enable_if_t<std::is_integral_v<T>, int> = 0) overload Change-Id: I1d151efbc723cbfa76690e02491b05a9a4147e91 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150473 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-04-17Adapt expected diagnostics to WindowsStephan Bergmann
...where std::size_t is unsigned long long Change-Id: Icfe3927deaf4ffe57ac218ec109864852913cf31 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150474 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-04-14loplugin:stringviewparam improvementsNoel Grandin
improve the check by checking for methods that exclude using string_view, rather than checking for methods that __can__ use string_view, which leads to exposing some holes in our o3tl/string_view.hxx coverage. Change-Id: Ic9dd60441c671f502692f9cd2a1bb67301c4b960 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150277 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-04-12loplugin:stringview whitelist getLength and isEmptyNoel Grandin
Change-Id: I38f3410c0b25ff579879b9de1f266af4d8fd51e6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150256 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-04-12loplugin:stringview and stringviewparam, whitelist equalsAsciiLNoel Grandin
since we have a o3tl::equalsAscii that can handle that Change-Id: I0ae3b81cd5b4d97a0aef92cb6586cf365ee042b0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150239 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-04-11loplugin:unnecessarygetstr check for OUString::number facilitiesNoel Grandin
These were fixed by mike kaganski, but add to the plugin to prevent future mistakes Change-Id: I09b4b094a74e02399e017ccf5631c0d68052344a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150215 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-04-10Drop SvStream::WriteCharPtrMike Kaganski
WriteOString is a better replacement Change-Id: Ic431b9aeb98d19fe61cff71360eee555105cc2bf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150192 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-04-09new loplugin:unnecessarygetstrNoel Grandin
which prevents constructing unnecessary temporaries via getStr() Change-Id: I9ca70893a10e954b5ee0e6ad6098660ee24c2bef Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150170 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-04-06loplugin:stringadd also check O[U]StringBuffersNoel Grandin
For similar code sequences that can be improved. Also move containsComment from collapseif plugin code to plugin.cxx so we can use it from stringadd. Change-Id: Ie07d9aedf2c31cb0b2080e1b8584294d7046a8e1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149217 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-04-05Adapt expected test output to recent ClangStephan Bergmann
...after 90c590812eecb3a0eb2748a132e304fa6c0ea0ad "Simplify O(U)String::number implementation" Change-Id: I3f5d7b1ff41a6d55293f15f15fd67bd5d2e69d69 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150045 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-04-05Simplify O(U)String::number implementationMike Kaganski
Change-Id: I059f0324597a90aee01c95170a48ac5578f3caee Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150037 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-03-23loplugin:stringview: Constructing O[U]String from O[U]StringLiteral is cheapStephan Bergmann
...so don't warn about those, as requested in the comment at <https://gerrit.libreoffice.org/c/core/+/149254/8#message-6430dc5397ab7b60bf4e78e6856b44ab6cd72c97> "tdf#154319: fix TOC field codes parsing" Change-Id: I25989cd4b42bc3fe9062a8a0d6896d32a18635d3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149417 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-03-18loplugin:stringadd use more O[U]StringCharNoel Grandin
Change-Id: I196e4539ad430a39415eff9d7170b33df7228230 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149062 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-03-17loplugin:rangedforcopy: Assume non-reference structured binding is intentionalStephan Bergmann
See pending <https://gerrit.libreoffice.org/c/core/+/149026> "tdf#148008: do not proceed after the marked range" for a use case. Change-Id: Ief7cbb215068b6f5428c16a72896ef5612204128 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149056 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-03-17Avoid loplugin:unusedmember crash for templated offsetofStephan Bergmann
Change-Id: I6cbac308d2911a502381067398d72136ca2b5ae3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149045 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-03-16Prepare compilerplugins for C++23 `if consteval`Stephan Bergmann
...for which clang::IfStmt::getCond returns null Change-Id: I8b86a033d52de87dedbdf6d867f2b3d3f57c1b5a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148979 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-03-16Remove empty commentStephan Bergmann
...which I had added as part of 0025fa723afb9f6a0d94b9b3185ea14da18f1bd5 "Enable loplugin:unnecessaryparen for integer and Boolean literals", and where I apparently wanted to include a link but forgot to do so (and no longer know what link that would have been) Change-Id: I245725fea80ee0e13d76026656d433d5c42e4c19 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148975 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-03-16Adapt loplugin:implicitboolconversion to _G_STR_NONNULLStephan Bergmann
...from glib2-devel-2.76.0-1.fc38.x86_64, causing > libreofficekit/source/gtk/lokdocview.cxx:390:28: error: implicit conversion (IntegralCast) from 'bool' to 'int' [loplugin:implicitboolconversion] > pLOEvent->m_pCommand = g_strdup(pCommand); > ^~~~~~~~~~~~~~~~~~ > /usr/include/glib-2.0/glib/gstrfuncs.h:212:35: note: expanded from macro 'g_strdup' > const char *const __str = _G_STR_NONNULL (___str); \ > ^~~~~~~~~~~~~~~~~~~~~~~ > /usr/include/glib-2.0/glib/gstrfuncs.h:157:34: note: expanded from macro '_G_STR_NONNULL' > #define _G_STR_NONNULL(x) ((x) + !(x)) > ^~~~ Change-Id: Iec20b20992a61fd48155f338a10dc313411448f8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148948 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-03-10improve loplugin:unnecessarylockingNoel Grandin
to find more locking we can remove Change-Id: Ief7bc5ec2a1ff31f22a0ad366910b7fcc4725818 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148599 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-03-09Fix typoAndrea Gelmini
Change-Id: Ie69dd2bacbd1f1680d82ad113b707cca24950d2d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148471 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2023-03-08new loplugin:unique2optionalNoel Grandin
I used this plugin to find places where we could inline a small child object into a parent object, saving allocation overhead. Moving it directly into store/ because it is not intended to be run under normal circumstances, needs hand-holding. Change-Id: I7245eef3dba187988bb9d4a39fd80624f46355d4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148455 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-03-06The mentioned bug is fixed in Clang 17 trunk nowStephan Bergmann
Change-Id: Idb62b1b71a9f6fefc9225706655ca016304f1c42 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148191 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-03-02Record loplugin:unreffun false positive caused by a Clang bugStephan Bergmann
(see the comments at <https://gerrit.libreoffice.org/c/core/+/146634/7#message-5164bcbdb4efa4711f001ce05b670b592392d853> "test: Use css::awt::XExtentdedToolkit::addTopWindowListener()" for how this caused an issue in the wild) Change-Id: Id5ec77885db45d039aedc7e13d714aaa96572e91 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148076 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-02-28Remove compilerplugins/clang/test/cppunitassertequals.hxxStephan Bergmann
...which isn't needed anymore to suppress warnings from other plugins like loplugin:external ever since 45c06838e95c94445359536d84c6328fa8b17a66 "only unit-test one loplugin at a time". Also, the declaration of the function test in cppunitassertequals.hxx had already started to deviate from its definition in cppunitassertequals.cxx. Change-Id: I3fbc8a9a805bd5bc4d8afbf958edff04b89add3f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148010 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-02-28Extend loplugin:cppunitassertequals to CPPUNIT_ASSERT_LESS etc.Stephan Bergmann
(Just in case, even though this doesn't find any actual issues in the code for now.) Change-Id: I80b8b0a647e89fdb6a4f0f4363fa1c3df8e5ddeb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147942 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-02-23Extend loplugin:cppunitassertequals to more argument typesStephan Bergmann
Change-Id: Ic2990ebc2e4a9a36dcd3f90c5f634ca7dd225d52 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147491 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-02-15clean up SwRefMarkFieldUpdate a bitBjoern Michaelsen
- remove SwRefMarkFieldUpdate: * it has only one unused field * replace with a plain SwPtrMsgPoolItem - hint constness: * SwUndoFieldFromDoc: make ctor arg hint const * DocumentFieldsManager: make UpdateField arg hint const * however, seeing this hint is: a/ constructed on the stack, but b/ stored as pointer in undo likely it would be best to remove it altogether. For now, make it at least static, so that there is no use after free. Change-Id: Ica51a2a2ce19e1938c3a367e9b4a9e01bbb75374 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147030 Tested-by: Jenkins Reviewed-by: Bjoern Michaelsen <bjoern.michaelsen@libreoffice.org>
2023-02-03Fix misuse of TagDecl::hasDefinitionStephan Bergmann
...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-01-31loplugin:unusedfieldsNoel Grandin
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-30loplugin:virtualdeadNoel Grandin
GetPDFAnchorStructureElementId was added in commit 6e5d59c2ca696, 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-30Missing include for llvm::OptionalStephan Bergmann
...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>