1457 Commits

Author SHA1 Message Date
Stephan Bergmann
4082b5874a Restrict loplugin:constparams cast-to-void check
Change-Id: I3c4d4f99b423f46136a79f3b06c5f0e1492872f1
2017-08-31 11:23:26 +02:00
Stephan Bergmann
72cfd4d024 loplugin:constparams: Also handle ObjCObjectPointerType
...in 0660a30d54eb6762302cf1afd43de01e137f6393 "Avoid loplugin:constparam when
param is subject of cast to non-const pointer"

But turns out this whole avoidance is ill-advised and should eventually be
reverted:

Aug 31 09:09:26 <sberg> noelgrandin, the way you originally handled CastExpr in
 constparam's checkIfCanBeConst, your intent was if there's code like
 static_cast<T*>(p) and param p is found it can be made const, one would also
 need to change that cast to static_cast<T const *>(p) when fixing the loplugin
 warning, right?
Aug 31 09:09:43 <noelgrandin> sberg, correct
Aug 31 09:10:10 <sberg> noelgrandin, I messed the up with
 0660a30d54eb6762302cf1afd43de01e137f6393
Aug 31 09:10:12 <IZBot> core - Avoid loplugin:constparam when param is subject
 of cast to non-const pointer -
 http://cgit.freedesktop.org/libreoffice/core/commit/?id=0660a30d54eb6762302cf1afd43de01e137f6393
Aug 31 09:10:24 <noelgrandin> sberg, I probably should have had a test for that
Aug 31 09:10:41 <noelgrandin> tests are better at expressing intent
Aug 31 09:10:56 <sberg> I ran across it in a function that needed to have the
 param non-const for API reasons (callback fn), and it looked like the "obvious"
 fix there, not needing to add the fn to the blacklist
Aug 31 09:11:26 <sberg> I'll eventually get that fixed again (but want to first
 get the Mac and Windows builds to succeed)
Aug 31 09:11:44 <noelgrandin> fair enough

Change-Id: Idef0cfc417ec0597a26a29c8720e3e4051a68e00
2017-08-31 11:13:38 +02:00
Stephan Bergmann
20b11e8dc4 ...in which Johnny returns from the fair for real
and finds loplugin:constparams adapted to ObjCIvarRefExpr also

Change-Id: Ib803cd80b01ad7a0fa07bddb77a873bb323a50c0
2017-08-31 11:02:38 +02:00
Stephan Bergmann
64a4ad3a67 Avoid loplugin:constparam when param is marked as unused
...as in entry_group_callback
(sd/source/ui/remotecontrol/AvahiNetworkService.cxx),

  AVAHI_GCC_UNUSED void *userdata

Change-Id: I494067878181c51b77d581a21ab1c9ef81e482e5
2017-08-30 16:34:46 +02:00
Stephan Bergmann
5d2e830a30 Avoid loplugin:constparam when param is cast to void
...which typically indicates that the param just has to be of the given type for
some reason

Change-Id: Ide30f514c5a849ae897c31c1744ece9df712a9fc
2017-08-30 15:14:19 +02:00
Stephan Bergmann
0660a30d54 Avoid loplugin:constparam when param is subject of cast to non-const pointer
...as in WriteCallback (desktop/source/minidump/minidump.cxx), where

  void *ptr

is use in

  static_cast<char *>(ptr)

Change-Id: I0bd44329029cd793390d0744de3c839612e0b494
2017-08-30 14:57:46 +02:00
Stephan Bergmann
67bff64e10 Adapt loplugin:constparam to jurt/source/pipe/staticsalhack.cxx
Change-Id: I0193ce3be582cb0a06cca17257b1e6587c5b3752
2017-08-30 14:57:10 +02:00
Noel Grandin
80dd56035e fix ScJumpMatrixToken memory handling
ScJumpMatrixToken unconditionally deletes the ScJumpMatrix pointer it
receives. But it's copy constructor also just copies that pointer,
meaning that we could end up freeing that pointer twice.

ScJumpMatrix has no copy constructor, so I just managed it via
shared_ptr.

