1454 Commits

Author SHA1 Message Date
Noel Grandin
e6e85f139b remove unused typedefs
Change-Id: I6fd7a9fed3a80c91a3766fceefd43c5db0aa5275
Reviewed-on: https://gerrit.libreoffice.org/46763
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-12-19 12:39:14 +01:00
Noel Grandin
48251502a8 loplugin:unusedfields
Change-Id: I84a7bcb891548416f0e1f1b20059f9b20c890d4c
Reviewed-on: https://gerrit.libreoffice.org/46686
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-12-19 11:32:50 +01:00
Noel Grandin
150af593ce loplugin:singevalfields
Change-Id: I28c9e436b9d434ce59394ee195ea39815ae49028
Reviewed-on: https://gerrit.libreoffice.org/46685
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-12-19 07:49:50 +01:00
Noel Grandin
be359b156b loplugin:unusedenumconstants
Change-Id: I9dc4b369872a7c6c076ae9be1dcdf2f8385af8a7
Reviewed-on: https://gerrit.libreoffice.org/46684
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-12-19 07:49:33 +01:00
Noel Grandin
234ed63451 loplugin:unnecessaryvirtual
Change-Id: Icf42fdd40a2cf6cda82254f81a7e389c7bac8558
Reviewed-on: https://gerrit.libreoffice.org/46683
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-12-18 11:57:08 +01:00
Stephan Bergmann
c5f6043b0f Enable C++17 for clang-cl, too
Similar to libc++ in C++17 mode, some types like std::auto_ptr are indeed
removed in C++17 mode by default, and need _HAS_AUTO_PTR_ETC=1 to be enabled
(see <https://blogs.msdn.microsoft.com/vcblog/2017/12/08/c17-feature-removals-
and-deprecations/>).

Unlike libc++, also std::binary_function and std::unary_function are removed
(and need the same _HAS_AUTO_PTR_ETC=1 to enable).  So either set that flag to
make external code build, or use patches (for external/mdds) to make externals'
files included in LO proper still work there.

Change-Id: I886cc0de8196255334ee03ec48cb4bc54d460afd
Reviewed-on: https://gerrit.libreoffice.org/46514
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-12-15 22:23:31 +01:00
Stephan Bergmann
9fcc7a907b Try even harder to get at template args in loplugin:implicitboolconversion
After f82dc45bdb9e930878447015291c5b90c9325b57 "Use the canonical TemplateDecl",
builds on macOS (at least those using C++17 and recent trunk libc++) started to
emit false warnings for that

    std::pair< Reference<XConnection>,sal_Bool> aRet;
    aRet.second = false;

code in dbaccess/source/ui/dlg/DbAdminImpl.cxx.  There's a declaration of
std::pair in type_traits and a definition in utility, and for some reason the
declaration in type_traits was deemed the canonical one, while the
SubstTemplateTypeParmType pointed at the definition in utility.  So just check
both, the original and the canonical TemplateDecl.

Change-Id: I2fb9d5172c031e6ad4989b215f19d11a4b17f743
Reviewed-on: https://gerrit.libreoffice.org/46474
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-12-15 13:19:14 +01:00
Noel Grandin
06c281c206 loplugin:unusedindex fix false+ in nested loops
Change-Id: I31acbf104e49a4d1f077817a68d0b116fd2e0a30
2017-12-15 13:46:04 +02:00
Noel Grandin
5f4b126f74 once off loplugin: unusedindex
Change-Id: Ifdf5da1f014c4f130eafed475c6781c029d54f1d
2017-12-15 08:23:53 +02:00
Stephan Bergmann
6f4f5677ac No need to keep these whitelisted functions decorated with SAL_CALL
The only effect SAL_CALL effectively has on LO-internal code is to change non-
static member functions from __thiscall to __cdecl in MSVC (where all other
functions are __cdecl by default, anyway).  (For 3rd-party code, it could be
argued that SAL_CALL is useful on function declarations in the URE stable
interface other than non-static member functions, too, in case 3rd-party code
uses a compiler switch to change the default calling convention to something
other than __cdecl.  But loplugin:salcall exempts the URE stable interface,
anyway.)

One could argue that SAL_CALL, even if today it effectively only affects non-
static member functions in MSVC, could be extended in the future to affect more
functions on more platforms.  However, the current code would already not
support that.  For example, 3af500580b1c82eabd60335c9ebc458a3f68850c
"loplugin:salcall fix functions" changed FrameControl_createInstance in
UnoControls/source/base/registercontrols.cxx to no longer be SAL_CALL, even
though its address (in ctl_component_getFacrory, in the same file) is passed to
cppuhelper::createSingleFactory as an argument of type
cppu::ComponentInstantiation, which is a pointer to SAL_CALL function.

