896 Commits

Author SHA1 Message Date
Noel Grandin
fde0b8df30 loplugin:unusedenumconstants in oox
Convert FragmentHandler2::MCE_STATE to scoped enum and drop MCE_UNUSED
constant

Change-Id: Id0b3a81e61d77af5d3837527b008e196835f57cd
Reviewed-on: https://gerrit.libreoffice.org/33954
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-02-06 11:36:17 +00:00
Stephan Bergmann
3ea39bda0e loplugin:unusedenumconstants should apparently not be run by default
Change-Id: I42f479de39b94ca8e9c72a6e92534f602a9fad39
2017-02-06 11:57:39 +01:00
Noel Grandin
c9c3cb5446 loplugin:unusedenumconstants in connectivity..cui
Convert ExpressionFunct to scoped enum and drop FUNC_CONST value.
Convert MQueryExpressionBase::node_type to scoped enum and drop Unknown
value.
Dop PageType::Color value

Change-Id: Icb1f5503c230fb91329acc7d9e1da665fa28d95e
Reviewed-on: https://gerrit.libreoffice.org/33948
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-02-06 09:13:25 +00:00
Noel Grandin
bac9a5d634 loplugin:unusedenumconstants in framework
Convert EProtocol to scoped enum and drop E_UNKNOWN_PROTOCOL.
Convert ToggleButtonToolbarController::Style to scoped enum and drop
STYLE_TOGGLEBUTTON.
Convert TargetHelper::ESpecialTarget to scoped enum and drop
E_NOT_SPECIAL.

Change-Id: I412adacac15192cf6563ce4d5e5b74bfffff4737
Reviewed-on: https://gerrit.libreoffice.org/33949
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-02-06 07:57:28 +00:00
Noel Grandin
fcb0280c10 remove accidentally committed files
Change-Id: Ib41f16f945f6b7a5ba314b13ce8a7b24c35a8edb
Reviewed-on: https://gerrit.libreoffice.org/33947
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-02-06 07:57:15 +00:00
Noel Grandin
8b2ffb280b loplugin:unusedenumconstants in vcl
- drop TTCR_GLYPHSEQ
- drop ImageType::Invalid
- give preedit_data_t a default constructor, so my plugin spots that the
eState field is being initalised to DontKnow effectively by a memset
- document ToolbarIconSize::Small as unused, but can't remove since
it might be stored in a user-setting somewhere

Change-Id: I94b34bba83a04de16f95e4faec95b4bd29f3c652
Reviewed-on: https://gerrit.libreoffice.org/33887
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-02-06 05:48:02 +00:00
Miklos Vajna
839e53b933 compilerplugins: enable loplugin:cppunitassertequals by default
This forces writing a comparision of two variables in the
CPPUNIT_ASSERT_EQUALS(expected, actual) form, rather than
CPPUNIT_ASSERT(actual == expected). The benefit is when the test fail,
it's more clear what are these two values, rather than just seeing that
they are not equal.

In the relatively rare case when the types are not streamable, the
plugin can be silenced using CPPUNIT_ASSERT(bool(it == foo.end())). But
please always first consider making the type streamable instead. See
commit 0e1b831b93048c68735f2e2dbdcee587db4862ef
(CppunitTest_vcl_complextext: fix loplugin:cppunitassertequals warnings,
2016-12-16) for an example.

Change-Id: I564fb0724836b6dbbea9262b53ad646e285a339c
2017-02-03 12:20:03 +01:00
Noel Grandin
22326cb4f5 new loplugin unusedenumvalues
Change-Id: I03d684fc35238a45a6d99855e5ee6d3a5e33740d
2017-02-03 11:28:44 +02:00
Stephan Bergmann
6abbbe7015 Fix copy/move ctor check
Change-Id: I2993d5809204098e29a7560d666fa1aafb024a89
2017-02-02 11:49:20 +01:00
Noel Grandin
02957bc3b7 loplugin:stringconstant, this should be a break
after commit dce867e8c4863c969eea3515a988630b74708a43
"loplugin:stringconstant handle calls to constructors with one arg"

