1612 Commits

Author SHA1 Message Date
Stephan Bergmann
ba8a70365e New loplugin:nestedunnamed
Change-Id: Ifb434589ef08428ce609bc7a40b015d4df13224c
Reviewed-on: https://gerrit.libreoffice.org/50048
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-02-21 08:09:46 +01:00
Noel Grandin
924c0e34fd loplugin:changetoolsgen in svx
and fix the regex in the plugin for matching += operator

Change-Id: I26b3e3fac1d4ef3e756cc9431b983b5f27ee76d6
Reviewed-on: https://gerrit.libreoffice.org/50037
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-02-21 06:04:19 +01:00
michael.weghorn
82a213880f Remove now unused libgetuid.so
Some scripts in which it was used have been removed
(commit e1082e45361a92a31adedcc3ed0a35c704bca543) and
the more reliable 'fakeroot' is now in use at all
other places where libgetuid.so was previously used
(s. tdf#115554).

Change-Id: I638e96e5c8d671e3b145b79f33de718fe34ea514
Reviewed-on: https://gerrit.libreoffice.org/49837
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Michael Stahl <mstahl@redhat.com>
2018-02-19 16:17:02 +01:00
Noel Grandin
da2f9c20f6 loplugin:changetoolsgen various improvements
- use AdjustFoo variants of methods on Rect/Size/Point
- ignore double assignments
- improve error messages
- handle expressions that include macros by using getExpansionLoc
- replace ++X() with X() + 1

Change-Id: Ida6b06b2a92e9226168aff6b1b8031f5867687b4
2018-02-16 08:28:50 +02:00
Noel Grandin
288447449d rename loplugin changerectanglegetref to changetoolsgen
Change-Id: I378f64ac0879d4c6ea574b1674e96ffb9cc89732
2018-02-12 10:29:38 +02:00
Noel Grandin
78bd5d5fb4 loplugin:changerectanglegetref also fix Point and Size
Change-Id: I373af0a62e3785c4abc2d27b0b31121c9d596ca3
2018-02-12 10:29:38 +02:00
Noel Grandin
fc80919370 fix loplugin rewriter source range checking
after
    commit 94ab8e4360a2a7a932656e99f718244321d0f923
    Date:   Fri Feb 9 15:28:41 2018 +0200
    improve loplugin rewriter double source modification detection

Change-Id: Ibf0a64fe4cc3dd6bf5ae16672b3d748a842196e4
2018-02-12 10:29:38 +02:00
Noel Grandin
94ab8e4360 improve loplugin rewriter double source modification detection
because my new rewriter easily generates overlapping rewriting.

Move the code from flatten and salcall up into the pluginhandler, and
drop the simpler detection logic.

Change-Id: I3da51ac510954a5d4276cee0924cc5dc1fc9a734
Reviewed-on: https://gerrit.libreoffice.org/49493
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-02-10 06:54:27 +01:00
Noel Grandin
c07b913cc6 add setter methods to tools::Rectangle
intended to replace the existing methods that return mutable ref

And add the clang rewriter I will use to do most of the work.

Change-Id: If00be13da5c16c07671cedbcfea21528bac33c8a
Reviewed-on: https://gerrit.libreoffice.org/49430
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-02-09 07:56:12 +01:00
Noel Grandin
5d15bb5849 remove debugging code
Change-Id: Ia5018354a764f900091cb5e03327721fa66591c9
2018-02-06 09:48:06 +02:00
Noel Grandin
987cd20a33 loplugin:useuniqueptr in ImpEditEngine
Change-Id: I5afc846c803f5191bb5e04590923059e88434b76
Reviewed-on: https://gerrit.libreoffice.org/49176
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-02-05 07:52:50 +01:00
Noel Grandin
1b67ad6ff8 remove connectivity OSubComponent
push the logic that is still necessary down into the subclasses

Change-Id: I99424f0b3c654c5652991a4140b17ceb02224e50
Reviewed-on: https://gerrit.libreoffice.org/49087
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-02-02 11:21:36 +01:00
Noel Grandin
23e9b12944 loplugin:useuniqueptr in i18npool
Change-Id: Iff39b9298bfad474c5c011b6355b8ebf5be06318
Reviewed-on: https://gerrit.libreoffice.org/49091
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-02-02 11:12:15 +01:00
Noel Grandin
98864543c0 loplugin:singlevalfields
Change-Id: I346f236e28cb0bd064a7d757b187e5e64544700f
Reviewed-on: https://gerrit.libreoffice.org/49086
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-02-02 07:40:13 +01:00
Noel Grandin
ac7132598b loplugin:datamembershadow in PopupMenuToolbarController
this looks like an oversight, just use the baseclass member

Change-Id: Ida36be64266bbc33a6bd1d89dcb665d24a6dd83f
Reviewed-on: https://gerrit.libreoffice.org/49075
Reviewed-by: Maxim Monastirsky <momonasmon@gmail.com>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-02-02 07:39:50 +01:00
Noel Grandin
1d98683296 teach useuniqueptr loplugin about while loops
and reduce code duplication

Change-Id: I292d7515b15fce4cf1714c3b11b947493706bc3c
Reviewed-on: https://gerrit.libreoffice.org/49090
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-02-02 07:38:57 +01:00
Noel Grandin
62222b4097 these TODOs have been done
Change-Id: I5457f38f4668175a8f3e1b0f24a90963ee9d585f
Reviewed-on: https://gerrit.libreoffice.org/49076
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-02-01 11:39:55 +01:00
Andrea Gelmini
5acfb93c64 Fix typos
Change-Id: Icb4f4d9039278318d5f7f6302d57957b2c02bdb8
Reviewed-on: https://gerrit.libreoffice.org/49069
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Michael Stahl <mstahl@redhat.com>
2018-02-01 11:08:45 +01:00
Noel Grandin
0913b2af7d loplugin:datamembershadow in XFCellStyle
looks like the subclass member is never written to, so I'm going to
assume this was a bug

Change-Id: Ic56c4a30cd139415eb08c4d572273dad2411b514
Reviewed-on: https://gerrit.libreoffice.org/49001
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-02-01 07:06:46 +01:00
Noel Grandin
453cb4dfa5 loplugin:datamembershadow in lotuswordpro
Change-Id: I50f37e09df6c4c7cbe697e3419731e637c980807
Reviewed-on: https://gerrit.libreoffice.org/49000
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-01-31 20:25:25 +01:00
Michael Stahl
e80da60895 tdf#114596 compilerplugins: add exception to [loplugin:refcounting]
Change-Id: I994653dc4bf858bdea7ba60f40da0ee3c8d028e4
2018-01-31 17:53:40 +01:00
Andrea Gelmini
c101df2171 Fix typos
Change-Id: Iedd82d035454c940d76a94c7e910c81827c1389c
Reviewed-on: https://gerrit.libreoffice.org/48828
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Julien Nabet <serval2412@yahoo.fr>
2018-01-29 13:26:15 +01:00
Noel Grandin
084571ee6c loplugin:useuniqueptr in ModelData_Impl
Change-Id: I66866ed1698fafe59ba31f99df09fb792da410e3
Reviewed-on: https://gerrit.libreoffice.org/48702
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-01-29 07:17:24 +01:00
Noel Grandin
c7e2b4ff70 loplugin:datamembershadow in SmartHdl
rename both these fields

Change-Id: I7c414bb440872cdc36d29613be52a5a7542ff9bb
Reviewed-on: https://gerrit.libreoffice.org/48565
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-01-26 08:10:37 +01:00
Noel Grandin
390fad39a8 loplugin:datamembershadow in PresenterPane
the subclass field is just a copy of the parent field, so drop the
subclass, and consequently simply the CreateCanvases method, we don't
need to pass the parameter down, can just access the parent field.

Change-Id: I3be448a06b32d01cdda4fc36b78cafb4488e2913
Reviewed-on: https://gerrit.libreoffice.org/48553
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-01-25 12:15:44 +01:00
Noel Grandin
fbe2d12f19 loplugin:datamembershadow in SvxUnoTextRangeBase
make the superclass member private

Change-Id: I665d87bfdfc3d7804cd4cac6108f9bc65b9ca2b5
Reviewed-on: https://gerrit.libreoffice.org/48552
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-01-25 10:23:09 +01:00
Noel Grandin
97b7ada038 loplugin:datamembershadow in SdXMLShapeLinkContext
in this case, we can just drop the child member and re-use the parent
member. The parent class barely contains any logic anyway.

Change-Id: I520217c04a38b66323a76bf5fddb476bd3fc8e15
Reviewed-on: https://gerrit.libreoffice.org/48551
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-01-25 09:51:45 +01:00
Noel Grandin
945a119675 loplugin:constparams
Change-Id: I7c695073d9a9d3b7a641d6eb9fe01a47d8c3a504
Reviewed-on: https://gerrit.libreoffice.org/48392
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-01-24 07:56:57 +01:00
Stephan Bergmann
659109609b Remove unused TypeCheck::SubstTemplateTypeParmType
...introduced unused with 91b4e4531621b7afb2dbab1a8aa62c92da66951a "new
loplugin: pointerbool"

Change-Id: I3af0ce878f1f2742223d66bcdade4e9c144162cd
Reviewed-on: https://gerrit.libreoffice.org/48387
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-01-23 18:20:51 +01:00
Noel Grandin
91b4e45316 new loplugin: pointerbool
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-23 10:41:38 +01:00
Noel Grandin
73139fe600 loplugin:unusedmethods
Change-Id: If00b0e659e1818c29ae39b89f8b4f7ea29d14986
Reviewed-on: https://gerrit.libreoffice.org/48185
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-01-20 07:40:41 +01:00
Stephan Bergmann
5ea8854d3c -Werror,-Wunused-variable
Change-Id: I1bcfe0dabd61a2157bc4a48ea54413882ecaaabc
2018-01-19 13:52:24 +01:00
Noel Grandin
be8c414567 loplugin:unusedmethods also check for functions returning bool
we were previously excluding them

Change-Id: I48a68799b0de60b4995fae541eb363e043d4dd11
Reviewed-on: https://gerrit.libreoffice.org/48167
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-01-19 13:26:27 +01:00
Noel Grandin
be94207ecb new loplugin:emptyif
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-19 13:25:54 +01:00
Noel Grandin
23885b06b1 loplugin:unnecessaryparen extend to delete statements
Change-Id: Ic4383ea948876a26f791f0e5b0110cef978a26e1
Reviewed-on: https://gerrit.libreoffice.org/48027
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-01-17 09:32:03 +01:00
Noel Grandin
a9286f445d loplugin:useuniqueptr in PPDParser
Change-Id: Iafd63c276d430ea2a08286921f593bc56587e71c
2018-01-17 10:16:35 +02:00
Noel Grandin
2e97530102 loplugin:useuniqueptr expand search for ranged-loop-delete
Change-Id: I78955f4db9b4da2858dfb25e69a5502eb0280418
2018-01-17 10:16:35 +02:00
Andrea Gelmini
0183c7c3b8 Fix typos
Change-Id: I46873c8bea3bbfeebb7dee50918d3978408fcf63
Reviewed-on: https://gerrit.libreoffice.org/47842
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Julien Nabet <serval2412@yahoo.fr>
2018-01-16 14:25:56 +01:00
Stephan Bergmann
a409d32e7f More loplugin:cstylecast
...also warn about the remaining cases of C-style casts (other than idiomatic
cast to void)

Change-Id: I274be61ad038fc41ac470fc07ea703a0f071f456
2018-01-15 09:10:25 +01:00
Noel Grandin
397d5cbc3c loplugin:useuniqueptr in Cursor
Change-Id: I5de300709409311b7a1d451ee1d314596cf2e879
Reviewed-on: https://gerrit.libreoffice.org/47836
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-01-15 07:28:35 +01:00
Stephan Bergmann
cab0427cad Enable loplugin:cstylecast for some more cases
...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>
2018-01-12 20:32:32 +01:00
Noel Grandin
22bba5f377 teach useuniqueptr loplugin about "if(field != null) delete field"
Change-Id: I938deef90c8d6ceb0e72ab3f6ee2cbddc6f72b8d
Reviewed-on: https://gerrit.libreoffice.org/47730
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-01-12 07:02:29 +01:00
Noel Grandin
e57a036939 loplugin:useuniqueptr in tools,stoc,unotools
Change-Id: Ia72b65577143623cedc7a40bc34f7fb897add097
Reviewed-on: https://gerrit.libreoffice.org/47726
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-01-11 12:47:37 +01:00
Noel Grandin
96d9bd2262 loplugin:useuniqueptr in l10ntools
update plugin to find all places where we are unconditionally deleting
stuff in a destructor

Change-Id: Ia0fedc2420c7717ed2bdd8d3bb00262d2a63e0bc
Reviewed-on: https://gerrit.libreoffice.org/47724
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-01-11 07:36:26 +01:00
Stephan Bergmann
cc033ec70a Don't use non-Windows sys/time.h
(The comment what the test wants to check quotes noelgrandin on #libreoffice-
dev.)

Change-Id: I8e8980902c8113eb75d24064e68a47e70bc483d6
Reviewed-on: https://gerrit.libreoffice.org/47676
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-01-09 23:22:27 +01:00
Stephan Bergmann
17b9ef3858 Don't build off-by-default loplugin:unusedfields on Windows for now
...due to missing sys/file.h

Change-Id: I7cfd64c5355d9fdbb85320f876c277a408be9352
Reviewed-on: https://gerrit.libreoffice.org/47675
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-01-09 23:21:47 +01:00
Michael Stahl
334601603a sw: move some globals in fetab.cxx into SwFEShell
It looks like the main point of these being globals is so that they can
be cleared from various places when tables or table frames are destroyed.

Add a SwDoc parameter to ClearFEShellTabCols() and just iterate
over all shells.

Change-Id: I75ad6b695ee1bfa76b9a05c606b07a3574c70ac4
2018-01-04 12:12:12 +01:00
Noel Grandin
21e0d8162a loplugin:unusedfields
fix the ReturnStmt check

Change-Id: I95076076bd1313d23798c4615ea12910c86ed9a8
Reviewed-on: https://gerrit.libreoffice.org/47309
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-01-04 07:17:23 +01:00
Noel Grandin
1b666235f6 loplugin:singlevalfields improve copy constructor check
Change-Id: Id1e7fbecd9e9f816553d2e678c3f1b7890fc4db8
Reviewed-on: https://gerrit.libreoffice.org/47293
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-01-03 10:38:42 +01:00
Noel Grandin
acdba3c2ee loplugin:passstuffbyref more return improvements
slightly less restrictive check when calling functions

Change-Id: I35e268ac611797b1daa83777cda02288a635aa32
Reviewed-on: https://gerrit.libreoffice.org/47259
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-01-03 08:07:41 +01:00