summaryrefslogtreecommitdiff
path: root/compilerplugins
AgeCommit message (Collapse)Author
2019-12-05New loplugin:unusedmemberStephan Bergmann
* See comment at head of compilerplugins/clang/unusedmember.cxx for description. * Moved isAllRelevantCodeDefined from loplugin:fakebool to PluginHandler for reuse. (Made it a member function so that it can reuse its two RecordCompleteMap instances across different loplugins. Probably safer lifecycle-wise to have them as PluginHandler members than to have them as static local variables in function isAllRelevantCodeDefined.) * Need Plugin::ignoreLocation overload for TypeLoc now, thanks to UnusedMember::VisitElaboratedTypeLoc. * UETT_PreferredAlignOf was split off UETT_AlignOf with <https://github.com/ llvm/llvm-project/commit/6822bd79ac43f267613f1615bf60407103e24dba> "PR26547: alignof should return ABI alignment, not preferred alignment". * RecursiveASTVisitor::TraverseAlignedAttr traverses into the attribute's argument only since <https://github.com/llvm/llvm-project/commit/ f26d551387f032e05e5e6551605b150f38c3f5b2> "Do not look through pack expansions when looking for unexpanded parameter packs". Change-Id: Ic2702b03d4567fa2533333766de7920f3c524a69 Reviewed-on: https://gerrit.libreoffice.org/84416 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-12-04Adapt compilerplugins/clang/test/getstr.cxx to C++20 deleted ostream <<Stephan Bergmann
Change-Id: I5315a7c682774edb3d16035b6fd3361e1c2bc3f5 Reviewed-on: https://gerrit.libreoffice.org/84409 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-12-04drop dbgutil SdrItemBrowser FloatingWindowCaolán McNamara
Change-Id: I7a4ca90ea23271e7b6f60d7e47e4513978d3222d Reviewed-on: https://gerrit.libreoffice.org/84356 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2019-12-03desktop: disable callback handling while changing the viewAshod Nakashian
When changing the view, some components are disabled and re-enabled. This triggers a flood of invalidations that then result in rendering requests. For each rendering the view is set, which triggers more invalidations. The Sidebar suffers from this, and it causes cpu pegging. This fix prevents this issue by disabling all callbacks during setView. Change-Id: If6b93b2ab31f568a0761f15d945a43de1bc2d4d0 Reviewed-on: https://gerrit.libreoffice.org/84184 Reviewed-by: Ashod Nakashian <ashnakash@gmail.com> Tested-by: Ashod Nakashian <ashnakash@gmail.com> Reviewed-on: https://gerrit.libreoffice.org/84226 Tested-by: Jenkins Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
2019-12-01Introduce o3tl::optional as an alias for std::optionalStephan Bergmann
...with a boost::optional fallback for Xcode < 10 (as std::optional is only available starting with Xcode 10 according to <https://en.cppreference.com/w/cpp/compiler_support>, and our baseline for iOS and macOS is still Xcode 9.3 according to README.md). And mechanically rewrite all code to use o3tl::optional instead of boost::optional. One immediate benefit is that disabling -Wmaybe-uninitialized for GCC as per fed7c3deb3f4ec81f78967c2d7f3c4554398cb9d "Slience bogus -Werror=maybe-uninitialized" should no longer be necessary (and whose check happened to no longer trigger for GCC 10 trunk, even though that compiler would still emit bogus -Wmaybe-uninitialized for uses of boost::optional under --enable-optimized, which made me ponder whether this switch from boost::optional to std::optional would be a useful thing to do; I keep that configure.ac check for now, though, and will only remove it in a follow up commit). Another longer-term benefit is that the code is now already in good shape for an eventual switch to std::optional (a switch we would have done anyway once we no longer need to support Xcode < 10). Only desktop/qa/desktop_lib/test_desktop_lib.cxx heavily uses boost::property_tree::ptree::get_child_optional returning boost::optional, so let it keep using boost::optional for now. After a number of preceding commits have paved the way for this change, this commit is completely mechanical, done with > git ls-files -z | grep -vz -e '^bin/find-unneeded-includes$' -e '^configure.ac$' -e '^desktop/qa/desktop_lib/test_desktop_lib.cxx$' -e '^dictionaries$' -e '^external/' -e '^helpcontent2$' -e '^include/IwyuFilter_include.yaml$' -e '^sc/IwyuFilter_sc.yaml$' -e '^solenv/gdb/boost/optional.py$' -e '^solenv/vs/LibreOffice.natvis$' -e '^translations$' -e '\.svg$' | xargs -0 sed -i -E -e 's|\<boost(/optional)?/optional\.hpp\>|o3tl/optional.hxx|g' -e 's/\<boost(\s*)::(\s*)(make_)?optional\>/o3tl\1::\2\3optional/g' -e 's/\<boost(\s*)::(\s*)none\>/o3tl\1::\2nullopt/g' (before committing include/o3tl/optional.hxx, and relying on some GNU features). It excludes some files where mention of boost::optional et al should apparently not be changed (and the sub-repo directory stubs). It turned out that all uses of boost::none across the code base were in combination with boost::optional, so had all to be rewritten as o3tl::nullopt. Change-Id: Ibfd9f4b3d5a8aee6e6eed310b988c4e5ffd8b11b Reviewed-on: https://gerrit.libreoffice.org/84128 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-11-30loplugin:mergeclassesNoel Grandin
don't filter out "Base", reveals some interesting stuff Change-Id: I62a36e70bce8e6e1346f78395dc1d32fbd8a0ddd Reviewed-on: https://gerrit.libreoffice.org/84107 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-11-30loplugin:unusedmethodsNoel Grandin
Change-Id: Ie92b52eabc425a4688b6d4f7cfb547ad59f4afc4 Reviewed-on: https://gerrit.libreoffice.org/84106 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-11-30...and take implicit const casts into accountStephan Bergmann
...following up on 4f8a744c4fcf2c69462af19bd807fee32413158d "Make loplugin:unnecessaryparen treat member expressions consistently" Change-Id: I444d2995e88990c3c6fa2b912ef68032daf2cad9 Reviewed-on: https://gerrit.libreoffice.org/84112 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-11-29Make loplugin:unnecessaryparen treat member expressions consistentlyStephan Bergmann
Stumbled across a warning starting to get emitted for some !(p->x) when I temporarily changed x from boost::optional (which has a member operator!) to std::optional (which instead implicitly uses a member conversion operator to bool). (That is, for the new static int foo3(Foo2 & foo) { (void) !(foo.p); (void) !(foo.b); (void) !(foo.n); return (foo.p) ? 1 : 0; } test, the first, third, and fourth body lines never warned, while the second one erroneously warned without this fix.) Change-Id: I60f6941aaa3a73db0f1373c954e47aa68d703170 Reviewed-on: https://gerrit.libreoffice.org/84079 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-11-29unnecessary virtualCaolán McNamara
Change-Id: I918a8c51e55919555108c075d396b04b4dcafbd1 Reviewed-on: https://gerrit.libreoffice.org/84061 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2019-11-27disable checkconfigmacros compiler check for UnpackedTarballLuboš Luňák
When building code using Skia, macros for Skia are defined in config_skia.h, and Skia uses #ifdef to check for them, but that's ok, and we neither care nor can do much about it. Change-Id: I0029f0d82b26638e0395efec06c03303333ec1e9
2019-11-26loplugin:indentation no longer needs to blacklist binaryurp/source/bridge.cxxStephan Bergmann
...since bfaf25f59352eb81c7f53c741995a82021f4b0ff "Silence -Werror,-Wunused-variable (clang-cl)" taught it about leading [[maybe_unused]]. Change-Id: I0d3baf66623c50cfb35d3923273fb1129f66213f Reviewed-on: https://gerrit.libreoffice.org/83728 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-11-26Adapt to clang::MaterializeTemporaryExpr::GetTemparyExpr renameStephan Bergmann
...in <https://github.com/llvm/llvm-project/commit/ b0561b3346e7bf0ae974995ca95b917eebde18e1> "[NFC] Refactor representation of materialized temporaries" Change-Id: I02fbf6765f9713e4d457f07521129cc9d8db5751 Reviewed-on: https://gerrit.libreoffice.org/83669 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-11-26loplugin:implicitboolconversion: Filter out bool -> std::atomic<bool>Stephan Bergmann
...as used since patch set 8 of <https://gerrit.libreoffice.org/#/c/81542/8> "WIP: tdf#120006 New Document converter" Change-Id: I79c2237a2e5839162272c0d49bdb4d87c9e35102 Reviewed-on: https://gerrit.libreoffice.org/83655 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-11-25use -Xclang -fno-pch-timestamp also for Clang PCH in compilerpluginsLuboš Luňák
We already use that normally, the build system should generally take care of this by gmake dependencies. One exception is system headers, but those usually do not really change even if their timestamps do, so this should prevent Clang from giving an error about this after system headers update (which should be harmless, and if it isn't then I suppose either something else such as compiler upgrade should trigger a rebuild, or cleaning needs to be done manually). Change-Id: I60581c0d2d3233aadc60e1c90bd62cb9ad684ba2 Reviewed-on: https://gerrit.libreoffice.org/83662 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2019-11-22Extend loplugin:external to warn about classesStephan Bergmann
...following up on 314f15bff08b76bf96acf99141776ef64d2f1355 "Extend loplugin:external to warn about enums". Cases where free functions were moved into an unnamed namespace along with a class, to not break ADL, are in: filter/source/svg/svgexport.cxx sc/source/filter/excel/xelink.cxx sc/source/filter/excel/xilink.cxx svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx All other free functions mentioning moved classes appear to be harmless and not give rise to (silent, even) ADL breakage. (One remaining TODO in compilerplugins/clang/external.cxx is that derived classes are not covered by computeAffectedTypes, even though they could also be affected by ADL-breakage--- but don't seem to be in any acutal case across the code base.) For friend declarations using elaborate type specifiers, like class C1 {}; class C2 { friend class C1; }; * If C2 (but not C1) is moved into an unnamed namespace, the friend declaration must be changed to not use an elaborate type specifier (i.e., "friend C1;"; see C++17 [namespace.memdef]/3: "If the name in a friend declaration is neither qualified nor a template-id and the declaration is a function or an elaborated-type-specifier, the lookup to determine whether the entity has been previously declared shall not consider any scopes outside the innermost enclosing namespace.") * If C1 (but not C2) is moved into an unnamed namespace, the friend declaration must be changed too, see <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71882> "elaborated-type-specifier friend not looked up in unnamed namespace". Apart from that, to keep changes simple and mostly mechanical (which should help avoid regressions), out-of-line definitions of class members have been left in the enclosing (named) namespace. But explicit specializations of class templates had to be moved into the unnamed namespace to appease <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92598> "explicit specialization of template from unnamed namespace using unqualified-id in enclosing namespace". Also, accompanying declarations (of e.g. typedefs or static variables) that could arguably be moved into the unnamed namespace too have been left alone. And in some cases, mention of affected types in blacklists in other loplugins needed to be adapted. And sc/qa/unit/mark_test.cxx uses a hack of including other .cxx, one of which is sc/source/core/data/segmenttree.cxx where e.g. ScFlatUInt16SegmentsImpl is not moved into an unnamed namespace (because it is declared in sc/inc/segmenttree.hxx), but its base ScFlatSegmentsImpl is. GCC warns about such combinations with enabled-by-default -Wsubobject-linkage, but "The compiler doesn’t give this warning for types defined in the main .C file, as those are unlikely to have multiple definitions." (<https://gcc.gnu.org/onlinedocs/gcc-9.2.0/gcc/Warning-Options.html>) The warned-about classes also don't have multiple definitions in the given test, so disable the warning when including the .cxx. Change-Id: Ib694094c0d8168be68f8fe90dfd0acbb66a3f1e4 Reviewed-on: https://gerrit.libreoffice.org/83239 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-11-21loplugin:unusedfieldsNoel Grandin
Change-Id: Ic4cb8444123864fdaee64960f00a05b3066ae5fc Reviewed-on: https://gerrit.libreoffice.org/83387 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-11-20loplugin:redundantfcast: Don't warn about cast from braced-init-listStephan Bergmann
...in non-deduced context. That means that the necessary cast in 84322944980f6e2f9d4a531de7a6803797156968 "Simplify sequence initialization" (cf. <https://gerrit.libreoffice.org/#/c/82974/4/>) no longer causes a false positive, and doesn't need to use comphelper::OUStringLiteralList. Change-Id: I788da61cc0be82d2166653760e527bb18e366c99 Reviewed-on: https://gerrit.libreoffice.org/83291 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-11-20loplugin:unusedmethodsNoel Grandin
Change-Id: Id5f7a9c34d1d159dd0f930a4ce66871bdd3796c1 Reviewed-on: https://gerrit.libreoffice.org/83305 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-11-20loplugin:unusedmethodsNoel Grandin
Remove a filtering step in the python script that was hiding some results Change-Id: Id94268f150902405ab197c077f18aaedf98845fc Reviewed-on: https://gerrit.libreoffice.org/83256 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-11-19Fix loplugin:fakebool (clang-cl)Stephan Bergmann
...where it failed with > In file included from C:/lo-clang/core/extensions/source/activex/SOActiveX.cxx:23: > C:/lo-clang/core/extensions/source/activex/SOActiveX.h(160,1): error: VarDecl, use "bool" instead of 'BOOL' (aka 'int') [loplugin:fakebool] > BEGIN_MSG_MAP(CSOActiveX) > ^~~~~~~~~~~~~~~~~~~~~~~~~ > C:/PROGRA~2/MIB055~1/2019/COMMUN~1/VC/Tools/MSVC/1423~1.281/atlmfc/include\atlwin.h(2692,3): note: expanded from macro 'BEGIN_MSG_MAP' > BOOL bHandled = TRUE; \ > ^~~~~~~~~~~~~~~~~~~~ and no idea why I did the getImmediateMacroCallerLoc call in 913d34ec6b8fdb2796f76ce90fee51ade2051189 "Extend loplugin:salbool to loplugin:fakebool". Removing it doesn't cause any issues at least with my local Linux and Windows --enable-compiler-plugins builds. Change-Id: I64bd906a34e724aefe980ce8ff2b675e8fb2ec8a Reviewed-on: https://gerrit.libreoffice.org/83212 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-11-19loplugin:unusedenumconstantsNoel Grandin
Change-Id: Iecfe5d0ba8d7b287aad798daf2c3e0a7c1a5f1d3 Reviewed-on: https://gerrit.libreoffice.org/83191 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-11-19Fix loplugin:fakebool (clang-cl)Stephan Bergmann
...where it failed with > [build CXX] setup_native/source/win32/customactions/sellang/sorttree.cxx > C:/lo-clang/core/setup_native/source/win32/customactions/sellang/sorttree.cxx(43,5): error: CStyleCastExpr, suspicious cast from 'LRESULT' (aka 'long long') to 'BOOL' (aka 'int') [loplugin:fakebool] > TreeView_SortChildren(hwndTV, dicts, TRUE); > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > C:/PROGRA~2/WI3CF2~1/10/Include/10.0.18362.0/um\commctrl.h(5227,5): note: expanded from macro 'TreeView_SortChildren' > (BOOL)SNDMSG((hwnd), TVM_SORTCHILDREN, (WPARAM)(recurse), (LPARAM)(HTREEITEM)(hitem)) > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > C:/lo-clang/core/setup_native/source/win32/customactions/sellang/sorttree.cxx(43,5): error: conversion from 'LRESULT' (aka 'long long') to 'BOOL' (aka 'int') [loplugin:fakebool] > TreeView_SortChildren(hwndTV, dicts, TRUE); > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > C:/PROGRA~2/WI3CF2~1/10/Include/10.0.18362.0/um\commctrl.h(5227,11): note: expanded from macro 'TreeView_SortChildren' > (BOOL)SNDMSG((hwnd), TVM_SORTCHILDREN, (WPARAM)(recurse), (LPARAM)(HTREEITEM)(hitem)) > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > C:/PROGRA~2/WI3CF2~1/10/Include/10.0.18362.0/um\prsht.h(73,16): note: expanded from macro 'SNDMSG' > #define SNDMSG ::SendMessage > ^ (And the improved check in FakeBool::VisitImplicitCastExpr nicely removes the need to list all the individual false/true macros.) Change-Id: I815172f32f493bba336008aaacc00545e61ada7b Reviewed-on: https://gerrit.libreoffice.org/83215 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-11-19Rename GlyphCache to FreetypeManagerJan-Marek Glogowski
And while at it remove the unneeded getPlatformGlyphCache abstraction. Change-Id: Id5cad751eda9e6bf177dfb4816280d7c5af7066a Reviewed-on: https://gerrit.libreoffice.org/83125 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
2019-11-18Missing includesStephan Bergmann
...with recent Clang trunk Change-Id: I9ea0f1692df8d269356df0d6b20ea2173f632425 Reviewed-on: https://gerrit.libreoffice.org/83086 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-11-18compilerplugins: fix ambiguous type warningsChris Sherlock
Errors were: /home/chris/repos/libreoffice-latest/compilerplugins/clang/sharedvisitor/analyzer.cxx:80:40: error: reference to 'PointerType' is ambiguous if (auto const t = type->getAs<PointerType>()) /home/chris/repos/libreoffice-latest/compilerplugins/clang/external.cxx:61:44: error: reference to 'PointerType' is ambiguous else if (auto const t3 = t1->getAs<PointerType>()) Change-Id: Ia5b7add8f2b3160fa3198ed127785bdd61c74796 Reviewed-on: https://gerrit.libreoffice.org/83030 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2019-11-17Fix typosAndrea Gelmini
Change-Id: I9251205c47f26be7695496b5887b849fcf1335f1 Reviewed-on: https://gerrit.libreoffice.org/82814 Reviewed-by: Julien Nabet <serval2412@yahoo.fr> Tested-by: Julien Nabet <serval2412@yahoo.fr>
2019-11-17loplugin:unusedmethodsNoel Grandin
Change-Id: I04deb5a1dee5b8a9a4508d28552ffe0b67288993 Reviewed-on: https://gerrit.libreoffice.org/82977 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-11-17Extend loplugin:external to warn about enumsStephan Bergmann
To mitigate the dangers of silently breaking ADL when moving enums into unnamed namespaces (see the commit message of 206b5b2661be37efdff3c6aedb6f248c4636be79 "New loplugin:external"), note all functions that are affected. (The plan is to extend loplugin:external further to also warn about classes and class templates, and the code to identify affected functions already takes that into account, so some parts of that code are not actually relevant for enums.) But it appears that none of the functions that are actually affected by the changes in this commit relied on being found through ADL, so no adaptions were necessary for them. (clang::DeclContext::collectAllContexts is non-const, which recursively means that External's Visit... functions must take non-const Decl*. Which required compilerplugins/clang/sharedvisitor/analyzer.cxx to be generalized to support such Visit... functions with non-const Decl* parameters.) Change-Id: Ia215291402bf850d43defdab3cff4db5b270d1bd Reviewed-on: https://gerrit.libreoffice.org/83001 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-11-16loplugin:singlevalfieldsNoel Grandin
Change-Id: I31fd6b251dee9d1ee1a9ac59964034d0136e1f3e Reviewed-on: https://gerrit.libreoffice.org/82978 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-11-16Improve loplugin:redundantpreprocessor performance a bitStephan Bergmann
...and add a minimal test for it Change-Id: Ia6c61e41a7e60fd01c639e893c34bd9d215c1513 Reviewed-on: https://gerrit.libreoffice.org/82983 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-11-16Fix loplugin::Entry ODR violationStephan Bergmann
(caused crashes with CLANGDEBUG=1 in compilerplugins/Makefile-clang.mk) Change-Id: I43ba276f03c87c97b624a59f2b368422fd5b0a7b Reviewed-on: https://gerrit.libreoffice.org/82982 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-11-16loplugin:unusedfieldsNoel Grandin
Change-Id: I021cd75685a091c1afd3ff3c144def6f9a784bee Reviewed-on: https://gerrit.libreoffice.org/82972 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-11-15loplugin:external: Don't warn for injected friend functionsStephan Bergmann
Change-Id: I35c0930f6ab8ae5d96e433958cf29791c78d5e31 Reviewed-on: https://gerrit.libreoffice.org/82802 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-11-15Fix loplugin:fakebool for Objective CStephan Bergmann
...ignoring uses of "BOOL" in Objective C for now Change-Id: I3eb48dc8d2592285f03f75dc7bc1b21e2383644d Reviewed-on: https://gerrit.libreoffice.org/82803 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-11-15loplugin:external: Extend comment about the perils of moving a functionStephan Bergmann
...into an unnamed namespace. (And make it into a "leading comment" that precedes the code it appeartains to. It had orignally been meant as a "trailing comment" that follows the code it appeartains to, and had been idented further to indicate that, but clang-format unhelpfully breaks such indentation of trailing comments that need to be preceded by a line break due to line length limitations.) Change-Id: I6a71a6b8e11ba641acfb542142fe14b4b6445f51 Reviewed-on: https://gerrit.libreoffice.org/82792 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-11-15loplugin:external: Note all other declarations of the same entityStephan Bergmann
...not just those that came before Change-Id: Ib10ca34cb2ee63124999d56bb00d94f000f33ea1 Reviewed-on: https://gerrit.libreoffice.org/82782 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-11-15Fix loplugin:consttobool for assert on macOSStephan Bergmann
...which internally uses __builtin_expect and thus caused > core/include/com/sun/star/uno/Any.hxx:750:13: error: implicit conversion of constant 1 of type 'long' to 'bool'; use 'true' instead [loplugin:consttobool] > assert(false); // this cannot happen > ^~~~~~~~~~~~~ > /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include/assert.h:93:6: note: expanded from macro 'assert' > (__builtin_expect(!(e), 0) ? __assert_rtn(__func__, __FILE__, __LINE__, #e) : (void)0) > ^~~~~~~~~~~~~~~~~~~~~~~~~ (See 216bcceee1ba908f617deb3f2404aff8085d5358 "Special handling of __builtin_expect in boolean expressions" for a similar fix in loplugin:literaltoboolconversion.) Change-Id: I4cf4b21006176c908995f5753dd0a38165383d87 Reviewed-on: https://gerrit.libreoffice.org/82773 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-11-15Add loplugin:consttobool assert-related testsStephan Bergmann
...and improve diagnostics a bit Change-Id: I3233aa1752620ddbe6fbeff93b15565921f0bc2e Reviewed-on: https://gerrit.libreoffice.org/82767 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-11-15Silence -Werror,-Wsometimes-uninitializedStephan Bergmann
Change-Id: I491566c9f1fbbaabf9b050150b1567c5354227d0 Reviewed-on: https://gerrit.libreoffice.org/82752 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-11-14New loplugin:consttoboolStephan Bergmann
...to: "Find implicit conversions from non-'bool' constants (e.g., 'sal_False') to 'bool'". Due to how FALSE is defined as just #define FALSE (0) (i.e., a literal of type 'int') but TRUE is defined as #define TRUE (!FALSE) (i.e., an implicit conversion from 'int' to 'bool') in GLib (see the comment in ConstToBool::VisitImplicitCastExpr), we get more warnings about uses of 'TRUE' than of 'FALSE'. For example, in libreofficekit/source/gtk/lokdocview.cxx there is a warning about the 'TRUE' in g_main_context_iteration(nullptr, TRUE); but not about the 'FALSE' in g_main_context_iteration(nullptr, FALSE); (where the parameter of 'g_main_context_iteration' is of type 'gboolean'). Lets live with that asymmetry for now... (Besides the issues addressed directly in this commit, it also found the two bogus asserts at 7e09d08807b5ba2fd8b9831557752a415bdad562 "Fix useless assert(true) (which would never fire)" and 122a0be8ae480473bd1d7f35e197a2529f4621e3 "Fix useless assert(true) (which would never fire)", plus 5f0d6df7f57ae281fe161e61c7f25d67453fddd2 "Use two-argument form of static_assert".) Change-Id: Id77322de9f94b85a7b65608a03e0e9865d14467b Reviewed-on: https://gerrit.libreoffice.org/82667 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-11-14Improve error messageStephan Bergmann
(When temporarily taking a plugin out of the shared plugin by modifying its leading > #ifndef LO_CLANG_SHARED_PLUGINS line I often forget about a trailing > #endif // LO_CLANG_SHARED_PLUGINS line, which then caused a hard to understand > [GEN] compilerplugins/clang/sharedvisitor/sharedvisitor.cxx > Incorrect version '' failure. This way, at least somehow mention the name of the problematic plugin to give a bit of a clue.) Change-Id: I9a9178ba0d7a32f448e91076376989f088ea70f8 Reviewed-on: https://gerrit.libreoffice.org/82657 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-11-13Extend loplugin:salbool to loplugin:fakeboolStephan Bergmann
...checking for unnecessary uses of more "fake bool" types. In the past, some of the checks involving the types of variables or data members, or the return types of functions, issued warnings that required surrounding code to be changed too (e.g., when changing the signature of a function whose address was taken). These checks have been tightened now to not warn in such cases (which avoids warnings that require changes to additional code, or changes that might even be impossible to make, at the cost of being less aggressive about removing all unnecessary uses of those "fake bool" types). Change-Id: I70eb75039817cda34ed611387ee27dc5f36a3e2e Reviewed-on: https://gerrit.libreoffice.org/82554 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-11-12Clarify loplugin:external behavior for const(expr) varsStephan Bergmann
Change-Id: I4a649f9c9ed2015ed9b32a153060df9770b20403 Reviewed-on: https://gerrit.libreoffice.org/82493 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-11-11Make base of loplugin::FunctionAddress more flexibleStephan Bergmann
(I'm planning to use it for a FilteringRewritePlugin.) And while at it, base its current uses on FilteringPlugin. Change-Id: I0acdcc6cb0b3a434b425405c8c438dbf65e4d3cb Reviewed-on: https://gerrit.libreoffice.org/82451 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-11-08Use more efficient NamedDecl::getNameStephan Bergmann
Change-Id: I764b254180809c7ee020d5115e4b9e50e0227c09 Reviewed-on: https://gerrit.libreoffice.org/82321 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-11-07remove some unused gettersCaolán McNamara
Change-Id: Iaa556491add4a7674f90ecfbf8e44f0b1d6583ee Reviewed-on: https://gerrit.libreoffice.org/82198 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2019-11-07drop unused TreeView::set_top_entryCaolán McNamara
Change-Id: I70171b95baf29486c253e7d388ba59385da1d929 Reviewed-on: https://gerrit.libreoffice.org/82196 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2019-11-07loplugin:unusedmethodsNoel Grandin
Change-Id: I65354c7476dfaede1a607441d7c1b0c7ad038df4 Reviewed-on: https://gerrit.libreoffice.org/82186 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-11-07loplugin:unusedfieldsNoel Grandin
Change-Id: Ic1c0a2144f39373f93384bccbfc74356cac65ba0 Reviewed-on: https://gerrit.libreoffice.org/82185 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>