Change-Id: Ib572d904a95aa96aab3c799f9b7cfb505fcee5e6
2017-02-02 11:35:06 +02:00
Stephan Bergmann
1028e5192c More ctor check fixes
Change-Id: Ifcce63b975fb7c4ac7e7545e3eadcc6f7f12e466
2017-02-01 15:38:50 +01:00
Stephan Bergmann
836b74aead Fix ctor check
Change-Id: Ie261d5412c510c045b4d93a6bf1a3d4cf4371897
2017-02-01 15:31:37 +01:00
Noel Grandin
994e38e336 loplugin: use TypeCheck instead of getQualifiedNameAsString
since the latter is rather slow

Change-Id: Ib73cdb923585580777c2265b561c1808e93b2baa
Reviewed-on: https://gerrit.libreoffice.org/33585
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-02-01 12:49:42 +00:00
Noel Grandin
2489000d3f loplugin:useuniqueptr extend to check local vars
just the simple and obvious case for now, of a local var being allocated
and deleted inside a single local block, and the delete happening at the
end of the block

Change-Id: I3a7a094da543debdcd2374737c2ecff91d644625
Reviewed-on: https://gerrit.libreoffice.org/33749
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-02-01 12:15:22 +00:00
Noel Grandin
dce867e8c4 loplugin:stringconstant handle calls to constructors with one arg
Change-Id: Ide9148a908bef46ba14640dfa6f556beaf6e3f60
Reviewed-on: https://gerrit.libreoffice.org/33772
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-02-01 07:57:16 +00:00
Noel Grandin
1c3e84d819 teach lolugin:stringconstant about calling constructors
so we can remove unnecessary calls to the OUString(literal) constructor
when calling constructors like this:
   Foo(OUString("xxx"), 1)

Change-Id: I1de60ef561437c86b27dc9cb095a5deb2e103b36
Reviewed-on: https://gerrit.libreoffice.org/33698
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-01-31 08:56:20 +00:00
Noel Grandin
f1d83ac45f loplugin:stringconstant check for unnecessary OUString constructor..
..calls when creating exceptions

Change-Id: I3bc58a5aa4dc6f0508ecb88b3a843b96b8c7ebfe
Reviewed-on: https://gerrit.libreoffice.org/33617
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-01-28 09:22:55 +00:00
Stephan Bergmann
53a9e834f0 ...and Clang 4 will have it, too
Change-Id: Ia927ed7d1e7815e59ccb67246da6981c65683168
2017-01-27 11:58:18 +01:00
Stephan Bergmann
f4fac7f341 getExceptionSpecSourceRange is new in Clang 5
Change-Id: Ifa9223fadeeb1fde54afc99874a1b3d855073dce
2017-01-27 11:50:36 +01:00
Noel Grandin
2d506f4c3d fix spelling containging->containing
Change-Id: I49f736c049735e89ce9f71740f5c308120378a9a
2017-01-27 12:43:41 +02:00
Noel Grandin
4511431fb6 improve "unnecessary user-declared destructor" check
to look for inline&empty destructors, where we can just let
the compiler do it's thing

Change-Id: Ibde8800bdfed6b77649c30ebc19921167c33dec3
Reviewed-on: https://gerrit.libreoffice.org/32999
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-01-27 09:49:04 +00:00
Stephan Bergmann
1a90a23d9f Enable loplugin:dynexcspec rewriting mode
Change-Id: I73404287c387a36e224683f75e967d51d911175b
2017-01-27 10:47:16 +01:00
Stephan Bergmann
38da1ed919 Make plugin rewriting work on Windows too
...in a somewhat hacked-up way for now (see the TODO comment)

Change-Id: Ida89fb8257b876cfca05b3048ce15996091c5703
2017-01-27 10:46:15 +01:00
Stephan Bergmann
b61214c91d Remove dynamic exception specifications from !LIBO_INTERNAL_ONLY
...only odk/examples/ remains to be clean up

Change-Id: I875a1e8d6750b6b007bd75126b8010273e1f32d5
2017-01-27 10:40:41 +01:00
Stephan Bergmann
aee1d799be Make test work with older Clang
For some reason, e.g. Clang 3.8.1 doesn't evaluate std::strlen here (though it
apparently does in other places in this file).

