764 Commits

Author SHA1 Message Date
Stephan Bergmann
a94a0b148c Could swear I'd seen this produce a bogus compiler error
...but now it apparently works

Change-Id: Iac1b4e49788ac620ed55dec7a52c839ba2937f5b
2016-06-14 08:43:03 +02:00
Stephan Bergmann
8110dd24d1 Fix loplugin:passstuffbyref to not warn when ref param is bound to ref
cf. d150eab88ee26d5c05a6d662a2c13c6adea8ad78 "loplugin:passstuffbyref: For now
disable 'pass parm by value' warnings".  At least all the other changes in
4d49c9601c9b3e26a336e08e057d299895683480 "Let loplugin:passstuffbyref also look
at fn defn not preceded by any decl" were OK but the one reverted with
b3e939971f56d53e60448a954a616ec295544098 "coverity#1362680 Pointer to local
outside scope".

Change-Id: I022125fbcb592e7da3c288c0fd09079dd2e87928
2016-06-13 19:26:56 +02:00
Stephan Bergmann
136301b3db Remove unused member var
Change-Id: I0f4143cb2a34cf18e6c926432d707d84ef0ea579
2016-06-13 13:43:12 +02:00
Stephan Bergmann
d150eab88e loplugin:passstuffbyref: For now disable "pass parm by value" warnings
That needs fixing, to check that the parm is not bound to a reference, cf.
<https://gerrit.libreoffice.org/#/c/26189/> "coverity#1362680 Pointer to local
outside scope".

Change-Id: I3656354ccd10affafa006c9e46cf1db608b5b2a7
2016-06-13 09:22:13 +02:00
Andrea Gelmini
d3c96c9f82 Fix typos
Change-Id: Ic3efae53430fbb2c1eb7962c3cf69bf99315e55b
Reviewed-on: https://gerrit.libreoffice.org/26202
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: jan iversen <jani@documentfoundation.org>
2016-06-13 06:04:07 +00:00
Noel Grandin
febeefc6c7 loplugin:mergeclasses SfxMacroTabPage
Change-Id: I74790c665fbd191914291365ce711fea9f1cf320
Reviewed-on: https://gerrit.libreoffice.org/26147
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
2016-06-10 08:28:36 +00:00
Noel Grandin
fc7e6d8445 loplugin:mergeclasses SdrItemBrowser
Change-Id: I90c6006be05f182fd442ce8d3641f4f17cdb6793
2016-06-10 09:13:36 +02:00
Noel Grandin
c6d0a104aa update mergeclasses results
and do one trivial merge

