Commit Graph

19 Commits

Author SHA1 Message Date
Luboš Luňák
990163534c move isDerivedFrom() from a clang plugin to shared code, for reuse
Change-Id: I7b9b41a7081281214a387cdf02080866e9b9dfe7
Reviewed-on: https://gerrit.libreoffice.org/68873
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-03-11 11:53:50 +01:00
Stephan Bergmann
f58933829d Avoid loplugin:redundantcast false positive involving decltype
..with libc++ on macOS:

> /Users/stephan/Software/lo2/core/sw/source/core/doc/CntntIdxStore.cxx:238:44: error: static_cast from 'decltype(__x.base() - __y.base())' (aka 'long') prvalue to 'long' prvalue is redundant [loplugin:redundantcast]
>                 const MarkEntry aEntry = { static_cast<long>(ppBkmk - pMarkAccess->getAllMarksBegin()), false, pBkmk->GetMarkPos().nContent.GetIndex() };
>                                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Change-Id: I94ab3d828482462c0fde26e19c9cc6508efa00fe
Reviewed-on: https://gerrit.libreoffice.org/59240
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-08-17 08:19:48 +02:00
Stephan Bergmann
ab76a88971 Various loplugin warnings in mysql
I assume the "0 == " around columnStringValue.equalsIgnoreAsciiCase in
ODatabaseMetaData::getSchemas (mysqlc/source/mysqlc_databasemetadata.cxx) was
just a thinko, as the latter already returns sal_Bool, not a <0 / 0 / >0 integer
value.

(Rebased atop ce24919c01 "loplugin, various in
mysqlc", which covered the same warnings, but didn't consider the negated call
to equalsIgnoreAsciiCase to be an accident as I do here (see above), and
accidentally reversed the logic of OResultSetMetaData::isNullable in
mysqlc/source/mysqlc_resultsetmetadata.cxx, I think.)

Change-Id: Ie89cc8ef7c7638d28307a4b240930d387d75b8f2
Reviewed-on: https://gerrit.libreoffice.org/58908
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-08-13 12:44:31 +02:00
Stephan Bergmann
15e51fbc57 Improved loplugin:redundantcast (const-qualified typedefs)
...see comments to <https://gerrit.libreoffice.org/#/c/56661/> "This cast seems
completely unnecessary to me?"

Change-Id: I57d27cd2aa2dc94bc2e0b49fe06a09d31301cb7e
Reviewed-on: https://gerrit.libreoffice.org/56708
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-06-29 23:41:00 +02:00
Stephan Bergmann
8789f4f65b Check isOkToRemoveArithmeticCast in loplugin:redundantfcast too
...to avoid warnings like

> C:/lo64/core/svx/source/table/accessiblecell.cxx(400,12):  error: redundant functional cast from 'long' to 'sal_Int32' (aka 'long') [loplugin:redundantfcast]
>     return sal_Int32(0x0ffffffL);
>            ^~~~~~~~~~~~~~~~~~~~~

with clang-cl

Change-Id: I4a48a9f10ad75f76a3c6ab6152ab279df9a3fbcc
Reviewed-on: https://gerrit.libreoffice.org/51780
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-03-23 16:11:49 +01:00
Stephan Bergmann
659109609b Remove unused TypeCheck::SubstTemplateTypeParmType
...introduced unused with 91b4e45316 "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 39d719a80d
    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
Stephan Bergmann
9663341f92 Bump --enable-compiler-plugins to Clang 3.8.0
<https://lists.freedesktop.org/archives/libreoffice/2017-December/079107.html>
"Clang baseline bump"

Change-Id: I18fca8794ea34118fc6308458064d0c28cf5caf7
Reviewed-on: https://gerrit.libreoffice.org/46557
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-12-19 22:08:38 +01:00
Noel Grandin
a93b691b78 loplugin:unusedvariable add some more std:: types
Change-Id: Ib15931e415990b56367fe3e1c7cf3f22cc4826d5
Reviewed-on: https://gerrit.libreoffice.org/44529
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-11-09 13:57:45 +01:00
Stephan Bergmann
871e420cbb Fix loplugin::unusedvariablecheck check for std classes
(but which finds no new hits)

Change-Id: I862a3c82932ee6d6d0946cd33f965bb8e917cff8
2017-11-08 15:28:20 +01:00
Stephan Bergmann
d3a6b6f1a8 Remove obsolete "lo_warn_unused" workaround
Per README.md, Clang 3.4 is the baseline for --enable-compiler-plugins, which is
the sole consumer of the "lo_warn_unused" attribute, but Clang 3.4 already
supports HAVE_GCC_ATTRIBUTE_WARN_UNUSED.

Change-Id: I9654028e24852335e463c73bcb5ece5e5b54d53c
2017-11-08 10:58:04 +01:00
Stephan Bergmann
7892b4191b loplugin:oncevar: empty strings
...which showed that checking the parent statement (which may be too large to)
in OnceVar::VisitDeclRefExpr is inadequate.

Change-Id: I07fb8ba9e2dfbd0c65a2723737d14abcddcefec4
Reviewed-on: https://gerrit.libreoffice.org/39757
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Tested-by: Stephan Bergmann <sbergman@redhat.com>
2017-07-14 09:52:51 +02:00
Stephan Bergmann
65d6c64259 loplugin:casttovoid
Change-Id: I427b15b35ef6e7c803cb8a00c961d35175ae8cb2
2017-07-03 12:34:38 +02:00
Noel Grandin
7299481834 loplugin:redundantcast find redundant c-style enum casts
Change-Id: I2dab376d87804521aed6b6bd41ad7762830fa349
Reviewed-on: https://gerrit.libreoffice.org/35467
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-03-22 06:47:35 +00:00
Stephan Bergmann
4a591d74a7 Some more bool-like types for Windows/clang-cl
"TW_BOOL" seen e.g. in extensions/source/scanner/scanwin.cxx
"boolean" seen e.g. in extensions/source/activex/SOActionsApproval.h

Change-Id: I78281cd4f92c3e0c0d885cc2466665a06f5bcd85
2016-12-22 09:19:00 +01:00
Stephan Bergmann
0f22790e6b Generalize typedef-to-void* check in loplugin:redundantcast
...to also cover cases like conversion betwen LPVOID and HANDLE in Windows-only
code

Change-Id: I934fe89372ee7a12462e7ad4284b9ea2cc73ce5a
2016-12-18 22:43:26 +01:00
Stephan Bergmann
9d80c032fe loplugin:redundantcast: redundant static_casts
Change-Id: I4d50b77745d68a23136221ef06f327137e89fa7e
2016-07-08 16:47:31 +02:00
Stephan Bergmann
5d88bf766c Further clean-up
Change-Id: Ice5fcb8f598b079afde3346f569d9619f1383506
2016-06-29 11:31:13 +02:00
Stephan Bergmann
0d3738a258 More Clang 3.4 "(anonymous namespace)" fixes
Change-Id: I7cb43f915565dadd611b90ee30373e472f97efb5
Reviewed-on: https://gerrit.libreoffice.org/26748
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Tested-by: Stephan Bergmann <sbergman@redhat.com>
2016-06-28 20:33:58 +00:00