973 Commits

Author SHA1 Message Date
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
Miklos Vajna
dc1925e6f0 sw: remove some inline version control in uibase
Change-Id: I7125b6f8593cac2c33916341f5649f57044ad045
Reviewed-on: https://gerrit.libreoffice.org/31761
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Jenkins <ci@libreoffice.org>
2016-12-08 16:24:12 +00:00
Stephan Bergmann
9e258eca6d Replace calls to get(Qualified)NameAsString with stuff from check.hxx
Change-Id: I14e48ea5c59bdd12ad6484222b3e8733664e78c4
Reviewed-on: https://gerrit.libreoffice.org/31712
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2016-12-07 07:11:32 +00:00
Noel Grandin
2e293a731c new loplugin/rewriter comparisonwithconstant
As per sberg' suggestion

Limit it to == and !=, because some people like the flow of inequalities
like: "0 < a && a < 42"

The changes to sal/ were made using the rewriter.

The rewriter still has one bug, in pipe.cxx, it managed to pick up
some random piece of macro. No idea why.

Change-Id: I01305f9c5396a4b6c7421d6e92f1b4b529388e82
Reviewed-on: https://gerrit.libreoffice.org/30962
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2016-12-06 05:38:14 +00:00
Stephan Bergmann
03c215ab07 loplugin:unnecessaryoverride (dtors)
Change-Id: Ia38672028668959bf3d5541fe4ddb9fb72848617
2016-12-05 09:06:14 +01:00
Noel Grandin
8cf59c6743 make passstuffbyref plugin ignore std::move'd params
request from vmiklos

Change-Id: If263beb0623d725e406003bb1660df10fe4b4e35
Reviewed-on: https://gerrit.libreoffice.org/31555
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2016-12-05 05:53:25 +00:00
Stephan Bergmann
51b502bb53 Missing include
Change-Id: I6af48e37b1b796a1680447ff972de8b5f5623d26
2016-12-01 23:42:09 +01:00
Noel Grandin
e6ffb539ee loplugin:vclwidgets check for assigning from VclPt<T> to T*
Inspired by a recent bug report where we were assigning the result
of VclPtr<T>::Create to a raw pointer.

As a consequence, we also need to change various methods that were
returning newly created Window subclasses via raw pointer, to
instead return those via VclPtr

Change-Id: I8118e0195a5b2b4780e646cfb0e151692e54ae2b
Reviewed-on: https://gerrit.libreoffice.org/31318
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2016-11-29 06:45:42 +00:00
Stephan Bergmann
1800862c70 loplugin:stringconstant: look into 'char const * const var = "..."'
Change-Id: I52a97b8ec273509131c2200e47527221cb62d7ee
2016-11-25 16:42:23 +01:00
Stephan Bergmann
f1eb0bf752 Clean up CLANG_VERSION check
Change-Id: Idfdffd73e9029216775d2a6ad46293ee1a4f1308
2016-11-25 11:24:12 +01:00
Stephan Bergmann
bf53daa49a Clean up PPCallbacks compatiblity fix
Change-Id: I91f1db18b7876c4ecc30f7f97283e0ef0369eba5
2016-11-25 11:22:14 +01:00
Stephan Bergmann
6eaa7a41d8 Blind fix for Clang 3.6
Change-Id: I56dc86df0d355cfa8af38661892ea2bb580c394b
2016-11-24 14:49:52 +01:00
Miklos Vajna
7aa2b5a041 CompilerTest_compilerplugins_clang: fix this to work with clang-3.7
Change-Id: I653b9c3aba53da421592b230bee3a9b69d3cb2d7
2016-11-24 12:11:59 +01:00
Noel Grandin
29a9e97db6 loplugin field-can-be-private in include/vcl..xmlscript
Change-Id: Ia03f7cccb256d825daa4dc6f4c0598448e46e6cf
Reviewed-on: https://gerrit.libreoffice.org/31069
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2016-11-23 07:17:50 +00:00
Stephan Bergmann
0de1b34a89 New loplugin:oslendian
...to catch new places where defined'ness of OSL_BIG/LITENDIAN would be checked
without osl/endian.h being included; cf.
e2f08f9def0869460ad38a1c2adb450778290f6e "connectivity, sc: add missing #include
<osl/endian.h>" and 2b14fb3a4f92b928f0a5fc536c6a5f4a6e51a9b8 "cppcanvas, oox:
add missing #include <osl/endian.h>".