Change-Id: I9cf13312afb4f2869fdc878e5f34060614e31842
Reviewed-on: https://gerrit.libreoffice.org/41728
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-08-30 13:23:15 +02:00
Stephan Bergmann
99fb14ef72 ...in which Johnny returns from the fair
and finds loplugin:constparams adapted to ObjCMessageExpr

Change-Id: I6e1ddd0fb1a8a61d5a78c156bccfc29f7233909e
2017-08-30 12:22:19 +02:00
Noel Grandin
008199ee75 loplugin:constparam in various
Change-Id: I6821a3946f2e8fabf26558a84370c16ac8827fed
Reviewed-on: https://gerrit.libreoffice.org/41721
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-08-30 10:58:56 +02:00
Noel Grandin
bcc372d15e loplugin:constparam in sc part8
Change-Id: I6cf9c5e662b20de9c9698a8c1fab56a09950c522
Reviewed-on: https://gerrit.libreoffice.org/41683
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-08-29 14:15:16 +02:00
Andrea Gelmini
b382193a20 Complete commit 61d49afadb2b
Change-Id: I299d112f7189335e17bc0062447ecc051ec24fa9
Reviewed-on: https://gerrit.libreoffice.org/41284
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com>
2017-08-27 13:27:18 +02:00
Stephan Bergmann
c5616014bb loplugin:redundantcast: suppress warnings in reworked glibc assert macro
Change-Id: I20be230b3ff5d11395f33a9896d0a575c3051fb7
2017-08-25 20:21:25 +02:00
Noel Grandin
4d41b2e42f loplugin:unusedfields
Change-Id: I81bcf4f56599146536ba8d66cc86fa5a08737298
Reviewed-on: https://gerrit.libreoffice.org/41556
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-08-25 13:10:03 +02:00
Noel Grandin
1b694dad64 loplugin:unusedmethods
Change-Id: Iaaf9092ec4d6189492906648b84494d087fed81f
Reviewed-on: https://gerrit.libreoffice.org/41539
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-08-25 09:04:26 +02:00
Noel Grandin
c66568d6b0 loplugin:useuniqueptr, look for containers..
that can use std::unique_ptr, and apply it in i18npool

Change-Id: Ib410abaf73d5f392c7a7a9a322872b08c948f9e9
Reviewed-on: https://gerrit.libreoffice.org/41438
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-08-23 18:35:00 +02:00
Andrea Gelmini
e725111f82 ctypeitm no more exists
File deleted on commit 08566ea51944

Change-Id: Iccf35edc92c99779be519a4c722fa5d9bcef4b34
Reviewed-on: https://gerrit.libreoffice.org/41434
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-08-23 08:47:15 +02:00
Stephan Bergmann
4eaaa812ce Adapt tests to Windows
Change-Id: I8d33234196060f96ad47c9d0fead4f31218f8bdd
2017-08-21 11:11:26 +02:00
Jochen Nitschke
5704bc5578 svtools: remove function with unused return value
and inline only functionality

Change-Id: I79b0ec29dcc35e9dc92aaac9fb191c882a9b0621
Reviewed-on: https://gerrit.libreoffice.org/41362
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-08-20 18:45:30 +02:00
Noel Grandin
84c0687f09 don't use boost in compilerplugins
Change-Id: Ic1610e99cd2d11d1a536a6f3e66b44417ee59793
2017-08-18 15:08:33 +02:00
Noel Grandin
256c28ae33 new loplugin:expressionalwayszero
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-18 14:19:20 +02:00
Stephan Bergmann
d7a9abdce5 Report full type info (plus the desugared type as "aka")
Change-Id: I647b1c3e479e0be01ed7ea16e1ad3dd9bed9ba6a
2017-08-18 10:23:42 +02:00
Noel Grandin
eea6d3951b loplugin:unnecessaryparen
look for  statements like

    return (function());