Change-Id: Ib2b7dcc1d7b6ae47ef285bd2edb65e399dc11b79
Reviewed-on: https://gerrit.libreoffice.org/33547
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Tested-by: Stephan Bergmann <sbergman@redhat.com>
2017-01-26 08:36:51 +00:00
Tor Lillqvist
907a9ce8b8 Bypass some lines that cause problems with Clang 3.8.1 at least
Change-Id: I05202ee6b2f083e8aacf0a2a8f8d7b8b361a5df8
2017-01-25 11:56:54 +02:00
Stephan Bergmann
236f69e710 Minor loplugin:stringconstant improvements
Change-Id: I0b39526c0f0854ddbb29e77ece303cf2bdd842c4
2017-01-25 07:58:10 +01:00
Stephan Bergmann
09768d8ee4 Use proper check for FunctionProtoType
...as at least MSVC SAL_CALL-annotated functions have an AttributeType wrapped
around the FunctionProtoType.

Change-Id: Ic085e2e3649e6b2fc8ca380047133a8edbe20589
2017-01-24 17:30:51 +01:00
Noel Grandin
fe2164949b teach unusedvariablecheck plugin about SfxPoolItem subclasses
which can all be treated as SAL_WARN_UNUSED

The eehtml.cxx change probably fixes some CJK/CTL bug somewhere

Change-Id: I6852129540f316075aee907971ac19418d71dd9a
2017-01-24 13:19:39 +02:00
Noel Grandin
98e4013c22 new loplugin useuniqueptr
Change-Id: Ic7a8b32887c968d86568e4cfad7ddd1f4da7c73f
Reviewed-on: https://gerrit.libreoffice.org/33339
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-01-23 06:59:17 +00:00
Stephan Bergmann
28ec4d1456 New loplugin:dynexcspec: Add @throws documentation
See the mail thread starting at
<https://lists.freedesktop.org/archives/libreoffice/2017-January/076665.html>
"Dynamic Exception Specifications" for details.

* The check for missing @throws documentation is not too specific, it just
  checks whether a function with dynamic exception specification has /any/
  @throws clause, not necessarily exactly matching the exception types.  (Many
  of the details in the existing dynamic exception specifications are probably
  not very useful, anyway.)

* When adding @throws clauses, I bluntly copied the exception specifications
  except for dropping any mentions of std::exception (except in the rare cases
  where that was the only exception typed mentioned).

* In many places it might have looked more natural to use trailing Doxygen
  comments of the

    ///< @throws ...

  kind, but Clang's getCommentForDecl unfortunately doesn't detect trailing
  comments on function decls.

* Also, Clang's getCommentForDecl doesn't look into macros, so some trivial
  silly macros were expanded along the way to add comments where necessary.

Change-Id: I1831d72df2d9c801d4b8dd7d708d9cefea039589
2017-01-19 18:03:26 +01:00
Stephan Bergmann
0f4f5621d1 Use compat::isLookupContext
Change-Id: I5b4523929f971d0345f112ba4f5faff1181cee2b
2017-01-16 10:26:03 +01:00
Noel Grandin
978ff8f55c inline InitGuard
since it is only used in one place