Change-Id: I3acbf7314a3d7868ed70e35bb5c47bc11a0b7ff6
Reviewed-on: https://gerrit.libreoffice.org/46436
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-12-14 13:03:06 +01:00
Stephan Bergmann
2f28d2b4fa Improve loplugin:salcall error reporting
Change-Id: Ib18f61f10225d5499f94144c8a0f9efff40e43aa
Reviewed-on: https://gerrit.libreoffice.org/46366
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-12-13 13:14:11 +01:00
Stephan Bergmann
a987aa3be7 Make loplugin:salcall look into macros too
"Indirect" calls to isSallCallFunction (for canonic and overridden
FunctionDecls) already needed to handle many cases of FunctionDecls spanning
macros, so it isn't that much more work to make that also work for cases called
directly from VisitFunctionDecl.

Change-Id: I529f148c8872b86aa1ef082c6cb73db8ab1866e7
Reviewed-on: https://gerrit.libreoffice.org/46367
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-12-13 12:44:31 +01:00
Noel Grandin
3af500580b loplugin:salcall fix functions
since cdecl is the default calling convention on Windows for
such functions, the annotation is redundant.

Change-Id: I1a85fa27e5ac65ce0e04a19bde74c90800ffaa2d
Reviewed-on: https://gerrit.libreoffice.org/46164
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-12-11 12:13:46 +01:00
Stephan Bergmann
492afb35b4 Improve loplugin:salcall error reporting
Change-Id: I214052491e90eb4147bf79d6fd3927266638c686
Reviewed-on: https://gerrit.libreoffice.org/46203
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-12-11 10:44:08 +01:00
Stephan Bergmann
456f943d22 Fix isSalCallFunction further
...after a31267be1bb42e8a5f80a3b660bbf969eeb5b647 "Fix isSalCallFunction so it
also works on Windows", so that it actually does work on Windows.

Change-Id: I0218fb41b3e1000e2325967a18dfaafaa95fe415
Reviewed-on: https://gerrit.libreoffice.org/46193
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-12-10 22:50:57 +01:00
Andrea Gelmini
06e5bd866b Fix typos
Change-Id: I2de8448564c963d3361a828bb96dcdb15eddf717
Reviewed-on: https://gerrit.libreoffice.org/46151
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2017-12-10 10:32:11 +01:00
Stephan Bergmann
17a8a03aec Add some debug checks to loplugin:salcall
Change-Id: I27b7281723dd705e4304958458be3ea2fee7f3e6
Reviewed-on: https://gerrit.libreoffice.org/46112
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-12-09 13:17:24 +01:00
Stephan Bergmann
959ecc9963 No more issues with these source files
...after a31267be1bb42e8a5f80a3b660bbf969eeb5b647 "Fix isSalCallFunction so it
also works on Windows"

Change-Id: Ic770230f2dd6183f5937801f27e929ebfd39bb4a
Reviewed-on: https://gerrit.libreoffice.org/46111
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-12-09 13:17:03 +01:00
Stephan Bergmann
32c31c03d0 New --enable-compiler-plugins=debug mode
...to enable debug-only code in the plugins.  Some situations in the plugin code
should never happen, yet must not by default report errors or trigger
assertions, as some newly written LO code could trigger them nevertheless (in
which case the plugin code will likely need to be adapted, to cater for these
presumed-impossible situations).

Such code can now be included in the plugins behind an if(isDebugMode()) guard,
and can explicitly be enabled with --enable-compiler-plugins=debug.