Change-Id: I906cf2183489f87225b99b987caca67e39b26cc3
Reviewed-on: https://gerrit.libreoffice.org/41260
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-08-18 08:49:37 +02:00
Noel Grandin
f0348fb4bf these comments no longer valid
Change-Id: I263116383a9342f9600d6cd1622a941afe83634e
2017-08-17 16:52:32 +02:00
Noel Grandin
19522f0588 fix compiler error in passparamsbyref
Under clang-3.8 we get:

compilerplugins/clang/passparamsbyref.cxx:158:31: error: no member named
'isAssignmentOp' in 'clang::CXXOperatorCallExpr'

Change-Id: Icfba2b624f53f07418674237adc5a47819f73c43
2017-08-17 16:18:15 +02:00
Noel Grandin
d21b119df3 loplugin:passstuffbyref ignore params that are assigned to
makes writing nice code awkward sometimes.

Also split plugin into two different plugins, the logic was getting
tangled up.

Change-Id: I232e314d29c766c160c29373988dc37a466505be
2017-08-17 13:18:34 +02:00
Noel Grandin
b0d7b8fa63 new loplugin convertuintptr
an experiment to see if I can make the process of eliminating
sal_uIntPtr a little easier

Change-Id: I808185fbf18826cb9ab5612a7be4148d52045957
2017-08-17 13:18:34 +02:00
Noel Grandin
ea43e0e3ce display oncevar loplugin by default
seems to be annoying some people. I'll run this one myself, and at some
stage create some code for enabling a subset of extra plugins via
configure.ac

Change-Id: Ia95701f63f65751d75b5a3fecffb1fc1a82f38e0
2017-08-17 12:10:09 +02:00
Noel Grandin
a4602c791f add sal_uLong to droplong loplugin
Change-Id: Ief92b4ee97f561613bc730a91c27fe192f485d77
2017-08-17 09:25:46 +02:00
Noel Grandin
9fb742489b move deadclass plugin to store
<sberg> noelgrandin, and is loplugin:deadclass even sound?

    struct B { B(B const &) {} }; struct D: B { D(): B(*this) {} };

Change-Id: Idadd379b925aa6f9de6c625bffa8560ec4192ac7
2017-08-16 13:17:07 +02:00
Noel Grandin
3ee1174e7b remove leftover debugging output
Change-Id: Ide78daefced91fff2efeeb25dace6f722acfa3e9
2017-08-16 09:35:11 +02:00
Noel Grandin
3281628e1c loplugin:redundantcast ignore functional casts involving typedefs
<sberg> noelgrandin, 718cdd43c25783d9cd402e381123efe3981cc514 now also
looks through typedef sugar, e.g. complaining about a gdouble -> double
expl. conversion in configmgr/source/dconf.cxx;
I think we want to remain silent about such conversions involving typedefs
<noelgrandin> sberg, ah, good point.

Change-Id: Icbb0d6be273f53e507c91556cf0ccb5a5c03e5a1
Reviewed-on: https://gerrit.libreoffice.org/41175
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-08-15 15:45:34 +02:00
Noel Grandin
718cdd43c2 loplugin:redundantcast, find more functional casts
In the enum types that caused the problem look like this when I dump
then:

EnumType 0xdb45770 'enum SvxFrameDirection'
`-Enum 0xdb456d8 'SvxFrameDirection'

SubstTemplateTypeParmType 0xdb61200 'enum SvxFrameDirection' sugar
|-TemplateTypeParmType 0xd7518f0 'EnumT' dependent depth 0 index 0
| `-TemplateTypeParm 0xd7518a8 'EnumT'
`-EnumType 0xdb45770 'enum SvxFrameDirection'
  `-Enum 0xdb456d8 'SvxFrameDirection'