Change-Id: Ie541a255ddbe71105f6b58f02f372f4f45667d7a
2017-01-13 11:59:01 +02:00
Stephan Bergmann
38d1c303e1 Adapt loplugin:overrideparam to recent Clang trunk change
Change-Id: Ia372e39bc7e51f290a6d631bf0b81fd75f4fdc1d
2017-01-12 15:19:22 +01:00
Stephan Bergmann
b820de995d Remove leftover code
Change-Id: I3f6e9ec0343074b506cb07b1ad5c9b3e1ef20b5e
2017-01-11 16:57:21 +01:00
Stephan Bergmann
584262fed1 loplugin:stringconstant: handle OStringBuffer::append
Change-Id: I283da52c0ee2b63c19e31e9a61ab24997c037a6a
2017-01-11 16:39:43 +01:00
Stephan Bergmann
a9d06182f8 loplugin:externvar (clang-cl)
Change-Id: I81877e46cf95dcc7de16b797fca33658036bf9e8
2017-01-11 13:42:41 +01:00
Stephan Bergmann
6ec5717e06 loplugin:externvar (clang-cl)
Change-Id: I638199f1455bead71f0a03f15e4b6f418a0cd0e2
2017-01-11 13:42:40 +01:00
Stephan Bergmann
618785dfd2 Some loplugin:conststringvar/stringconstant improvements
Change-Id: I73f694e6dedb84b3fb3b63ffb9dcda2481bc403c
2017-01-11 11:27:40 +01:00
Stephan Bergmann
629765804a Work around problems with isCXX11ConstantExpr in template code
> template<size_t Size>
> bool checkOutput(ScDocument* pDoc, const ScRange& aOutRange, const char* aOutputCheck[][Size], const char* pCaption)
> {
>     ...
>             const char* p = aOutputCheck[nRow][nCol];

in sc/qa/unit/helper/qahelper.hxx caused

>    assert(E->isRValue() && E->getType()->hasPointerRepresentation());

in Clang's EvaluatePointer (lib/AST/ExprConstant.cpp) to fire.  In the template
definition itself, Clang doesn't introduce ArrayToPointerDecay ImplicitCastExpr
into the subscripting operations (while in any implicit specializations that it
instantiates, it does).

This is interesting:  Up to C++11, [expr.sub] requires the operator to have
pointer type (so array-to-pointer decay is clearly asked for).  In C++14
(CWG1213), the operator can also be of array type but it is not explicitly
specified whether array-to-pointer decay is to be performed.  In upcoming C++17
(P0135R1), it specifies further that an operator of array type must be a glvalue
but still does not explicitly specify whether array-to-pointer decay is to be
performed.  Maybe the definition of the subscripting operation in terms of
*((E1)+(E2)) is meant to imply that, however.

Change-Id: I67c7b0f34002387dbf746288630371877c6261ef
2017-01-10 14:35:05 +01:00
Stephan Bergmann
0d2ac4afe9 New loplugin:conststringvar
Change-Id: I16648b018ed0f69a085322cfb88481ee2a0c27ca
2017-01-10 08:12:52 +01:00
Stephan Bergmann
ce38f88151 New loplugin:externvar
Change-Id: Ie5404f11cbc5b05bd18455ae81526eb2de01548c
2017-01-09 15:44:47 +01:00
Stephan Bergmann
a7d554f3b2 New loplugin:charrightshift
Change-Id: Ib645fb11004bc0fe05c9c416ae72b0ae56c23a15
2017-01-06 18:15:24 +01:00
Stephan Bergmann
ad9cfbcf02 Don't exclude a var from loplugin:salbool merely because of use in >>=
Change-Id: I1b8a3dfa1dc6b351ab0903a74eae19dfa6d0888d
2017-01-05 09:17:47 +01:00
Noel Grandin
0b55d7e0fe merge IScript with NewStyleUNOScript
Change-Id: Iae70d0780678eb8df8a9e57fce5fc2f6c5ed427e
Reviewed-on: https://gerrit.libreoffice.org/32375
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2016-12-23 12:21:29 +00:00
Noel Grandin
c4c23515d6 merge svx::sidebar::BulletsSettings with svx::sidebar::BulletsSettings_Impl
Change-Id: I7cf6bb4cf3aa532718753904c2100882b0df6775
Reviewed-on: https://gerrit.libreoffice.org/32373
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2016-12-23 11:43:10 +00:00
Noel Grandin
b641929e69 merge StringNode with RscDefine
Change-Id: Ia64b7419ccbb06ff55907717963864caef2023a8
Reviewed-on: https://gerrit.libreoffice.org/32374
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2016-12-23 11:42:34 +00:00
Noel Grandin
16fa8b0bca update results from mergeclasses plugin
Change-Id: Ie92ebbae246007609fa4b65e8b9cf1ca16e62cc5
2016-12-23 07:15:56 +02:00
Stephan Bergmann
1dc43e24b3 Generalize vector/deque ctor checks to work with MSVCRT
Change-Id: I2d493a36b8c2e3abe69964c04b46f08d67ef8a48
2016-12-22 09:23:19 +01: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