summaryrefslogtreecommitdiff
path: root/compilerplugins
AgeCommit message (Collapse)AuthorFilesLines
2019-12-17Avoid false positive lopluign:vclwidgets warningStephan Bergmann2-2/+17
...about calling delete for a std::atomic<T*>. It ultimately turned out that I didn't need such a std::atomic<T*> variable after all, but it can't hurt to have this fix for loplugin:vclwidgets anyway. Change-Id: I2ca058e9c39efa6c5386e6a320bed4bf8ab5f5d5 Reviewed-on: https://gerrit.libreoffice.org/85266 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-12-14sc: rowcol: convert mark dataNoel Grandin1-0/+3
with this patch I can finally load a 3201 column document Change-Id: I880d485b3f628836e7aed92c276e660466a3b19c Reviewed-on: https://gerrit.libreoffice.org/85139 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-12-13loplugin:unusedmethodsNoel Grandin1-141/+217
Change-Id: I8ad75d1251df4d6f8097aaa68e4ec92331e38ad4 Reviewed-on: https://gerrit.libreoffice.org/85077 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-12-13loplugin:singlevalfieldsNoel Grandin2-210/+159
Change-Id: Idec5a7a732d5dc868ad3f9a147e18ee9685645e2 Reviewed-on: https://gerrit.libreoffice.org/85076 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-12-13loplugin:unusedfieldsNoel Grandin4-563/+621
Change-Id: I28c8d60543d85ea878698a3e3661bbd5891ad9c7 Reviewed-on: https://gerrit.libreoffice.org/85075 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-12-12Fix typoAndrea Gelmini1-1/+1
Change-Id: I197a4e5ab4985c2d67ca8a83980069ba2622576a Reviewed-on: https://gerrit.libreoffice.org/85081 Reviewed-by: Julien Nabet <serval2412@yahoo.fr> Tested-by: Julien Nabet <serval2412@yahoo.fr>
2019-12-12Enable -Wdeprecated-copy-dtor where availableStephan Bergmann2-1/+4
We already get -Wdeprecated-copy (warning about implicitly defined copy functions that will in the future be deleted because other user-provided copy functions exist) automatically through -Wextra, where available. -Wdeprecated-copy-dtor (warning about implicitly defined copy functions that will in the future be deleted because of a user-provided dtor) is split off into its own warning excluded from -Wextra for somewhat unclear reasons, see the discussion at <https://gcc.gnu.org/bugzilla/buglist.cgi?quicksearch=88136> "-Wdeprecated-copy is draconian and shouldn't be in -Wall". But -Wdeprecated-copy-dtor has been useful in finding issues (esp. the Clang 10 trunk version, which, unlike the GCC 9 version, also finds copy functions that are implicitly defined because they are used from template instantiations), see 3e59716375a240576fd6d8759b32b4319506ed70 "Prevent BroadcastRecalcOnRefMoveHandler copies" and 4f98cd0f9ce9c2a331a5d34b3ef9d18f9bb6b235 "ScShapeChild has broken copy functions". We need to disable -Wdeprecated-copy-dtor in files included from external/boost, and in two compilerplugin/clang/test/ files. Change-Id: I74b159c3a046e23661473ddbfe53c92c4136a9db Reviewed-on: https://gerrit.libreoffice.org/85073 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-12-12loplugin:finalclassesNoel Grandin1-0/+18
Change-Id: Ia9865271cf0a75ebf4b885ff376f7d0a152b2555 Reviewed-on: https://gerrit.libreoffice.org/84925 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-12-11Fix typoAndrea Gelmini1-1/+1
Change-Id: Iffb9bcf5bfb18591dedfea62875bae76c772b7e2 Reviewed-on: https://gerrit.libreoffice.org/84994 Reviewed-by: Julien Nabet <serval2412@yahoo.fr> Tested-by: Julien Nabet <serval2412@yahoo.fr>
2019-12-11Recursively include unnamed inner classes in "layout heuristic"Stephan Bergmann2-1/+67
This covers both cases where the inner class is defined in the declaration of a non-static data member, as needed by clang-cl for > bridges/source/cpp_uno/msvc_win32_x86-64/except.cxx(799,19): error: unused class member [loplugin:unusedmember] > PVOID pExceptionObject; > ~~~~~~^~~~~~~~~~~~~~~~ > bridges/source/cpp_uno/msvc_win32_x86-64/except.cxx(801,19): error: unused class member [loplugin:unusedmember] > PVOID pThrowImageBase; > ~~~~~~^~~~~~~~~~~~~~~ as well as anonymous structs (even if there appears to be no need for that across the LO code base; they are part of C11 and a widely supported C++ extension). The newly added TODO will eventually need fixing, but I didn't find a way in Clang to tell whether a RecordDecl is defined as part of a FieldDecl, and the issue appears to be of no practical relevance for the current LO code base. Change-Id: I08cecddb9b4a70c3ca480d2d2ab1ea4f198011b2 Reviewed-on: https://gerrit.libreoffice.org/84967 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-12-11Extend loplugin:unusedmember "layout heuristic" to base classesStephan Bergmann2-7/+41
With clang-cl on Windows, where CPPU_GCC3_ALIGN expands to nothing, there were warnings about unsued Char1::c1 and Char2::c2 in cppu/source/uno/check.cxx (which were suppressed on Linux thanks to CPPU_GCC3_ALIGN(T) making the plugin's "layout heuristic" kick in for T). But Char1 and Char2 are also (indirect) bases of Char3, for which the heuristic kicks in thanks to a sizeof(Char3) expression. Extending the heuristic to base classes seems like a good improvement anyway, and happens to make the unwanted warnings on Windows go away. Change-Id: I1fac3104aa7a1745ccf2f23972953eaacbd45104 Reviewed-on: https://gerrit.libreoffice.org/84927 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-12-06Document fishy loplugin:fakebool behaviorStephan Bergmann1-0/+14
...as exploited in the change of LockingGuard (extensions/source/activex/SOActiveX.cxx) in 55e596956e56b175ab17b682e7c8ac7daeb9289a "loplugin:external (clang-cl)" Change-Id: I599ac72b68651fc733dd37c95ce9105c175fee9e Reviewed-on: https://gerrit.libreoffice.org/83995 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-12-05Fix typosAndrea Gelmini1-4/+4
Change-Id: I53b5433470c567b4d53979ecdb0cef3def7c9fc0 Reviewed-on: https://gerrit.libreoffice.org/84565 Reviewed-by: Julien Nabet <serval2412@yahoo.fr> Tested-by: Julien Nabet <serval2412@yahoo.fr>
2019-12-05loplugin:external: Check for DLLExportAttr also in VisitTagDeclStephan Bergmann1-16/+15
...to fix false clang-cl warnings like > C:/lo-clang/core/cppuhelper/source/compat.cxx(113,29): error: externally available entity 'ClassData' is not previously declared in an included file (if it is only used in this translation unit, put it in an unnamed namespace; otherwise, provide a declaration of it in an included file) [loplugin:external] > struct SAL_DLLPUBLIC_EXPORT ClassData { > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~ Change-Id: Iacf96569e27772aa9e27221619516b1fb84dd665 Reviewed-on: https://gerrit.libreoffice.org/84514 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-12-05New loplugin:unusedmemberStephan Bergmann6-111/+703
* 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 Bergmann1-3/+21
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 McNamara3-7/+0
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 Nakashian1-6/+0
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 Bergmann3-4/+4
...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 Grandin2-63/+137
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 Grandin2-111/+135
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 Bergmann2-2/+4
...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 Bergmann2-0/+33
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 McNamara1-2/+0
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ňák1-1/+2
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 Bergmann1-3/+0
...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 Bergmann14-19/+34
...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 Bergmann2-0/+41
...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ňák1-1/+3
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 Bergmann5-8/+20
...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 Grandin4-77/+79
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 Bergmann2-0/+103
...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 Grandin1-105/+15
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 Grandin3-22/+332
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 Bergmann1-1/+1
...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 Grandin4-2131/+2125
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 Bergmann1-12/+6
...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 Glogowski2-2/+2
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 Bergmann3-0/+5
...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 Sherlock2-2/+2
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 Gelmini1-1/+1
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 Grandin3-114/+66
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 Bergmann3-9/+316
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 Grandin3-141/+159
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 Bergmann2-4/+19
...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 Bergmann2-10/+10
(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 Grandin5-181/+189
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 Bergmann2-0/+48
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 Bergmann1-1/+4
...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 Bergmann1-1/+30
...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>