summaryrefslogtreecommitdiff
path: root/solenv/CompilerTest_compilerplugins_clang.mk
AgeCommit message (Collapse)Author
2018-08-29new loplugin:oustringbufferNoel Grandin
look for places where we are appending the temporary result of adding strings together, to an OUStringBuffer, where we could rather call append repeatedly and avoid the temporary creation Change-Id: I481435124291ac7fb54b91a78344a9fe5b379a82 Reviewed-on: https://gerrit.libreoffice.org/59708 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-08-22new loplugin:conststringfieldNoel Grandin
Look for const string fields which can be static, and mostly convert them to OUStringLiteral And add a getLength() method to OUStringLiteral to make the transition easier. Remove dead code in XclExpRoot::GenerateDefaultEncryptionData, default password is never empty. Change-Id: Iae75514d9dbb87289fd5b016222f640abe755091 Reviewed-on: https://gerrit.libreoffice.org/59204 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-07-27new loplugin:stringloop, and applied in variousNoel Grandin
look for OUString being appended to in a loop, better to use OUStringBuffer to accumulate the results. Change-Id: Ia36e06e2781a7c546ce9cbad62727aa4c5f10c4b Reviewed-on: https://gerrit.libreoffice.org/58092 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-06-11new loplugin:shouldreturnboolNoel Grandin
look for methods returning only 1 and/or 0, which (most of the time) should be returning bool. Off by default, because some of this is a matter of taste Change-Id: Ib17782e629888255196e89d4a178618a9612a0de Reviewed-on: https://gerrit.libreoffice.org/54379 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-06-01Improve loplugin:unreffunStephan Bergmann
...to avoid a false positive in --enable-qt5 > [build CXX] vcl/qt5/Qt5Widget.cxx > /home/sbergman/lo/core/vcl/qt5/Qt5Widget.cxx:466:21: error: Unreferenced function declaration [loplugin:unreffun] > friend QWidget* createQt5Widget(Qt5Frame& rFrame, QWidget* parent, Qt::WindowFlags f); > ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > 1 error generated. Change-Id: I01e47bc5f5147916737d62fe18ce5312a0221a3f Reviewed-on: https://gerrit.libreoffice.org/55189 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-04-11new loplugin:unusedvariablemoreNoel Grandin
collection of heuristics to look for local variables that are never read from i.e. do not contribute to the surrounding logic This is an expensive plugin, since it walks up the parent tree, so it is off by default. Change-Id: Ib8ba292241bd16adf299e8bba4502cb473513a06 Reviewed-on: https://gerrit.libreoffice.org/52450 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-04-03new loplugin:dbgunhandledexceptionNoel Grandin
enforce that DBG_UNHANDLED_EXCEPTION is called first in a catch block, otherwise it cannot do it's job properly Change-Id: I906436c6861212c44f8f21552ccbceb54f15c6e1 Reviewed-on: https://gerrit.libreoffice.org/52303 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-04-02give DBG_UNHANDLED_EXCEPTION_WHEN an area parameterNoel Grandin
and rename it to DBG_UNHANDLED_EXCEPTION, to make it more like the SAL_WARN-type macros. Use some macro magic to deal with different numbers of arguments. Update the sallogareas plugin to check the area parameter of DBG_UNHANDLED_EXCEPTION. Change-Id: Ie790223244c3484f41acb3679c043fb9b438e7c4 Reviewed-on: https://gerrit.libreoffice.org/52073 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-02-23new loplugin:doubleconvert to with ColorData workNoel Grandin
Change-Id: Ib8f2ef485f548645c4b0e7cf080b72b28c4e278d Reviewed-on: https://gerrit.libreoffice.org/50226 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-02-22rename redundantcopy loplugin to redundantfcastNoel Grandin
Change-Id: I34e28a30a4f1fd264c18c901cd94094531543271
2018-01-23new loplugin: pointerboolNoel Grandin
look for possibly bogus implicit conversions to bool when passing (normally pointer) args to bool params. this plugin comes in the wake of a couple of bugs caused by refactoring, where some of the call sites were not currently updated. Of the changes, the following are real bugs: desktop/../dp_persmap.cxx StartInputFieldDlg in sw/../fldmgr.cxx which occurred as a result of commit 39d719a80d8c87856c84e3ecd569d45fa6f8a30e Date: Tue May 3 11:39:37 2016 +0200 tdf#99529 sw: don't pop up input field dialog before inserting field CSerializationURLEncoded::encode_and_append in forms/../serialization_urlencoded.cxx XclExpCFImpl::XclExpCFImpl in sc/../xecontent.cxx I have no idea how to properly fix this, just made a guess. SwDocTest::test64kPageDescs in sw/qa/core/uwriter.cxx which looks like a simple copy/paste error. Change-Id: I795ebd5ef485a1d36863dc27fe13832989f5a441 Reviewed-on: https://gerrit.libreoffice.org/48291 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-01-19new loplugin:emptyifNoel Grandin
Change-Id: I1092115a0ceb3a5e6680a4b724b129f98a892c42 Reviewed-on: https://gerrit.libreoffice.org/48128 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-01-12Enable loplugin:cstylecast for some more casesStephan Bergmann
...mostly of C-style casts among arithmetic types, and automatically rewrite those into either static_cast or a functional cast (which should have identical semantics, but where the latter probably looks better for simple cases like casting a literal to a specific type, as in "sal_Int32(0)" vs. "static_cast<sal_Int32>(0)"). The main benefit of reducing the amount of C-style casts across the code base further is so that other plugins (that have not been taught about the complex semantics of C-style cast) can pick those up (cf. the various recent "loplugin:redundantcast" commits, which address those findings after this improved loplugin:cstylecast has been run). Also, I found some places where a C-style cast has probably been applied only to the first part of a larger expression in error (because it's easy to forget parentheses in cases like "(sal_uInt16)VOPT_CLIPMARKS+1"); I'll follow up on those individually. The improved loplugin:cstylecast is careful to output either "(performs: static_cast)" or "(performs: functional cast)", so that compilerplugins/clang/test/cstylecast.cxx can check that the plugin would automatically rewrite to one or the other form. To allow fully-automatic rewriting, this also required loplugin:unnecessaryparen to become a rewriting plugin, at least for the parens-around-cast case (where "((foo)bar)" first gets rewritten to "(static_cast<foo>(bar))", then to "static_cast<foo>(bar)". Rewriting could probably be added to other cases of loplugin:unnecessaryparen in the future, too. (The final version of this patch would even have been able to cope with 361dd2576a09fbda83f3ce9a26ecb590c38f74e3 "Replace some C-style casts in ugly macros with static_cast", so that manual change would not have been necessary after all.) Change-Id: Icd7e319cc38eb58262fcbf7643d177ac9ea0220a Reviewed-on: https://gerrit.libreoffice.org/47798 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-12-21new loplugin: convertlongNoel Grandin
merge the droplong and convertuintptr into one new plugin. Limit the analysis to looking at var decl's, since that seems to be safest proposition, even if that too needs some careful analysis. Change-Id: Id005baaf05cfb157ce44a06a1c81f08559a07d1f Reviewed-on: https://gerrit.libreoffice.org/46851 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-12-15once off loplugin: unusedindexNoel Grandin
Change-Id: Ifdf5da1f014c4f130eafed475c6781c029d54f1d
2017-12-04new loplugin salcall: remove unnecessary SAL_CALLNoel Grandin
In this first commit, I use the plugin to verify the consistency of our SAL_CALL annotations. The point being to make the next commit more mechanical in nature, purely using the rewriter. There are various chunks of unix-only code that have never had to be compiled by MSVC, hence the inconsistencies. In bridges, I had to inline some typedefs to make the verification code happy, since it cannot see into typedefs. Change-Id: Iec6e274bed857febf7295cfcf5e9f21fe4a34da0 Reviewed-on: https://gerrit.libreoffice.org/45502 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-11-23loplugin:simplifybool for negation of comparison operatorNoel Grandin
Change-Id: Ie56daf560185274754afbc7a09c432b5c2793791 Reviewed-on: https://gerrit.libreoffice.org/45068 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-11-10Forgot to add compilerplugins/clang/test/unusedvariablecheck.cxxStephan Bergmann
...to CompilerTest_compilerplugins_clang in 871e420cbbd8afe064e7bbc0ed426db3b01fddfa "Fix loplugin::unusedvariablecheck check for std classes" Change-Id: I011d8ff73189dfa85adb4cbd50e556f25be9b79c Reviewed-on: https://gerrit.libreoffice.org/44592 Reviewed-by: Stephan Bergmann <sbergman@redhat.com> Tested-by: Stephan Bergmann <sbergman@redhat.com>
2017-11-09new loplugin simplifydynamiccastNoel Grandin
simplify dynamic_cast followed by static_cast Change-Id: I965afcf05d1675094cfde53d3590a0fd00f26279 Reviewed-on: https://gerrit.libreoffice.org/44460 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-11-08Suppress loplugin:unnecessaryoverride...Stephan Bergmann
...when a class derives from multiple (non-virtual) instances of one base class, and the override disambiguates which of those instances' member to call. That was the case with SwXTextDocument::queryAdapter (sw/source/uibase/uno/unotxdoc.cxx), where SwXTextDocument derives from cppu::OWeakObject through both SwXTextDocumentBaseClass and SfxBaseModel, but calling queryAdapter through a pointer to SwXTextDocumentBaseClass apparently needs to call OWeakObject::queryAdapter on the second, SfxBaseModel-inherited OWeakObject base instance, or else CppunitTest_sw_macros_test fails. Who knows what other instances of similar non-unnecessary overrides have been removed with the help of broken loplugin:unnecessaryoverride, for which there were no tests that started to fail... Turns out .clang-format lacked "ReflowComments: false" to not break the special "// expected-error {{...}}" etc. comments in compilerplugins/clang/test/. Also, use a better location to report loplugin:unnecessaryoverride, to keep clang-format and loplugin:unnecessaryoverride from fighting over how to split lines and where to put the comment in compilerplugins/clang/test/unnecessaryoverride.cxx. Change-Id: I3b24df24369db12f8ec1080d6c9f7b70ff561a16 Reviewed-on: https://gerrit.libreoffice.org/44418 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-10-25new loplugin:dodgyswitchNoel Grandin
and fix bug in ScriptDocument::getTitle which has been there since commit e304ba66f4aba5cc55612508b5738a1ed26a7904 Date: Thu Mar 15 14:59:30 2007 +0000 INTEGRATION: CWS basmgr02 (1.1.2); FILE ADDED plugin is off by default since it uses expensive parentStmt() calls Change-Id: Id0f16baec48e0381e0083594d7e59b58b023da2f Reviewed-on: https://gerrit.libreoffice.org/43750 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-10-21Avoid loplugin:faileddyncast for "unnecessary", up-casting dynamic_castStephan Bergmann
Change-Id: Iecb943db0aff7ffc21cc2f6adb625be369255b32 Reviewed-on: https://gerrit.libreoffice.org/43606 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-10-06Improve performance of loplugin:commaoperatorStephan Bergmann
...by avoiding calls to parentStmt, thereby also improving the precision of exactly which comma operators to ignore (which turned up a handful more finds). Also added tests. Change-Id: Ie74f824fd7f54131aab09b59086452fb4f3ff827 Reviewed-on: https://gerrit.libreoffice.org/43181 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-10-03new loplugin:blockblockNoel Grandin
Change-Id: I7b68b70fa4c7234e8882f7627026959a596968fd Reviewed-on: https://gerrit.libreoffice.org/43025 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-09-23new loplugin unnecessarycatchthrowNoel Grandin
Change-Id: Iabab71ee076227bc38447ec109afaea1e53a86a6 Reviewed-on: https://gerrit.libreoffice.org/42643 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-09-22compilerplugins: add test for badstaticsMichael Stahl
Change-Id: Ibdb3144c0510ed723a01ca28d7cdcd6b21caec54 Reviewed-on: https://gerrit.libreoffice.org/42596 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Stahl <mstahl@redhat.com>
2017-09-21fix 'make solenv' test failure on clang-3.8Noel Grandin
clang-3.8 and clang trunk differ in how they represent ranged-for which leads to a test failure Change-Id: Ia8965802260fdc946d3a705c6fef82d98eeb8230
2017-09-21loplugin:unusedfields, fix var taking refNoel Grandin
Change-Id: I0ea1f0c7488c140fca9f64de326c6ac588ece925
2017-09-20new loplugin flattenNoel Grandin
look for places where we can flatten the control flow in a method by exiting early with a throw, ie. instead of if (cond) stuff(); else throw ex; we change it to: if (!cond) throw ex; stuff(); Change-Id: I8b6bdf883b325807c7e3a3ef698e4f4606e7d38b
2017-09-18clang plugins: this test fails on 32-bit LinuxMichael Stahl
... where sal_uIntPtr and sal_uInt32 are both "unsigned long"; disable test for now. Change-Id: I8357bf425ab5d9166cd45ba5fb81ec6c1fac957a error: 'error' diagnostics expected but not seen: File compilerplugins/clang/test/convertuintptr.cxx Line 15: cast from 'sal_uIntPtr' (aka 'unsigned {{.+}}') to 'sal_uInt32' (aka 'unsigned {{.+}}') [loplugin:convertuintptr] File compilerplugins/clang/test/convertuintptr.cxx Line 16: cast from 'sal_uIntPtr' (aka 'unsigned {{.+}}') to 'sal_uInt32' (aka 'unsigned {{.+}}') [loplugin:convertuintptr]
2017-09-04new loplugin:redundantpointeropsNoel Grandin
Change-Id: I8428d86ea9628d69c2b40b36feee3da428a9fe1d Reviewed-on: https://gerrit.libreoffice.org/41787 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-08-18new loplugin:expressionalwayszeroNoel Grandin
The code in SvXMLExportItemMapper::exportXML was broken as far back as its introduction in commit 0c28e3c480a95c03b513c55f029b979bcd9c0401 "Move SvXMLAttrContainerItem to SVX, moved writer only code to sw" Change-Id: I90043ce8b7263aa56fd0883d350e29b97eeaf99b Reviewed-on: https://gerrit.libreoffice.org/41282 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-08-17loplugin:passstuffbyref ignore params that are assigned toNoel Grandin
makes writing nice code awkward sometimes. Also split plugin into two different plugins, the logic was getting tangled up. Change-Id: I232e314d29c766c160c29373988dc37a466505be
2017-08-17new loplugin convertuintptrNoel Grandin
an experiment to see if I can make the process of eliminating sal_uIntPtr a little easier Change-Id: I808185fbf18826cb9ab5612a7be4148d52045957
2017-08-16move deadclass plugin to storeNoel Grandin
<sberg> noelgrandin, and is loplugin:deadclass even sound? struct B { B(B const &) {} }; struct D: B { D(): B(*this) {} }; Change-Id: Idadd379b925aa6f9de6c625bffa8560ec4192ac7
2017-08-14new loplugin:droplongNoel Grandin
The types 'long' and 'unsigned long' are different sizes on different platforms, making them wholy unsuitable for portable code. And when I mean different sizes, I mean 64bit Linux and 64bit Windows have different bit sizes. Change-Id: Id4d8cd709bf71a3f85ed6515fae2b0a21ae8c25d Reviewed-on: https://gerrit.libreoffice.org/41130 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-08-11new loplugin:deadclassNoel Grandin
look for classes which only have copy/move constructors, and so are effectively dead Change-Id: I0b844f301e2200c2b40031856bfdb0b0e2c8f77d Reviewed-on: https://gerrit.libreoffice.org/41039 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-07-28loplugin:constparams handle constructorsNoel Grandin
had to change the structure of the plugin considerably, was too messy to structure it to do the calculations on a per-function basis Change-Id: I4edee7735f726101105c607368124a08dba21086 Reviewed-on: https://gerrit.libreoffice.org/40516 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-07-19CompilerTest_compilerplugins_clang: disable test failing with clang-3.8Miklos Vajna
10:28 <@vmiklos> noelgrandin: clang-3.8 is unhappy for the unusedfields plugin: https://pastebin.com/raw/MJ30aKcs 10:30 <@noelgrandin> vmiklos: ... probably best to just disable the unusedfields solenv testing in the .mk file Change-Id: I1873f1f76d7a7b0438002ffda9180abe582e07d7
2017-07-05new loplugin unnecessaryparenNoel Grandin
Change-Id: Ic883a07b30069ca6342d7521c8ad890f4326f0ec Reviewed-on: https://gerrit.libreoffice.org/39549 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-07-03loplugin:casttovoidStephan Bergmann
Change-Id: I427b15b35ef6e7c803cb8a00c961d35175ae8cb2
2017-06-30CompilerTest_compilerplugins_clang depends on boost_headersStephan Bergmann
...since 09031ef2fe89a8a6321ca89cca49f1587fe577e6 "Avoid getQualifiedNameAsString" Change-Id: Ic663153c3cfb3d7264a6614c4fa4edd71fe6235f
2017-06-29improve refcounting lopluginNoel Grandin
to find ref-counted classes being managed via other smart pointer classes. Hopefully prevent needing fixes like 642ae256ea5b8083ba0b3c097ca8ea52304b9cdb "ChangedUIEventListener is refcounted, mustn't be helt by unique_ptr" Change-Id: I6b0c5f8f87ce3546a8a1104ce1000470c09459bd Reviewed-on: https://gerrit.libreoffice.org/39378 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-06-29loplugin:oncevar variousNoel Grandin
Change-Id: I8b82d46d4688b1a59d6fe1b05da7d5c8dfc13ca6 Reviewed-on: https://gerrit.libreoffice.org/38766 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-06-23Sort listStephan Bergmann
Change-Id: I08882119972587b6c86ba0717cfc73d0fc4550e1
2017-06-20loplugin:unusedfields fix false positiveNoel Grandin
When the field in question is read from inside a constructor initializer. In the process, create some needed infrastructure in the plugin classes. Change-Id: I2f440efa6912801a236727c9fe3180404616958c Reviewed-on: https://gerrit.libreoffice.org/38960 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-06-13Generalize loplugin:stringcopy to loplugin:redundantcopyStephan Bergmann
(such redundant std::unique_ptr copies could happen when changing parts of the code base to make use of std::unique_ptr individually) Change-Id: Ib48a45a212f9426a775c7f379bc5d3c92230218a
2017-05-23enhance useuniqueptr lopluginNoel Grandin
teach it to look for the following sequence in a destructor: delete m_pfoo; m_pfoo = nullptr; Change-Id: Icd6271a63a024e32b53cc9e599f8f59952160380 Reviewed-on: https://gerrit.libreoffice.org/37900 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-05-19loplugin:stringcopyStephan Bergmann
Change-Id: Ib04ef019996888166c25ad140b7c718a173a782a
2017-04-28loplugin:salunicodeliteralStephan Bergmann
For the c-char in the u'...' literal, the preceding commits consistently use: * a simple-escape-sequence if the original code already used one * \0 for U+0000 * the (\ escaped, for ' and \) source character matching U+0020..7E (even if it is not a basic source character) * a consistently four-digit hexadecimal-escape-sequence otherwise, \xNNNN For non-surrogate code points, the last case could probably also use \uNNNN universal-character-names. However, for one, it isn't quite clear to me whether conversion of such to members of the execution chacacter set in character literals (in translation phase 5) is implementation-specific. And for another, the current C++ standard references the dated (no pun intended) ISO/IEC 10646-1:1993 specification, rather than the current ISO/IEC 10646:2014, and requires that a universal-characrer-name designate a character with a specific "character short name in ISO/IEC 10646", but I do not find a specification of a "short name" in ISO/IEC 10646:2014 and don't have access to ISO/IEC 10646-1:1993, so am not sure whether that would e.g. cover noncharacters like U+FFFF. (The only exception is one occurrence of u'\x6C' in bestFitOpenSymbolToMSFont, filter/source/msfilter/util.cxx, where it is clear from the context that the value denotes neither a Unicode code point nor a UTF-16 code unit, but rather an index into the Wingdings font glyph table.) Change-Id: If36b94168428ba1e05977c370aceaa7e90131e90