Change-Id: Id8fedabe43b7a27df61a2320a9acbf54d2dc7882
Reviewed-on: https://gerrit.libreoffice.org/41169
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-08-15 13:46:29 +02:00
Andrea Gelmini
882e9ff39f Fix typos
Change-Id: Ic95ec7c8a36ef5d19eac93b7eed8a7de2ec8904f
Reviewed-on: https://gerrit.libreoffice.org/41153
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Julien Nabet <serval2412@yahoo.fr>
2017-08-14 23:36:31 +02:00
Noel Grandin
0c3bd1d482 new loplugin:droplong
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-14 09:14:39 +02:00
Noel Grandin
4d89865ef2 new loplugin:deadclass
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-08-11 21:20:25 +02:00
Noel Grandin
40ea896e5c loplugin:unnecessaryvirtual
Change-Id: I7aa23e56f2c126bf505262454408340b557f13cf
Reviewed-on: https://gerrit.libreoffice.org/40865
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-08-08 12:33:03 +02:00
Noel Grandin
a209172669 loplugin:constantparam
Change-Id: Ib92aba17c46a4ada75c2a0630f281759d995f32e
Reviewed-on: https://gerrit.libreoffice.org/40843
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-08-08 08:08:35 +02:00
Noel Grandin
959ace5861 loplugin:constparams in sw part10
Change-Id: I7d708c3e6157d0b8690b433d3363d2c0745b2410
Reviewed-on: https://gerrit.libreoffice.org/40832
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-08-07 15:27:38 +02:00
Stephan Bergmann
1ac8d90d84 -Werror=unused-function
Change-Id: Ia98b64a5500b99c5a6f20c723d96d9c4686f3271
2017-08-07 13:12:59 +02:00
Noel Grandin
06e2246f16 loplugin:constparams in sw part9
Change-Id: I2edba9cde5a5efd06815a55632703b706ca523c7
Reviewed-on: https://gerrit.libreoffice.org/40830
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-08-07 13:09:50 +02:00
Stephan Bergmann
dbeab89b5b Adopt loplugin:casttovoid to Objective C
Change-Id: I71bad86a383a9b906b02ec968dc32e9acd0bec26
2017-08-07 08:00:07 +02:00
Andrea Gelmini
35a2d88288 Fix typos
Change-Id: Ib7f43bf17ab8b9fb9d961a908d7620b50826a975
Reviewed-on: https://gerrit.libreoffice.org/40688
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Julien Nabet <serval2412@yahoo.fr>
2017-08-05 00:32:50 +02:00
Noel Grandin
902d87147d loplugin:constparams in sw part3
Change-Id: I05ad3204af4e6ec3c832b185a1b35fdb75a229b2
Reviewed-on: https://gerrit.libreoffice.org/40760
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-08-04 11:55:27 +02:00
Noel Grandin
98d7b40986 loplugin:constparams in sw part2
Change-Id: I51ae0e8caaf46f141d3d15ace47612df1e476de7
Reviewed-on: https://gerrit.libreoffice.org/40735
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-08-03 21:32:05 +02:00
Noel Grandin
5176c1dd60 loplugin:constparams in sw part1
Change-Id: Id8d8afe268a82585ec2d3699411073dfb905d6ba
Reviewed-on: https://gerrit.libreoffice.org/40734
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-08-03 20:49:15 +02:00
Noel Grandin
d5630adf33 loplugin:checkunusedparams in various
Change-Id: I4f54940a9ebdcd47776b2a5f7bae6e49b633ee44
Reviewed-on: https://gerrit.libreoffice.org/40706
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-08-03 13:13:17 +02:00
Noel Grandin
dafae0fe31 loplugin:constparams in sd
Change-Id: I833c6da99d5ccb8f6a8b5c905bee73b75fde0a89
Reviewed-on: https://gerrit.libreoffice.org/40700
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-08-03 11:06:54 +02:00
Noel Grandin
fb8b0585d9 loplugin:checkunusedparams in sw
Change-Id: I8a6b2647375a54720cd9fd765cc51c9ff43c8190
Reviewed-on: https://gerrit.libreoffice.org/40682
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-08-02 20:52:47 +02:00
Noel Grandin
3dcf6dfcee remove unnecessary use of 'this->'
Change-Id: I5c115389af7d24c18ddaf5fbec8c00f35017a5b4
Reviewed-on: https://gerrit.libreoffice.org/40671
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-08-02 13:45:36 +02:00