909 Commits

Author SHA1 Message Date
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
Stephan Bergmann
c74688dfd4 That whitelisted code is already gone again
Change-Id: I1fa04b51823ac9707f0dd3d7c8209c69e917ef28
2016-12-22 08:58:09 +01:00
Stephan Bergmann
595ff0c6ea Also don't warn for plain C code
...as needed by clang-cl for
bean/native/win32/com_sun_star_comp_beans_LocalOfficeWindow.c

Change-Id: I862afb6b549015d951a898ee415370540ffab1f6
2016-12-22 08:54:04 +01:00
Tomaž Vajngerl
bf5f6df9e4 vcl: separate ImplImageTree - ImageTree singleton and public iface
ImplImageTree was used outside of VCL which is not consistent with
the name and the header also contains a lot of implementation
detail. This separates the implementation to ImplImageTree and
the public interface and singleton to ImageTree only.

Change-Id: I3a26444f0f6971a6b1d83472e9cef19c93192d3e
Reviewed-on: https://gerrit.libreoffice.org/32134
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Tested-by: Tomaž Vajngerl <quikee@gmail.com>
2016-12-19 07:26:24 +00:00
Noel Grandin
f9fd6390cd ScrollableWrapper -> ScrollableDialog
no point in having a template and a virtual base class when it's only
used for one type

Change-Id: Idb1a1a551064cc10896eff33652038eb5be0297e
Reviewed-on: https://gerrit.libreoffice.org/32041
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2016-12-19 06:04:33 +00:00
Stephan Bergmann
54aab71ff7 On Windows, #include <process.h> for getpid
Change-Id: Ibfb52800cdde99298431dab9da1cb8109658c425
2016-12-18 22:43:30 +01:00
Stephan Bergmann
35196c3275 loplugin:vclwidgets: Adapt check for 'assert' for MSVCRT
Change-Id: I12a77b5b53e3a674c1ff1554b560a71605e141a6
2016-12-18 22:43:29 +01:00
Stephan Bergmann
83ff2a4f38 loplugin:stringconstant: Adapt to definition of OSL_THIS_FUNC on Windows
Change-Id: I93a23799ad9a76ed9f4f86d69adb610d0962da20
2016-12-18 22:43:29 +01:00
Stephan Bergmann
9ed9ca611a loplugin:stringconcat: Adapt to definition of OSL_THIS_FUNC on Windows
Change-Id: I9a2be8c4265095ff2ac5e2216cb08c35c9049bf8
2016-12-18 22:43:29 +01:00
Stephan Bergmann
dbbd2c48b1 Work around problem with poor gperf-generated code under clang-cl
Change-Id: Iba3fae8bbecaf5782228be1fb99f196864d79e6b
2016-12-18 22:43:28 +01:00
Stephan Bergmann
f2ef97dee7 loplugin:fpcomparison: Whitelist some Windows-only functions
Change-Id: I94f35696ba358a049ee65764d17c62df7889aec7
2016-12-18 22:43:28 +01:00
Stephan Bergmann
09f5ffafc2 loplugin:commaoperator: Ignore occurrence in FD_SET expansion on Windows
Change-Id: I66974c273918d6d887364e7d552e3caf63e16343
2016-12-18 22:43:27 +01:00
Stephan Bergmann
c052ec5add Chose better diagnostic location
Change-Id: I502da4b93905e64ca5506f24dc1f6bf2bf990dc2
2016-12-18 22:43:27 +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
ec0665ac8b Rename cdecl -> classdecl (MSVC treats the former like a keyword)
Change-Id: I1859a92c996b907b8d511cddba25c00c9a52f398
2016-12-18 22:43:26 +01:00
Stephan Bergmann
83d2c5180d Adapt to no-longer explicit OUStringLiteral ctor
...from previous commit

Change-Id: I062b7cd212c17e7eb5274476e6859228d0477c7f
Reviewed-on: https://gerrit.libreoffice.org/32098
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Tested-by: Stephan Bergmann <sbergman@redhat.com>
2016-12-17 16:12:02 +00:00
Stephan Bergmann
9d7802e7fc Make move detection in loplugin::passstuffbyref work for parenthesized cases
Change-Id: I56754a718af9433c0fa654ccb8eb34da00e75420
2016-12-16 15:16:37 +01:00
Stephan Bergmann
b998313d9d Make move detection in loplugin:passstuffbyref work with MSVCRT
...where an ImplicitCastExpr happens to appear between CXXConstructExpr and
CallExpr

Change-Id: I62226cc89d87bd3d9c03743b650f10c32c18f9be
2016-12-16 15:14:23 +01:00
Noel Grandin
bd6723fd53 disable the 'two different log areas in the same file' loplugin check
too many false+ to leave it alive by default