I deliberately made this a runtime rather than a compile time option (using
some #ifdef guards in the plugin code, say), as it IMO keeps the code more
readable, and also allows overridding COMPILER_PLUGINS_DEBUG=... on the make
command line.

Change-Id: Iea4f0c2783ad968a0de097fa710b3be1a248de73
Reviewed-on: https://gerrit.libreoffice.org/46096
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-12-08 21:09:39 +01:00
Stephan Bergmann
a31267be1b Fix isSalCallFunction so it also works on Windows
...where FunctionDecl::getReturnTypeSourceRange returns an invalid range because
it fails to take AttributedTypeLoc (as caused by SAL_CALL -> __cdecl) into
account.

Change-Id: I7835dfca7b890ba1bfdb99adaad78a627b6e0e17
Reviewed-on: https://gerrit.libreoffice.org/45909
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-12-08 18:01:27 +01:00
Noel Grandin
dd0dceb511 loplugin:salcall handle static methods
Change-Id: Id6820abec4b8ca8bee26d62b333fd30b42a14aec
Reviewed-on: https://gerrit.libreoffice.org/46007
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-12-07 11:25:55 +01:00
Stephan Bergmann
37fe0f729c Better heuristic to only look through implicit copy/move ctors
At least recent libc++ has a std::string ctor overload without a (defaulted)
Allocator argument (which otherwise causes creation of a temporary Allocator
object and thus a ExprWithCleanups), so in C++17 mode (i.e., with no implicit
move CXXConstructExpr -> MaterializeTemporaryExpr -> CXXBindTemporaryExpr chain
in the way) CellInfo::toString (sw/source/filter/ww8/WW8TableInfo.cxx) has a
ReturnStmt of just

> ReturnStmt
> `-ImplicitCastExpr 'std::string':'class std::__1::basic_string<char>' <ConstructorConversion>
>   `-CXXConstructExpr 'std::string':'class std::__1::basic_string<char>' 'void (const char *)'
>     `-ImplicitCastExpr 'const char *' <NoOp>
>       `-ImplicitCastExpr 'char *' <ArrayToPointerDecay>
>         `-DeclRefExpr 'char [256]' lvalue Var 'sBuffer' 'char [256]'

that erroneously triggered loplugin:passstuffbyref.

Change-Id: I53c8911cb1356560692c003808280a103c399e25
Reviewed-on: https://gerrit.libreoffice.org/45916
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-12-06 11:37:06 +01:00
Noel Grandin
c0ac78c971 loplugin:salcall handle virtual methods
Change-Id: Iab95db31188ea2914a46d63a7ebef3d825e6ec42
Reviewed-on: https://gerrit.libreoffice.org/45851
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-12-06 07:42:50 +01:00
Stephan Bergmann
90d2155912 Work around latest Boost 1.65.1 still using deprecated std::auto_ptr
...in various places, which is gone by default at least from recent libc++ in
C++17 mode.  So bring it back there for now, until Boost is fixed.

Change-Id: I0b3128d114ab2b5693a84bdc7d2b9b9b9b5c3c76
Reviewed-on: https://gerrit.libreoffice.org/45910
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-12-06 07:26:31 +01:00
Stephan Bergmann
306ddfb1b8 Replace deprecated std::mem_fun et al in reportdesign
(as std::mem_fun is gone by default at least from recent libc++ in C++17 mode)

Change-Id: Ib66134bd4072dfe0ce3bc36aa684cee710921235
Reviewed-on: https://gerrit.libreoffice.org/45868
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-12-05 18:11:15 +01:00
Jan Holesovsky
8ce967ad15 lokdialog: Make the badstatic loplugin happy.
Change-Id: Ic19bbd2a3533e4e600d8856e55c4e8d06f0ad752
Reviewed-on: https://gerrit.libreoffice.org/45500
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
2017-12-05 15:07:44 +01:00
Noel Grandin
720cc05a76 fix compile of salcall plugin
changes from sberg and myself crossed paths in the night

Change-Id: I2606902f84739e552b2aad292e63e7b8e6757965
2017-12-05 09:15:48 +02:00
Noel Grandin
9a06b99d2f loplugin:salcall fix non-virtual methods
first, since those are safer to change than virtual methods

Change-Id: Ie3b624019d75ee2b793cee33b3c5f64e994e8bfe
Reviewed-on: https://gerrit.libreoffice.org/45798
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-12-05 07:32:46 +01:00
Stephan Bergmann
5940f3020e -Werror=unused-function
Change-Id: I411a134daef6ad061ab54b300e379b882395905b
2017-12-04 18:41:09 +01:00
Noel Grandin
f6b437c57d loplugin:singlevalfields
Change-Id: I521d2efa641f3a14c48561e2e0f6d687e5807d93
Reviewed-on: https://gerrit.libreoffice.org/45662
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-12-04 07:25:00 +01:00
Noel Grandin
68f8645752 new loplugin salcall: remove unnecessary SAL_CALL
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-12-04 07:24:52 +01:00
Stephan Bergmann
5066377bbe Don't prevent ODatabaseDocument refcount from dropping to zero
...preventing the dtor from ever being called.  (DocumentEvents forwards its
acquire/release calls to its m_pData->rParent, i.e., the ODatabaseDocument, for
better or worse.)  This caused ODatabaseDocument instances to be leaked during
e.g. JunitTest_dbaccess_complex.  Regression introduced with
de2ac128da025502c533f8cede5862e054dd9c44 "loplugin:useuniqueptr in dbaccess".

Change-Id: Ida073c7e576b88e0d1d1a90253445e946e6eac99
Reviewed-on: https://gerrit.libreoffice.org/45652
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-12-01 16:31:48 +01:00
Noel Grandin
e7f6fdd5c3 loplugin:unusedfields
The mnRequestedLength fields in formula/ were introduced in

    commit 6ef6dd0122b8e44d8547ec31f40def42173e4e41
    Author: Kohei Yoshida <kohei.yoshida@collabora.com>
    Date:   Wed Feb 26 14:32:57 2014 -0500
    Store the length of originally requested array size prior to
    trimming.

but then partially removed in

    commit d7f1f91b194da1cb96e66268ce7ef38602aa5754
    Author: Noel Grandin <noel@peralex.com>
    Date:   Mon Mar 3 13:29:43 2014 +0200
    remove unused code in formula/vectortoken

Change-Id: Ic56b6e42682131ee45df7838867145f980f3d601
Reviewed-on: https://gerrit.libreoffice.org/45571
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-12-01 08:13:06 +01:00
Stephan Bergmann
b15f79a8f8 loplugin:unnecessaryparen: signed numeric literals
Change-Id: I75c8224452ca9c3711a2ccaca9ecf549fa59cb64
Reviewed-on: https://gerrit.libreoffice.org/45549
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-11-30 19:29:21 +01:00
Stephan Bergmann
bf59f89d88 Move loplugin:fpcomparison to store/
...after bc4e8de8eea1ccebda479c8e2db2f3c6dfff60d2 "Silence new
loplugin:fpcomparison for now":

> Nov 30 08:33:16 <sberg> noelgrandin, thoughts on whether fpcomparison is actually worth it, seeing the loooooooong blacklist there?
> Nov 30 08:34:11 <noelgrandin> sberg, that's wasn't my idea, can't remember who came up with it. vmiklos was that you?
> Nov 30 08:34:36 <noelgrandin> sberg, the original commit message was "Find code that compares floating point values with == or !=
> Nov 30 08:34:36 <noelgrandin>     It should rather use rtl::math::approxEqual"
> Nov 30 08:34:45 <noelgrandin> so in theory the replacement should be fairly manual
> Nov 30 08:34:48 <vmiklos> i don't think so :)
> Nov 30 08:35:15 <noelgrandin> might have been moggi, but he's not around so.... just disable it
> Nov 30 08:36:19 <sberg> noelgrandin, yeah, in theory; in practice, I guess there's also cases where x==1.0 is what you want exactly (given x tends not to be a computed value after all, but some literal that's being passed around)
> Nov 30 08:36:33 <sberg> noelgrandin, yeah, I'll disable it then

Change-Id: I35f5328efa0ec02d9be837c12efab2b03a3dae52
Reviewed-on: https://gerrit.libreoffice.org/45550
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Tested-by: Stephan Bergmann <sbergman@redhat.com>
2017-11-30 15:09:35 +01:00
Stephan Bergmann
bc4e8de8ee Silence new loplugin:fpcomparison for now
...introduced with ba4a124b0c0c66fd275f5147d55eeec27ce78da9 "Resolves:
tdf#114117 draw page shadow mangled"

Change-Id: I31573d55ae7e5ff015d4582de1d436cdc673acf1
2017-11-30 08:30:41 +01:00
Noel Grandin
c26f644db8 loplugin:unusedmethods
Change-Id: I9188f4579900d7eec375754aa94d21ac4e8456e2
Reviewed-on: https://gerrit.libreoffice.org/45504
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-11-30 07:21:54 +01:00
Noel Grandin
d43e694d5e some global loplugin improvements
for some reason we're hitting more template AST nodes now? Anyhow,
updated singlevalfields and unusedenumconstants to cope.

For unusedfields, ignore field access inside Clone() methods, since it's
like a constructor.
Similarly for unusedmethods.

Change-Id: Icb2f76fb2f06ae5df21f9d75312e42a2800befb9
Reviewed-on: https://gerrit.libreoffice.org/45470
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-11-30 07:20:23 +01:00
Stephan Bergmann
0025fa723a Enable loplugin:unnecessaryparen for integer and Boolean literals
...taking care not to warn about those cases that are used to silence Clang's
-Wunreachable-code

Change-Id: I3c1da907f51cc786f81c1322fe71d75832cd9191
Reviewed-on: https://gerrit.libreoffice.org/45521
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-11-30 07:19:11 +01:00
Stephan Bergmann
2849775c79 TODO: silence new loplugin:badstatics for now
Change-Id: Ia57dd190a173f664b0c624617b13f2876008835a
2017-11-29 10:58:50 +01:00
Noel Grandin
a566fd1c1a loplugin:unusedmethods
Change-Id: I2efb5c0e5735c179314c6c5de87821cee3b033e1
Reviewed-on: https://gerrit.libreoffice.org/45386
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-11-29 07:28:57 +01:00
Stephan Bergmann
c421ac3f94 Revert loplugin:unnecessaryparen warning around integer literals
...as those may be used to silence Clang -Werror,-Wunreachable-code (as happens
in sal/osl/unx/file_volume.cxx for Android, where OSL_detail_STATFS(...) always
expands to (1)).

Change-Id: I85d280c1315b4447362255d17f13f437d3c4af92
2017-11-28 16:52:16 +01:00
Stephan Bergmann
9f4491477b Add back UnusedMethods::TraverseCXXDeductionGuideDecl, properly ifdef'ed
...as is already done in 65d6c642590bd5f51c04228d941608322a85f1ac
"loplugin:casttovoid".  (This reverts 5eec6db4addd7cc665222e1a4d05c35b13719847
"fix loplugin unusedmethods".)

Change-Id: Ibe6a7d9ce58aa70707538854ac64ad07022ea7b6
Reviewed-on: https://gerrit.libreoffice.org/45388
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Tested-by: Stephan Bergmann <sbergman@redhat.com>
2017-11-28 14:09:25 +01:00
Noel Grandin
5eec6db4ad fix loplugin unusedmethods
VisitCXXDeductionGuide is not part of our baseline clang

Change-Id: I354a992456949975384d8ae1a81a07de9e886061
2017-11-28 10:31:54 +02:00
Noel Grandin
ac50f685c7 loplugin:unusedmethods ignore recursive calls
Change-Id: I651a7bf0c705acc5580af8b7742d2d035ec64388
2017-11-28 08:29:13 +02:00
Stephan Bergmann
a2656563f1 loplugin:unnecessaryparen: Warn about parentheses around literals
...that are not composed of multiple tokens, like ("foo" "bar").  Also don't yet
warn about Boolean literals, which are sometimes wrapped in parentheses to
silence unreachable-code warnings.

To avoid multiple warnings about code like

  f((0))

switch to generally using a set of ParenExpr to keep track of which occurrences
have already been handled.

Change-Id: I036a25a92836ec6ab6c56ea848f71bc6d63822bc
Reviewed-on: https://gerrit.libreoffice.org/45317
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-11-27 14:04:40 +01:00
Noel Grandin
2e5508a176 loplugin:unnecessaryparen check for (f1()).f2
Change-Id: I93257b0ddd41c649875124d6d5c5faeaa431bae3
Reviewed-on: https://gerrit.libreoffice.org/45218
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-11-27 10:44:25 +01:00
Stephan Bergmann
f82dc45bdb Use the canonical TemplateDecl
...in case there are multiple, as is the case at least with recent (towards
GCC 8) libstdc++, where std::pair is forward-declared also in
include/c++/8.0.0/bits/stl_iterator.h, so that in
dbaccess/source/ui/dlg/DbAdminImpl.cxx

    std::pair< Reference<XConnection>,sal_Bool> aRet;
    aRet.second = false;

failed to reconstruct the sal_Bool template argument and issued a
loplugin:implicitboolconversion warning.

Change-Id: I0054f2596d3f8837b857f1dca2f25952828b12cc
Reviewed-on: https://gerrit.libreoffice.org/45254
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-11-25 10:05:46 +01:00
Stephan Bergmann
832584eae5 Clean up loplugin:unnecessaryparen blacklist
* rsc/source/parser/rscyacc.cxx no longer exists

* writerfilter/source/rtftok/rtftokenizer.cxx appears to be just fine nowadays?

* sw/source/filter/html/htmltab.cxx used redundant parentheses around a comma
  operator in a while condition, and I see no reason not to remove them (the
  result requires a---reasonable---tweak to loplugin:commaoperator, though)

Change-Id: I451132c700b0ae5a43b03d704156484df897ad5c
Reviewed-on: https://gerrit.libreoffice.org/45213
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-11-24 15:54:48 +01:00
Noel Grandin
665d085511 loplugin:countusersofdefaultparams in sw (1)
Change-Id: I0d14f9c375f93079aef21ca4f1132adc4e1fe06c
Reviewed-on: https://gerrit.libreoffice.org/45207
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-11-24 12:31:35 +01:00