Change-Id: I167c8916a01391b7dacad7325153ccf35d3ba9dc
2016-11-22 10:54:25 +01:00
Noel Grandin
6f9cdf0814 can-be-private analysis needs to ignore virtual methods
Change-Id: I1e2f28ed550ff9751912f70e3eec511ddc5b75cf
2016-11-22 08:34:16 +02:00
Stephan Bergmann
883024d657 FieldDecl::getParent fires assert for Objective C @interface members
(like in vcl/inc/osx/a11ywrapper.h's AquaA11yWrapper), at least on recent Clang
trunk, from within the call to cast() in

  cast<RecordDecl>(getDeclContext())

as the decl context apparently is something other than a RecordDecl.

Change-Id: I238bae44d6db0f04bf8f90b0032489e3b4822eee
2016-11-21 23:02:04 +01:00
Noel Grandin
04f262ace0 new loplugin datamembershadow
Change-Id: Ib14319848bafd1fe7e0e663c434bbdeef5e98ecf
Reviewed-on: https://gerrit.libreoffice.org/30963
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2016-11-21 06:19:52 +00:00
Noel Grandin
2f7ccd102a extend unusedfields loplugin to find fields that can be private
and apply the results in xmlscript

Change-Id: Ib126f6e1576639abfd171e99d9561be9715ece2f
2016-11-17 08:40:27 +02:00
Noel Grandin
92da39d5f9 update couple of loplugins for move constructors
Change-Id: I82140569a3e09225065d721e4aeac5c5fe93bc45
2016-11-16 14:16:09 +02:00
Stephan Bergmann
1034ee0c09 Reduce noise for irrelevant warnings somewhat
...other options to avoid such irrelevant warnings can be to move code to an
include file and/or to define a dummy main() accessing otherwise unreferenced
entities.

Change-Id: Ifd44e376b35ef68496f3aba6a3c046d684824000
2016-11-16 11:10:39 +01:00
Noel Grandin
7cca2c7fb3 new loplugin finalprotected
look for final classes, and make sure they don't have protected members

Change-Id: I1fa810659bba02b61a5160dbfd8e24185ec9abf4
Reviewed-on: https://gerrit.libreoffice.org/30895
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2016-11-16 09:10:16 +00:00
Stephan Bergmann
645583dfd3 New compilerplugins/clang unit tests
...to check that loplugin produces warnings/errors as expected:

* Clang has a -verify switch that makes it easy to write test input .cxx files
  that list in comments all the warnings/errors that are expected, and let Clang
  check those expectations instead of generating object code.  See
  include/clang/Frontend/VerifyDiagnosticConsumer.h in the Clang source tree for
  documentation.

* Introduce a CompilerTest gbuild class that uses the existing LinkTarget class
  as much as possible.  Checking the input files is implicitly phony, as the
  compilation step doesn't generate any object files, and the link step does
  nothing because there is no gb_LinkTarget_set_targettype for CompilerTest.
  The setup at least works for Clang on Linux (will need adaptions for Clang on
  Windows; compilers other than Clang are not relevant for now given this is
  used to check compilerplugins).

* Definition of gb_CFLAGS_WERROR in solenv/gbuild/platform/com_GCC_defs.mk needs
  to be lazy ('=' vs. ':=') so that CompilerTest can override it:  The Clang
  -verify mode wants the input files to specify whether the loplugin diagnostics
  are warnings or errros, so they consistently need to be errors independent of
  --enable-werror configuration.

* A first (example) test is in compilerplugins/clang/test/salbool.cxx.  The
  corresponding gbuild CompilerTest instance is in
  solenv/CompilerTest_compilerplugins_clang.mk for now.  The reason for that odd
  split across compilerplugins/ and solenv/ is that there is no
  compilerplugins/Modules_compilerplugins.mk file, so this setup is the easiest
  hack for now (to be cleaned up).  (Another area that could be improved is that
  all test files need to be listed explicitly in the CompilerTest_*.mk file,
  instead of, say, using all .c/.cxx/.m/.mm files in a specified directory.)

* The test is run somewhat late during a top-level 'make', after loplugin has
  already been used in compilation.  But it can be run manually (e.g., 'make
  solenv') when making changes to loplugin during development.

Change-Id: I01e12fb84887d264ac03ef2484807458c2075af4
2016-11-15 11:09:29 +01:00
Stephan Bergmann
682899e313 CXXDestructorDecl is already handled
...a few lines up, together with CXXConstructorDecl

Change-Id: Id9afd4d3936b2efb92de3c6ab950da78d876a5a8
2016-11-14 16:47:25 +01:00
Noel Grandin
391c6aeeed ignore constructors for method-can-be-private analysis
doesn't work right now

Change-Id: I43693104f4af204a6bd0c22b0f7ef53c1a14bb6e
2016-11-14 13:56:13 +02:00
Mike Kaganski
450762b224 tdf#68118: Pass current document frame to SvxScriptSelectorDialog
... through MacroChooser
Without this, current document's macros library is unavailable in
"Assign" dialog

Change-Id: I83baa3b98858260eab61e8f4fefde3f9979c6d83
Reviewed-on: https://gerrit.libreoffice.org/30600
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
2016-11-14 08:56:42 +00:00
Noel Grandin
78b4a1fb01 update vclwidget loplugin to find ref-dropping assigment
Look for places where we are accidentally assigning a returned-by-value
VclPtr<T> to a T*, which generally ends up in a use-after-free.

Change-Id: I4f361eaca88820cdb7aa3b8340212db61580fdd9
Reviewed-on: https://gerrit.libreoffice.org/30749
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2016-11-11 06:55:41 +00:00
Noel Grandin
8955c3fde6 loplugin:oncevar
Change-Id: I44fb6858eeff14fcbd9fdfbbb0aabd1433b6a27d
Reviewed-on: https://gerrit.libreoffice.org/30668
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2016-11-08 06:11:51 +00:00
Eike Rathke
8e38964c32 move loplugin:defaultparams to store/
As per IRC 2016-11-04 12:21

Change-Id: Ic4cc7f67fb31be80a966c652cb30bb859f874a8b
2016-11-04 12:28:57 +01:00
Stephan Bergmann
cbb7b10b6b -Werror=unused-function
Change-Id: I33790862cfe40693921d07182ccf4645c3ef28a3
2016-11-04 09:20:49 +01:00
Noel Grandin
5f77e6e930 update loplugin:unnnecessaryvirtual to handler destructors
and update modules writerfilter..xmloff with the resulting changes

Change-Id: I54d19c22ddb0ff579b32e4934d266c925b19305c
Reviewed-on: https://gerrit.libreoffice.org/30530
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2016-11-04 07:15:03 +00:00
Noel Grandin
3fea7ac94b loplugin:unusedfields
Change-Id: I96634c18ba6600f8f7d5d04a162dcd7e1e312923
Reviewed-on: https://gerrit.libreoffice.org/30474
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2016-11-02 07:54:20 +00:00
Noel Grandin
5e997f4dba disable this chunk of loplugin code on clang < 3.8
not worth the spaghetti of making it work across version

Change-Id: I0de923b16fb6d58cbad55adc9878ab39bc0c86ae
2016-11-01 12:58:17 +02:00
Stephan Bergmann
f25a15dc99 loplugin:vclwidgets: Adapt iterator hack to libc++
Change-Id: I1e4fbb06578b2b1d6de4b57507693b014d36cd3a
2016-10-31 21:01:18 +01:00
Stephan Bergmann
7441141bcf No good reason for dbaccess::OCacheSet::updateRow to be pure?
Most of its virtual member functions are (though insertRow is already a curious
exception), even though they are defined, so smells like a copy/paste error
rather than deliberate design.  And appears to have been the only reason why
loplugin:unnecessaryoverride filtered out such overriding of pure base
functions.

Change-Id: Ib2a40af9cd3cd3dbb26c4147f7d01de4e11f5f6e
2016-10-31 11:38:49 +01:00
Noel Grandin
eaf32cd43c fix unnecessaryoverride clang plugin on clang < 3.8
Change-Id: Id78d694cf7271a6abf94234958ab623cf1cd93a5
2016-10-31 11:54:06 +02:00
Noel Grandin
978c6e7a8f update vclwidgets plugin to check local variables
Change-Id: I91f7fc6b8419c0ed82194726eeb4c4657e998f22
Reviewed-on: https://gerrit.libreoffice.org/30428
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2016-10-31 09:44:46 +00:00
Khaled Hosny
0fd8ef082d Rename ServerFont to FreetypeFont
This is what it is actually is, we dropped support for server-side fonts
for a long time now. Renamed also a few related classes, but left
ServerFontLayout* ones as they will go away soonish.

Change-Id: I68a6dad51b6972368b7bf85a0b9c8089cc12740e
Reviewed-on: https://gerrit.libreoffice.org/30390
Reviewed-by: Khaled Hosny <khaledhosny@eglug.org>
Tested-by: Khaled Hosny <khaledhosny@eglug.org>
2016-10-30 12:54:00 +00:00
Noel Grandin
8a22bc93e0 update unnecessaryoverride plugin to find pure forwarding methods
which can be replaced with using declarations.

Is there a more efficient way to code the search? Seems to slow the
build down a little.

Change-Id: I08cda21fa70dce6572e1acc71bf5e6df36bb951f
Reviewed-on: https://gerrit.libreoffice.org/30157
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2016-10-28 12:56:17 +00:00
Stephan Bergmann
97c28ad74f Various loplugin warnings in --enable-telepathy
Change-Id: I4c437491466c3029f2a9c93fb630c7b5a8d2ff21
2016-10-28 08:52:46 +02:00
Tor Lillqvist
3be8c4c2bb The badvectorinit plug-in probably can be retired
Let's hope it only catches false positives now.

noelgrandin agrees.

Change-Id: Ibd8310c31897aa6835bd6aaf90a49b5cd8f92948
2016-10-21 14:18:20 +03:00
Noel Grandin
e9ada6294d fix bug in expandablemethods plugin
where using a std::map instead of a std::set meant that it
sometimes miscounted the number of callsites

Change-Id: I1e2ebcf44fe006827e66620ae4c9bbc813835414
2016-10-20 10:49:58 +02:00
Stephan Bergmann
d6ff3d49df Plugin::isInUnoIncludeFile should not cover WORKDIR
...that got in, for no apparent reason, when various, slightly different
implementations of isInUnoIncludeFile got consolidated into one.

Change-Id: I64a9eb62703d57a0b7b57720ec9f251ffa780691
2016-10-19 10:56:35 +02:00
Noel Grandin
e7782a99a5 accidentally left the expandablemethods loplugin active
Change-Id: Ifadab184876163195ea3307ec32d2eed4ee00b92
2016-10-19 08:40:17 +02:00
Noel Grandin
98b77ad1e6 loplugin:expandablemethods in UnoControls..vbahelper
Change-Id: Iec2c5e13119d97c9ca87e083c0f7cb00227e5231
Reviewed-on: https://gerrit.libreoffice.org/29997
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2016-10-19 06:24:23 +00:00
Stephan Bergmann
7eea236a24 -Werror=unused-function
Change-Id: I9e0585460d908024f75a1134bc1cd20d12ea3b4e
2016-10-18 09:12:27 +02:00
Noel Grandin
5af68a26f1 rename inlineablemethods plugin to expandablemethods
and add support for nested functions

Change-Id: I63daee5b3047fa1ed5de0e5ddaf998f8b17bc780
2016-10-18 08:51:07 +02:00
Noel Grandin
40fd53a238 loplugins: extract some common functionality
Change-Id: If470e1d9b481c9eda0829aa985152baf8fb46d7a
2016-10-18 08:51:07 +02:00