Change-Id: I6d8f92b630c351c1ac788fad79f8d7c435ba4963
2016-12-15 14:11:16 +02:00
Noel Grandin
d15b4e2045 teach sallogareas plugin to catch inconsistencies
Change-Id: I8bcea5ffc74d48148bea78da8c17744e288c069a
Reviewed-on: https://gerrit.libreoffice.org/32004
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2016-12-15 06:45:14 +00:00
Stephan Bergmann
37b21a0a71 Merge shell into TaskManager base class
(arbitrarily decided to keep the latter, being the less odd class name)

Change-Id: I5c061a0f12b8f3095e283b4896f7c910948ac50f
2016-12-14 17:52:38 +01:00
Stephan Bergmann
4e9dd6e1b7 Disambiguate clang::StringLiteral
...vs. recently introduced llvm::StringLiteral (llvm/ADT/StringRef.h)

Change-Id: I4d74546b0d1401a74b0c15368bbc93794ecd0b1d
2016-12-14 15:52:33 +01:00
Stephan Bergmann
c826ddfc2c Check that VclPtr is only instantiated with appropriate types
...deriving from VclReferenceBase.  Complicated by the fact that the argument
type may be incomplete at the time of template instantiation.  So this approach
may be less precise than the change to loplugin:vclwidgets from
cbf5b21f2a65bbb342295200f6ad93a00f90733e "Catch some misuses of VclPtr
construction" when the argument type becomes complete later in the comilation
unit.  However, this approach would also catch the two misuses in UnoControls
found by cbf5b21f2a65bbb342295200f6ad93a00f90733e, so go with this approach for
now and revert the change to loplugin:vclwdigets.

Change-Id: I7888f23d2b9e2db81ae2ce4bf4c8277912317685
Reviewed-on: https://gerrit.libreoffice.org/31966
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2016-12-14 09:34:01 +00:00
Stephan Bergmann
385f624027 Prevent use of ORowSetValue with sal_Bool as TINYINT
sal_Bool and sal_uInt8 are typedefs for the same underlying type, so any use of
ORowSetValue with sal_Bool instead of bool, apparently intending to treat the
value as a boolean, actually treated it as a TINYINT.  (See e.g. recent
7b0c57b2faec875c790051d233d1e9abaed2a3bc "some compilers don't like implicit
bool-to-ORowSetValue conversion".)

Now that there's no way to create a sal_uInt8 ORowSetValue, getUInt8 and the
m_uInt8 union member can probably go away, too.

Change-Id: Ia27554f76e7e9edce6410284b578064573e54fd3
Reviewed-on: https://gerrit.libreoffice.org/31909
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2016-12-12 18:02:57 +00:00
Tor Lillqvist
2da2cfcb19 Whitelist aLogger, in FormulaLogger& FormulaLogger::get()
To avoid this:

sc/source/core/tool/formulalogger.cxx:55:26: error: bad static variable causes crash on shutdown [loplugin:badstatics]
    static FormulaLogger aLogger;
    ~~~~~~~~~~~~~~~~~~~~~^~~~~~~
sc/inc/formulalogger.hxx:42:31: note: ... due to this member of 'FormulaLogger' [loplugin:badstatics]
    const ScFormulaCellGroup* mpLastGroup = nullptr;
    ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
sc/inc/formulacell.hxx:66:20: note: ... due to this member of 'ScFormulaCellGroup' [loplugin:badstatics]
    ScFormulaCell *mpTopCell;
    ~~~~~~~~~~~~~~~^~~~~~~~~
sc/inc/formulacell.hxx:114:21: note: ... due to this member of 'ScFormulaCell' [loplugin:badstatics]
    ScDocument*     pDocument;
    ~~~~~~~~~~~~~~~~^~~~~~~~~
sc/inc/document.hxx:312:27: note: ... due to this member of 'ScDocument' [loplugin:badstatics]
    VclPtr<SfxPrinter>    pPrinter;
    ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~

Change-Id: I533e45f655ca928a801188aa48ee818d89a962ac
2016-12-12 15:52:53 +02:00
Stephan Bergmann
a9659f30d6 No need for rtl::Reference friend, no need for #include vclptr.hxx
Change-Id: I7bdd15a93e728ef7e98a53001c6eb6b56f761a6d
2016-12-09 20:01:52 +01:00
Stephan Bergmann
cbf5b21f2a Catch some misuses of VclPtr construction
...that go unnoticed due to the non-explicit VclPtr::oeprator reference_type *

Change-Id: Ia63edf8425d3ecb7c7f98eb56a710ac0cceccb67
2016-12-09 20:00:26 +01:00