summaryrefslogtreecommitdiff
path: root/cpputools
AgeCommit message (Collapse)AuthorFilesLines
2020-07-01Upcoming improved loplugin:staticanonymous -> redundantstatic: cpputoolsStephan Bergmann1-1/+1
Change-Id: I301e5008316fcc714b7ce955f8c262a8cbed3f65 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97550 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-12-18sal_Char->char in cppcanvas..cuiNoel Grandin1-3/+3
Change-Id: I7e9fa7011f1e0bf143f86055718c772caebf8ee6 Reviewed-on: https://gerrit.libreoffice.org/85397 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-11-22Extend loplugin:external to warn about classesStephan Bergmann1-0/+8
...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-08-31Add version resource to executables where it was missingMike Kaganski1-0/+2
Change-Id: Iee965c3f720827b20347f6228e891562c8295d22 Reviewed-on: https://gerrit.libreoffice.org/78327 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2019-05-13fix wrong SET/QUERY flags passed to uno::ReferenceNoel Grandin1-1/+1
By creating deleted methods for the wrong calls. Avoids the compiler needing to construct a temporary Change-Id: I3b8c648d6bb22d22827bf74f21ea5a2a17fc0f6a Reviewed-on: https://gerrit.libreoffice.org/72103 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-04-20Fix typoAndrea Gelmini1-1/+1
Change-Id: I1032065e6b4dd14ea9aa426375080da416abb180 Reviewed-on: https://gerrit.libreoffice.org/70993 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2018-12-28Reduce OUString operations and use indexed getTokenMatteo Casalin1-9/+15
Change-Id: I41bc361cbbbf1a446138354eb7bf80729a79bc1f Reviewed-on: https://gerrit.libreoffice.org/65673 Tested-by: Jenkins Reviewed-by: Matteo Casalin <matteo.casalin@yahoo.com>
2018-10-19clang-tidy readability-misleading-indentationNoel Grandin1-1/+1
Change-Id: I4673fc7c694924b41d048a1918ddb8b0e0af1f79 Reviewed-on: https://gerrit.libreoffice.org/61935 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-10-09Extend loplugin:redundantinline to catch inline functions w/o external linkageStephan Bergmann1-2/+2
...where "inline" (in its meaning of "this function can be defined in multiple translation units") thus doesn't make much sense. (As discussed in compilerplugins/clang/redundantinline.cxx, exempt such "static inline" functions in include files for now.) All the rewriting has been done automatically by the plugin, except for one instance in sw/source/ui/frmdlg/column.cxx that used to involve an #if), plus some subsequent solenv/clang-format/reformat-formatted-files. Change-Id: Ib8b996b651aeafc03bbdc8890faa05ed50517224 Reviewed-on: https://gerrit.libreoffice.org/61573 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-09-17New loplugin:externalStephan Bergmann1-1/+1
...warning about (for now only) functions and variables with external linkage that likely don't need it. The problems with moving entities into unnamed namespacs and breaking ADL (as alluded to in comments in compilerplugins/clang/external.cxx) are illustrated by the fact that while struct S1 { int f() { return 0; } }; int f(S1 s) { return s.f(); } namespace N { struct S2: S1 { int f() { return 1; } }; int f(S2 s) { return s.f(); } } int main() { return f(N::S2()); } returns 1, both moving just the struct S2 into an nunnamed namespace, struct S1 { int f() { return 0; } }; int f(S1 s) { return s.f(); } namespace N { namespace { struct S2: S1 { int f() { return 1; } }; } int f(S2 s) { return s.f(); } } int main() { return f(N::S2()); } as well as moving just the function f overload into an unnamed namespace, struct S1 { int f() { return 0; } }; int f(S1 s) { return s.f(); } namespace N { struct S2: S1 { int f() { return 1; } }; namespace { int f(S2 s) { return s.f(); } } } int main() { return f(N::S2()); } would each change the program to return 0 instead. Change-Id: I4d09f7ac5e8f9bcd6e6bde4712608444b642265c Reviewed-on: https://gerrit.libreoffice.org/60539 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-07-16Add missing sal/log.hxx headersGabor Kelemen1-0/+1
rtl/string.hxx and rtl/ustring.hxx both unnecessarily #include <sal/log.hxx> (and don't make use of it themselves), but many other files happen to depend on it. This is a continuation of commit 6ff2d84ade299cb3d14d4110e4cf1a4b8070c030 to be able to remove those unneeded includes. This commit adds missing headers to every file found by: grep -FwL sal/log.hxx $(git grep -Elw 'SAL_INFO|SAL_INFO_IF|SAL_WARN|SAL_WARN_IF|SAL_DETAIL_LOG_STREAM|SAL_WHERE|SAL_STREAM|SAL_DEBUG') to directories from connectivity to cui Change-Id: I9903c10d0a04bbeb93d0f776d1d252b152459499 Reviewed-on: https://gerrit.libreoffice.org/57408 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
2017-10-23loplugin:includeform: cpputoolsStephan Bergmann2-5/+5
Change-Id: I72982ad64a546421e8b6dd07f42c088c87d1dfcd
2017-09-29loplugin:flatten check for throw in then clauseNoel Grandin1-6/+3
also make the plugin ignore the case where we have var decl's in the clause we want to flatten, which could lead to problematic extension of variable lifetime Change-Id: I3061f7104e8c6a460bf74f5eac325a516ec50c59 Reviewed-on: https://gerrit.libreoffice.org/42889 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-09-21loplugin:flatten in connectivity..desktopNoel Grandin1-46/+44
Change-Id: Iff59d3049ba40b4338ef8eec67d08a96b0834d2b Reviewed-on: https://gerrit.libreoffice.org/42578 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-07-13use more OUString::operator== comphelper..cuiNoel Grandin1-2/+2
Change-Id: Ib5f3037249152be2b66acf347d1a0c236dc7adfa Reviewed-on: https://gerrit.libreoffice.org/39888 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-06-05spelling instanciate -> instantiateNoel Grandin1-1/+1
Change-Id: Ic1393da64328c0dc7e2860334b204139bf537d81 Reviewed-on: https://gerrit.libreoffice.org/38401 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-04-21gbuild: Remove MSVC 2013 legacy codeDavid Ostrovsky1-1/+0
Uwinapi is discontinued. Change-Id: I063b4d0d8fab2d60de168e960a63b8181158ac01 Reviewed-on: https://gerrit.libreoffice.org/23198 Reviewed-by: David Ostrovsky <david@ostrovsky.org> Tested-by: David Ostrovsky <david@ostrovsky.org>
2017-03-25Fix typosAndrea Gelmini1-1/+1
Change-Id: I56e429ff1b8ee55ccb8df16002b509770762172c Reviewed-on: https://gerrit.libreoffice.org/35618 Reviewed-by: Julien Nabet <serval2412@yahoo.fr> Tested-by: Julien Nabet <serval2412@yahoo.fr>
2017-03-11Fix typosAndrea Gelmini1-1/+1
Change-Id: Ic54e808956e5cf4e8079942c0ff799f802cd4b6c Reviewed-on: https://gerrit.libreoffice.org/35053 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-02-28new loplugin unoanyNoel Grandin1-1/+1
Change-Id: I5d6c4a67cb2a09e7cd5bd620c6b262d188701b89 Reviewed-on: https://gerrit.libreoffice.org/34714 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-02-24makeAny->Any in cppuhelper..cuiNoel Grandin1-1/+1
Change-Id: Ia54e6e9b71df68bd04c304a0bb02da8ebac74420 Reviewed-on: https://gerrit.libreoffice.org/34603 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-02-21loplugin:subtlezeroinit: cpputoolsStephan Bergmann1-1/+1
Change-Id: Ib4a04395f067a3a288a57547daa734c4c9768eb8
2017-02-15Some simplifications, using UNO_QUERY_THROWStephan Bergmann1-12/+2
Change-Id: Icefafed29c9702730181f61bb03296b5b474bfa6 Reviewed-on: https://gerrit.libreoffice.org/34269 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-01-26Remove dynamic exception specificationsStephan Bergmann1-11/+3
...(for now, from LIBO_INTERNAL_CODE only). See the mail thread starting at <https://lists.freedesktop.org/archives/libreoffice/2017-January/076665.html> "Dynamic Exception Specifications" for details. Most changes have been done automatically by the rewriting loplugin:dynexcspec (after enabling the rewriting mode, to be committed shortly). The way it only removes exception specs from declarations if it also sees a definition, it identified some dead declarations-w/o-definitions (that have been removed manually) and some cases where a definition appeared in multiple include files (which have also been cleaned up manually). There's also been cases of macro paramters (that were used to abstract over exception specs) that have become unused now (and been removed). Furthermore, some code needed to be cleaned up manually (avmedia/source/quicktime/ and connectivity/source/drivers/kab/), as I had no configurations available that would actually build that code. Missing @throws documentation has not been applied in such manual clean-up. Change-Id: I3408691256c9b0c12bc5332de976743626e13960 Reviewed-on: https://gerrit.libreoffice.org/33574 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-01-19New loplugin:dynexcspec: Add @throws documentation, cpputoolsStephan Bergmann1-0/+4
Change-Id: I7a9ac7cdc3d5e19dc63a4711a0ce2c23054367e1
2016-03-11tdf#91794 remove OSL_DEBUG_LEVEL > 1 conditionalsRohan Kumar1-21/+3
I replaced OSL_DEBUG_LEVEL > 1 with OSL_DEBUG_LEVEL > 0 and made sure that it doesn't break the build Change-Id: I9febeed949a24d7bc5afb13dedde03fd812b5b20 Reviewed-on: https://gerrit.libreoffice.org/23077 Reviewed-by: Björn Michaelsen <bjoern.michaelsen@canonical.com> Tested-by: Björn Michaelsen <bjoern.michaelsen@canonical.com>
2016-02-09Remove excess newlinesChris Sherlock1-6/+0
A ridiculously fast way of doing this is: for i in $(pcregrep -l -M -r --include='.*[hc]xx$' \ --exclude-dir=workdir --exclude-dir=instdir '^ {3,}' .) do perl -0777 -i -pe 's/^ {3,}/ /gm' $i done Change-Id: Iebb93eccbee9e4fc5c4380474ba595858a27ac2c Reviewed-on: https://gerrit.libreoffice.org/22224 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Chris Sherlock <chris.sherlock79@gmail.com>
2015-11-10loplugin:nullptr (automatic rewrite)Stephan Bergmann1-4/+4
Change-Id: I65186f574c8bbc4004eb40a95a33aea1ea3f4e96
2015-11-09new loplugin: oncevarNoel Grandin1-4/+2
Change-Id: If57390510dde4d166be3141b9f658a7453755d3f Reviewed-on: https://gerrit.libreoffice.org/19815 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
2015-11-06loplugin:stringconstant: elide explicit ctor usage (automatic rewrite)Stephan Bergmann1-3/+3
Change-Id: Iefb181010ad8514227dfe617379eeaccb8d70152
2015-10-30use uno::Reference::set method instead of assignmentNoel Grandin1-1/+1
Change-Id: I080668f86f0ab8b3bba857ee21411f907ae285c4
2015-10-12Replace "SAL_OVERRIDE" with "override" in LIBO_INTERNAL_ONLY codeStephan Bergmann1-2/+2
Change-Id: I2ea407acd763ef2d7dae2d3b8f32525523ac8274
2015-07-17tdf#88206 replace cppu::WeakImplHelper* etc.Takeshi Abe1-3/+3
with the variadic variants, in cppcanvas / cpputools / cui. Change-Id: Ic28d0830ab86555494004c27b1468de2ea6825dc Reviewed-on: https://gerrit.libreoffice.org/17119 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
2015-05-29loplugin:loopvartoosmallNoel Grandin1-1/+1
Change-Id: Icbe68b31d4ab04ca3cd9f572e3598413946a75c7
2015-03-29Clean up template-parameter-dependent C-style castsStephan Bergmann1-1/+1
Change-Id: Ia1ab134a0afbeeb3ae40264bd4233a47df26b734
2014-12-12cpputools: Use appropriate OUString functions on string constantsStephan Bergmann1-6/+2
Change-Id: Iea0f7b4ee3ef867a061c159d90efb5d210ae92a4
2014-11-05markup with event type not checker typeCaolán McNamara1-1/+1
Change-Id: I14c0c5d90b67000cb4fe9e6be647854abfe784da
2014-10-28coverity#982593 experiment with silencing Infinite loopCaolán McNamara1-0/+1
etc. Change-Id: I1548d60280ab4f74fe023d026435a05f7865b516
2014-05-29remove more unnecesary OUString constructor useNoel Grandin1-2/+2
when throwing exceptions Change-Id: I6edfb6b6745499f802b0e3c0e096a36fb7c32aac
2014-05-27remove unnecessary use of OUString constructor when throwingNoel Grandin1-2/+2
Change-Id: I4a3f3f911dcfbf88696053215a2fb7a94678244c
2014-05-23remove boilerplate in UNO Exception constructor callsNoel Grandin1-1/+1
Now that we have default values for Exception constructor params, remove lots of boilerplate code. Change-Id: I620bd641eecfed38e6123873b3b94aaf47922e74
2014-05-23add default value for Context param in uno::Exception constructorsNoel Grandin1-26/+14
and all it's subtypes, which is almost never used, so this allows us to simplify lots of call sites. Change-Id: I0b05793ea2bdd1027679f63252d42ce4af89433b
2014-05-08various: sal_Bool->boolNoel Grandin2-21/+21
Change-Id: I30fa5227f30373f95060148f269450d2945c1bb9
2014-03-26First batch of adding SAL_OVERRRIDE to overriding function declarationsStephan Bergmann1-2/+2
...mostly done with a rewriting Clang plugin, with just some manual tweaking necessary to fix poor macro usage. Change-Id: I71fa20213e86be10de332ece0aa273239df7b61a
2014-02-26cppuhelper: retrofit std::exception into overriding exception specsStephan Bergmann1-4/+4
Change-Id: I56e32131b7991ee9948ce46765632eb823d463b3
2013-11-22remove unnecessary use of OUString constructor in equalsIgnoreAsciiCaseNoel Grandin1-1/+1
Convert code like: sType.equalsIgnoreAsciiCase(OUString("VIEW")); to: sType.equalsIgnoreAsciiCase("VIEW"); Change-Id: I6fb47e6a83b561c7e5a25da76b63606a3174858d
2013-11-11convert OUString compareToAscii == 0 to equalsAsciiNoel Grandin1-6/+6
Convert code like aStr.compareToAscii("XXX") == 0 to aStr.equalsAscii("XXX") which is both easier to read and faster. Change-Id: I448abf58f2fa0e7715dba53f8e8825ca0587c83f
2013-10-31Convert indexOf->startsWith and lastIndexOf->endsWithNoel Grandin1-2/+2
This is both an optimisation and a cleanup. This converts code like aStr.indexOf("XX") == 0 to aStr.startsWith("XX") and converts code like aStr.lastIndexOf("XXX") == aStr.getLength() - 3 to aStr.endsWith("XXX") Note that in general aStr.lastIndexOf("X") == aStr.getLength() - 1 converts to aStr.isEmpty() || aStr.endsWith("X") so I used the surrounding context to determine if aStr could be empty when modifying the code. Change-Id: I22cb8ca7c2a4d0288b001f72adb27fd63af87669
2013-10-23remove RTL_CONSTASCII_(U)STRINGPARAMChr. Rossmanith1-41/+24
Change-Id: I0bce921bfc7102b9a33b1c87eee3ddec0ebaed7b Signed-off-by: Stephan Bergmann <sbergman@redhat.com>, with one little typo fix
2013-10-01Remove odd "bootstrapping" of acceptor/connector/binaryurp componentsStephan Bergmann1-43/+0
...that had effectively been in uno.exe since c460c0ccb6f389339b2ff9e57a101557c30df676 "initial import," for whatever reason it was supposed to be good for, but would no longer work anyway at least since 644c33a857c46d540202189228f519946dc33833 "fdo#67313: Use "lo" suffix for private URE libs." Change-Id: I98c038a4d9d963eefc542c91247cf263d7d988bb