Change-Id: Iff30553f73de946c74fa6b082928e7d47adadd04
2016-06-10 09:13:36 +02:00
Stephan Bergmann
4d49c9601c Let loplugin:passstuffbyref also look at fn defn not preceded by any decl
Change-Id: I752bc96d2d521d790e919283cabb14b6526626f4
2016-06-08 17:14:34 +02:00
Bryan Quigley
71cf1aefca Remove unneeded Pane code in Presenter Console
This code hasn't been touched (on purpose) in years, it appears
to have been used to resize part of the console. (It's prefed off)

Change-Id: Iaaeaa8a95c71ae91299bbeeea24869bf2a237b6b
Reviewed-on: https://gerrit.libreoffice.org/24663
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: jan iversen <jani@documentfoundation.org>
Tested-by: jan iversen <jani@documentfoundation.org>
2016-06-06 05:55:03 +00:00
Stephan Bergmann
643b70006f Teach loplugin:stringconstant about RTL_CONSTASCII_STRINGPARAM
Change-Id: I8ff0e104aad045f3835dc8facc760a8339b1d088
2016-06-03 10:58:26 +02:00
Stephan Bergmann
2712fc0869 I assume these special plugins were not intended to be enabled unconditionally
...with fa135fd0e05fc4ba784b4349d65f2e5ed26c0f55 "remove unused SID constants
and associated code"

Change-Id: I51b2a9e3c8ce13401818bca0c40167a4364212f1
2016-06-02 23:46:46 +02:00
Noel Grandin
fa135fd0e0 remove unused SID constants and associated code
found with a python script that looks like:

process = subprocess.Popen(
  "git ls-files *.hrc | xargs grep -hE '#define +SID_' | cut -d ' ' -f 2 | sort -u",
  shell=True, stdout=subprocess.PIPE)
for line in iter(process.stdout.readline, b''):
  line = line.strip()
  if line.startswith("//"): continue
  if line.startswith("sfx"): continue
  if len(line) < 10: continue
  i = subprocess.check_output("git grep -nP \"#define +" + line + " \"",
                              shell=True)
  if i.count("#define") < 2: continue
  print line + "
" + i

Change-Id: I40eac2569c2b5b129d9459cb723a9d6f26d09264
Reviewed-on: https://gerrit.libreoffice.org/25715
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
2016-06-01 06:48:13 +00:00
Noel Grandin
e48a13af9f fix KDE4 build
after 3d7325898547c94826cfdd "loplugin:unusedmethods"

Change-Id: I32303948c5046b2880cd4e64cada32ea776a0861
2016-05-31 08:48:34 +02:00
Noel Grandin
3d73258985 loplugin:unusedmethods
Change-Id: Ifeb818227a960cab8fd2e8e7352468efbfe1232c
Reviewed-on: https://gerrit.libreoffice.org/25668
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
2016-05-31 06:28:41 +00:00
Noel Grandin
0b23eec200 teach refcounting clang plugin about uno::Reference
uno::Reference is only allowed to used with classes that have a
::static_type member.
So convert all those places to rtl::Reference.

Maybe we need some LIBO_INTERNAL_ONLY constructors on rtl::Reference and
uno::Reference to make this a little smoother?

Change-Id: Icdcb35d71ca40a87b1dc474096776412adbfc7e3
Reviewed-on: https://gerrit.libreoffice.org/25516
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
2016-05-31 06:25:45 +00:00
Noel Grandin
509f0c6a8a loplugin:unusedreturntypes
and clean up the python script

Change-Id: I0a7068153290fbbb60bfeb4c8bda1c24d514500f
Reviewed-on: https://gerrit.libreoffice.org/25439
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
2016-05-26 07:26:47 +00:00
Noel Grandin
d59125638b update unusedmethods plugin to ignore externC and copy constructors
Change-Id: Idf7a9403d313ba6a0e031c59601e20c880b6118b
2016-05-18 16:38:23 +02:00
Noel Grandin
27fd3c4e66 update vclwidgets loplugin to handle VclReferenceBase
Change-Id: I447cdb8c65d880b3c5ff28b35cefdc56ff784852
2016-05-18 12:26:24 +02:00
Noel Grandin
2c8fe2e737 update unusedmethods plugin to deal with constructors
and fix the operator< implementations in some of the other
plugins too.

Change-Id: Ie5631e0cdc8d2a994ad2af2533cdb558a6cfc035
Reviewed-on: https://gerrit.libreoffice.org/25057
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
2016-05-18 10:03:44 +00:00
Noel Grandin
42801672f0 fix null pointer crash in loplugin:commaoperator
Change-Id: Ie077ed9a8f200b39da25938b35a3622e52cc5110
2016-05-16 11:25:34 +02:00
Noel Grandin
f3d9aab841 teach passstuffbyref plugin to check for..
unnecessarily passing primitives by const ref.

Suggested by Tor Lillqvist

Change-Id: I445e220542969ca3e252581e5953fb01cb2b2be6
Reviewed-on: https://gerrit.libreoffice.org/24672
Reviewed-by: Tor Lillqvist <tml@collabora.com>
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
2016-05-06 06:48:38 +00:00
Noel Grandin
2e2781d054 move stylepolice back to store
recent updates did not meet with universal approval

Change-Id: Ic059729797049361c7a8a4ae000cd39a5993f6af
2016-04-28 15:39:29 +02:00
Noel Grandin
26d73dbf53 loplugin:stylepolice
Change-Id: I151e4d94f1f5dc84ef3f91218686ca9d1b9bc36f
2016-04-28 14:06:18 +02:00
Noel Grandin
43b4903db3 teach stylepolice plugin about ref-counted-pointer naming
Change-Id: I6e91d22fc1826038c05ddb6fc065563c6a250752
Reviewed-on: https://gerrit.libreoffice.org/24459
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
2016-04-28 09:31:16 +00:00
Jochen Nitschke
1520d0d6f3 cppcheck: silence warnings in compilerplugins
mostly missing explicit before ctors and
uninitialized member vars

one odd use of std::find
> compilerplugins/clang/implicitboolconversion.cxx
> 800 stlIfFind warning	Suspicious condition.
> The result of find() is an iterator, but it is not properly checked.

Change-Id: Iade53494cd7fe8ddb0e110e431449ae5a517fe3b
Reviewed-on: https://gerrit.libreoffice.org/24398
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Tested-by: Stephan Bergmann <sbergman@redhat.com>
2016-04-27 12:03:57 +00:00
Stephan Bergmann
49f2d7cd98 loplugin:stylepolice: adapt to libc++
Change-Id: I8a471d0fb7a206f1a235c3019ae9d07b44056e01
2016-04-27 13:47:30 +02:00
Stephan Bergmann
2ac66f5a36 Enable Clang plugin warnings in Bison source code
-Werror is generally suppressed in Bison-generated C/C++ code (as in all other
generated code) to silence warnings from the Bison skeleton code.  And the Clang
plugins suppress warnings in generated WORKDIR code based on the presumed source
location (i.e., taking #line directives into account).  So introduce a new
PLUGIN_WARNINGS_AS_ERRORS mode where warnings from Clang plugins are reported as
errors even if -Werror is suppressed.  That way, any warnings in the Bison
skeleton code still do not lead to compilation errors, while (at least plugin-
emitted) warnings in the genuine source code do.

Unfortunately this cannot also be enabled for Flex source code, as at least
Flex 2.5.39 generates poor code that does not properly prefix all skeleton code
with appropriate #line directives, so that some skeleton code would be mistaken
for genunie source code, and compilation would fail due to errors.

Also, %glr-parser Bison input appears to generate no #line directives at all (at
least with Bison 3.0.4), so all of connectivity/source/parse/sqlbison.y is
considered generated code and plugin warnings are still suppressed throughout.

Change-Id: Id746e81cbfa5f77628b0a34c7b82780948e7db08
2016-04-26 17:49:11 +02:00
Noel Grandin
e8fd5a07ec update loplugin stylepolice to check local pointers vars
are actually pointer vars.

Also convert from regex to normal code, so we can enable this
plugin all the time.

Change-Id: Ie36a25ecba61c18f99c77c77646d6459a443cbd1
Reviewed-on: https://gerrit.libreoffice.org/24391
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
2016-04-26 10:55:58 +00:00
Stephan Bergmann
16228ad682 Lots of violations in gcc3_linux_x86-64/share.hxx, too, when using libc++
Change-Id: I6f32f7b1dcb97c9651bba2c03c495fb70448e524
2016-04-25 18:06:43 +02:00
Stephan Bergmann
3d081a3f4d Just don't bother with Clang <= 3.6
...where Preprocessor::macros and Preprocessor::getLocalMacroDirectiveHistory
would need to be done slightly differently

Change-Id: Id46b05ac42012597c91a556b17ed008b6c7c5912
2016-04-25 17:27:13 +02:00
Stephan Bergmann
3ae1e17401 loplugin:reservedid
Change-Id: Ifa75d3f228db87f7a899612964bf08e9573fb5be
2016-04-22 16:36:50 +02:00
Stephan Bergmann
a57049915d Avoid reserved identifiers
Change-Id: I263603fb81d368ebc8450b2d8cc01752fcd3f29d
2016-04-22 10:13:56 +02:00
Stephan Bergmann
85825e0fd5 Avoid reserved identifiers
Change-Id: I27ff0f4f0eb395d7e0a60dd604758c220a3134c4
2016-04-22 10:08:07 +02:00
Stephan Bergmann
783419657c loplugin:salbool: sal_Bool[] -> bool[]
Change-Id: I3c5bf7a53c9ae173f8fce885ecf022f092aa43a9
2016-04-21 17:29:40 +02:00
Stephan Bergmann
8c423eeb49 Use Sequence ctor taking initializer_list
needed adapting loplugin:implicitboolconversion to not warn about

  Sequence<sal_Bool> arBool({true, false, true});

Change-Id: I971918aab7c958ef8f1e4e0548a84314e95f8325
2016-04-21 17:27:43 +02:00
Stephan Bergmann
cad49138da typo
Change-Id: I67721e86073bd2f67bee3ffbbb81fd5d143997d8
2016-04-21 13:52:23 +02:00
Stephan Bergmann
8d934b73cc Better fix for 13758a3d154e8e450fdfe8bcdeb6b3a03996c53a
"SourceManager::isMacroArgExpansion has only one param in older Clang", which
caused false positives like warning about sal_False in

  CPPUNIT_ASSERT_EQUAL(guard.p->m1, sal_False);

in cppu/qa/cppumaker/test_cppumaker.cxx

Change-Id: I1c5a67527aef381e336d71cb8fefbb87961bbf96
2016-04-21 12:05:48 +02:00
Noel Grandin
7b65087eab move stylepolice plugin into store/
seems std::regex is not too well supported yet, at least in
libstdc++-4.8

Change-Id: Ib9feb33d2f197d40fc67dc93468aa2f7dae05bac
2016-04-21 10:05:54 +02:00
Stephan Bergmann
13758a3d15 SourceManager::isMacroArgExpansion has only one param in older Clang
Change-Id: I5aa4f7cca70b8196263613b92c018323152411a1
2016-04-21 08:51:40 +02:00
Noel Grandin
5abc669599 new plugin stylepolice
check for local variables which follow our member field naming
convention, which is highly confusing

Change-Id: Idacedf7145d09843e96a584237b385f7662eea10
2016-04-21 08:32:47 +02:00
Stephan Bergmann
e8425c4810 loplugin:salbool: Warn about uses of sal_False/True
...that can generally be rewritten as false/true, and sometimes could hide
errors, see e.g. <5be5f00fe16b0e255b31fbaba5f119773d1cd071> "So this is
apparently about right-to-left levels, not a boolean flag".

Change-Id: Ib39a936a632c2aab206f24c346252e31dcbb98f3
2016-04-20 17:27:33 +02:00
Stephan Bergmann
a3858ed3a7 Use cast to bool to normalize sal_Bool values
Change-Id: I8a886f752d2a16ec4c10656bcd0b3631647971b2
2016-04-20 17:25:31 +02:00
Stephan Bergmann
d9adda92cc Ignore external code
Change-Id: Ie527703e9687a42bfc39439952b9d1a83d7cad24
2016-04-18 15:30:06 +02:00
Noel Grandin
67d333c608 tdf#99352 - Some VclPtrs leak past DeInitVCL
Change-Id: I74b27b1d8b662a644df580ae128643b8495355f8
Reviewed-on: https://gerrit.libreoffice.org/24204
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
2016-04-18 10:51:54 +00:00
Noel Grandin
4ff087565b update badstatics plugin to look for VclPtr<> statics
maybe we should create a "StaticVclPtr<>" class that checks if VCL is
still "alive" before destructing the object?

Change-Id: If8619f689c29294efa19c37ec782fa07acec728d
Reviewed-on: https://gerrit.libreoffice.org/24085
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Reviewed-by: Björn Michaelsen <bjoern.michaelsen@canonical.com>
2016-04-15 12:09:05 +00:00
Noel Grandin
b0c435f88b turn on the passstuffbyref plugin again
now that I have committed all of the changes to return types it
found

Change-Id: Iaee121037ce83e94001e4591d232b075dfeade7c
2016-04-14 12:00:10 +02:00
Noel Grandin
7573abfdef update loplugin passstuffbyref to check return types
of methods like
   Foo getFoo() const { return m_foo; }
where we can rather do
   const Foo& getFoo() const { return m_foo; }
and let the client code decide if it wants copy Foo.

Inspired by a performance problem where we were unwittingly
copy constructing a large struct repeatedly just so client code
could interrogate the members of the struct.

When all of the changes this plugin finds are applied, I find
that 'perf stat make check' shows on average a 1.7% reduction
in CPU cycles.

Change-Id: Ic27b4f817aa98f2a2a009f2d4e4a962cbe9c613e
2016-04-13 13:27:50 +02:00
Stephan Bergmann
9c38c84c48 Avoid reserved identifiers
Change-Id: I438a7f28ba6bc68ec4e6244a4343e4040ab1b997
2016-04-07 07:57:12 +02:00
Wastack
e097e419ee tdf#97966 Compiler plugin
Warns about redundant 'static' keywords in unnamed namespace.

Change-Id: Iecab69161e24d73e39a8dd5baaba6929e12d4f29
Reviewed-on: https://gerrit.libreoffice.org/23679
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2016-04-01 06:47:07 +00:00