301 Commits

Author SHA1 Message Date
Stephan Bergmann
7b1261f6f9 loplugin:cstylecast: sal
Change-Id: I0ad9681a8b31d78cefce5b66040415154a1c7a99
2015-01-07 14:42:07 +01:00
Stephan Bergmann
1887d4f5e9 Minor beautification
Change-Id: I1300d1d696878c1b646decc2841f13d489d3cadc
2015-01-07 14:42:07 +01:00
Stephan Bergmann
52e5b6e38a loplugin:cstylecast: Exclude only sal, not salhelper
Change-Id: Ib09f2b794ce7a1e650275750a67c6c8ad5d7c808
2015-01-07 14:42:07 +01:00
Stephan Bergmann
1b9d9680d9 Work around loplugin:cstylecast under -fsanitize=*
Change-Id: I467d032296607d22e850c95e56c452fe7e62cebe
2015-01-06 14:34:34 +01:00
Stephan Bergmann
f569c4197c Improve loplugin:revisibility
(for non-Windows--only code, as MSVC would complain about such cases anyway)

Change-Id: Id6daf61b79bd31529bdaeb7c6df4f354731ae7d7
2015-01-05 17:25:51 +01:00
Stephan Bergmann
9720e8e5ef Some loplugin:revisibility clean-up
Stumbled across such redundant visibility re-specifications when looking at the
odd case of cppu_unsatisfied_iquery_msg declared CPPU_DLLPUBLIC in
cppu/source/cppu/cppu_opt.cxx and used in inline code in
include/com/sun/star/uno/Reference.hxx with only a declaration lacking
CPPU_DLLPUBLIC visible, and wondering how that actually works on Windows.

However, this plugin is probably not worth it being run all the time, so
committing it to compilerplugins/clang/store/.

Change-Id: Ibc3c4e7499213de1b419ce7eb85455cb832e1510
2015-01-05 13:10:48 +01:00
Stephan Bergmann
f266c81b2d Don't call isIntegerConstantExpr if isValueDependent
...some paths trough clang::Expr::isIntegerConstantExpr (esp. if
non-CPlusPlus11) assert the assumption that the given expr is not
value-dependent, so it appears to be a prereq

Change-Id: Ibc5fe472ea3f91b31c8cb7f06c4b7c7f4d6831a3
2014-12-21 22:00:40 +01:00
Stephan Bergmann
2a52591bfe Extend loplugin:literalalternative to loplugin:stringconstant
Change-Id: Ie425af19019126b6a15ac03f52e32d186a46db35
2014-12-19 10:03:52 +01:00
Stephan Bergmann
a349a4763f loplugin:saloverride does not make sense for external code
...where SAL_OVERRIDE is not available

Change-Id: I49d447ba90516f4f744c21302607bff97ad3c4d5
2014-12-18 17:29:31 +01:00
Stephan Bergmann
afcac82eea loplugin:cstylecast: warn about casts involving incomplete types
...the worst kind of all

Change-Id: I6b98a324735a79ed9060003b491acce733f74f06
2014-12-07 15:18:08 +01:00
Noel Grandin
c20a0120d8 move the cstylecast clang plugin out of /store
Change-Id: Iee78bd688ddb3e02deb1a3636d6a604838e97b09
2014-12-04 13:38:53 +02:00
Stephan Bergmann
a0db0648f6 Problematic casts in gendata.hxx are already under control
Change-Id: If3b0f667b379b7973364c93be4b88347e5768223
2014-12-04 11:57:31 +01:00
Noel Grandin
14c94c97ff cstylecast plugin - exclude some more files
Change-Id: I4dc6cc7f461fa11d12bf6fd9700befe4bbdac62c
2014-12-04 11:19:19 +02:00
Stephan Bergmann
eff69c6b4c Run loplugin:cstylecast on C++ and Ojbective C++ code
Change-Id: I4035318d35d468fa93d4dcfe56f9b0434fd1dfe7
2014-12-04 08:22:09 +01:00
Bjoern Michaelsen
6e226f5ed8 also look for cascading assignments
Change-Id: I7fa18403698530eec379589c76631f0aa367b215
Reviewed-on: https://gerrit.libreoffice.org/12991
Reviewed-by: Björn Michaelsen <bjoern.michaelsen@canonical.com>
Tested-by: Björn Michaelsen <bjoern.michaelsen@canonical.com>
2014-11-20 18:17:03 +00:00
Bjoern Michaelsen
395d6a96aa cascading conditional operators, give a hint on complexity
Change-Id: Ie9d0b07a32cc17705db735ea18f70f28d57badd4
Reviewed-on: https://gerrit.libreoffice.org/12990
Reviewed-by: Björn Michaelsen <bjoern.michaelsen@canonical.com>
Tested-by: Björn Michaelsen <bjoern.michaelsen@canonical.com>
2014-11-20 18:16:02 +00:00
Bjoern Michaelsen
b736204f3b add clang plugin for detecting cascading condops
Change-Id: I1b782bb04b09bee5c3db2261f9390a7b2edf4564
Reviewed-on: https://gerrit.libreoffice.org/12967
Reviewed-by: Björn Michaelsen <bjoern.michaelsen@canonical.com>
Tested-by: Björn Michaelsen <bjoern.michaelsen@canonical.com>
2014-11-19 14:58:40 +00:00
Andrea Gelmini
da40cac540 Fix common typos. No automatic tools. Handmade…
Change-Id: I1ab4e23b0539f8d39974787f226e57a21f96e959
Reviewed-on: https://gerrit.libreoffice.org/12164
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Tested-by: Noel Grandin <noelgrandin@gmail.com>
2014-11-12 11:04:11 +00:00
Noel Grandin
5f15cc01b3 new loplugin: use more efficient find() methods
(Original idea from Kendy)
Look for code that is calling std::find on a sorted container
(set/map/vector) and warn about it - the code should be using
the find method on the container itself, since that is considerably faster.

Change-Id: Ib74e5d3faa836eeb0df16a736d202696626bdfd2
2014-11-05 15:59:23 +02:00
Stephan Bergmann
a995f82799 Remove excess [%1 %2] that doesn't match any arguments
...and is apparently a leftover from temporary debug output in
e36badb98d0bb5866a297cb51c3e95cdce62d8da "Fix workaround for bug in Clang 3.2
FunctionDecl::isInlined."

Change-Id: I3213981c5d236a7b67083014692566f75a2bcd51
2014-10-01 17:35:12 +02:00
Stephan Bergmann
d8e21f0400 compilerplugins: get rid of std::auto_ptr in comment
Change-Id: Ia2b1bc97f3476da7bfbe659e5160cd5c73c01ce5
2014-09-30 10:33:25 +02:00
Noel Grandin
07ca074e42 cstylecast plugin: ignore templates, improve message
Change-Id: I8347010d5607dc2cbb113b33f1cb2cc78ec106d2
2014-09-29 12:50:35 +02:00
Stephan Bergmann
5a9a3da719 loplugin:nullptr
A plugin to warn about and rewrite null pointer constants that are not written
as nullptr (in C++11 code) resp. NULL (in C and C++03 code).  It is not
activated for the following reasons:

* At least the call to

  pImpl->aFmtNms.insert(pImpl->aFmtNms.begin() + nPos, nullptr);

  in svx/source/items/clipfmtitem.cxx would require
  <https://svn.boost.org/trac/boost/ticket/10540> "missing std::nullptr_t
  support in boost/type_traits/is_pointer.hpp" to be fixed first.

* Additions of code that violate the plugin would probably be frequent, causing
  unnecessary grief for those building with plugins enabled.

* It did not find anything interesting, apart from the above Boost bug and the
  mildly interesting 1da153b617b80887680be65c1854ef8080c2e1c9 "Consistently use
  APP_WRITER as an integer, never as a nullptr."

Anyway,

  until make -O -j4 -k check; do make -O -j1 -k check \
    COMPILER_PLUGIN_TOOL=nullptr UPDATE_FILES=all; done

sucessfully executed on a recent master and resulted in

  6798 files changed, 60919 insertions(+), 60919 deletions(-)

Change-Id: I1260227949868e73fcb63fda13d83e79fde685d7
2014-09-25 17:43:23 +02:00
Stephan Bergmann
0f5756e2e4 Adapt compilerplugins to Clang trunk towards 3.6
Change-Id: If6ee343bb4d4004e7a95fe1c5adc97210fc0abd0
2014-09-23 13:46:24 +02:00
Noel Grandin
827c46e7d7 fdo#82577: Handle Window
Put the VCL Window class in the vcl namespace. Avoids clash with the X11
Window typedef.

Change-Id: Ib1beb7ab4ad75562a42aeb252732a073d25eff1a
2014-09-23 14:11:39 +03:00
Stephan Bergmann
1f36fda306 Revert "new loplugin: VCL widget reference checker"
This gerrit patch was apparently not ready yet for integration.

This reverts commit 44a432e9073b3d39b1bdd34b65cfd91d5541f324.
2014-09-21 20:22:02 +02:00
Noel Grandin
44a432e907 new loplugin: VCL widget reference checker
First stage of new VCL widget reference checker

Change-Id: I63a2108a26b3c0e0a896d13672b1daa6f8e60b3a
Reviewed-on: https://gerrit.libreoffice.org/10427
Reviewed-by: Chris Sherlock <chris.sherlock79@gmail.com>
Tested-by: Chris Sherlock <chris.sherlock79@gmail.com>
2014-09-21 12:44:59 +00:00
Stephan Bergmann
8ab9ea00b6 ...and another
Change-Id: If9d85236177c819c159d1b836e806fc2b03da45c
2014-09-16 09:35:07 +02:00
Stephan Bergmann
e36badb98d Fix workaround for bug in Clang 3.2 FunctionDecl::isInlined
Change-Id: I9b0b6affc60ae030b644fdd13eecfb1aed1f472a
2014-09-16 09:14:29 +02:00
Stephan Bergmann
037a1adac9 Work around bug in Clang 3.2 FunctionDecl::isInlined
Change-Id: I214a9745f27c27868b3e74785cf7138fc1db1943
2014-09-15 18:48:17 +02:00
Luboš Luňák
e823a9bd63 do not warn about "null pointer conversions" from integers in C++98 mode
Change-Id: I15c7f52c542549ad131400c9b5395a06a4777687
2014-09-15 17:38:42 +02:00
Stephan Bergmann
8dccc4d9b7 loplugin:salbool env var is no longer necessary, all code is clean
Change-Id: Ibf1d8c74dc8abb8c1fef59c53a8873cc426e2932
2014-09-15 17:12:08 +02:00
Stephan Bergmann
e333adb1ff loplugin:salbool: exclude sal_Bool vars passed to non-const ref
Change-Id: I45b323b326cc56cfc48e0abaa52d51fd86adbf79
2014-09-12 14:46:54 +02:00
Tor Lillqvist
dac678d44e Deactivate the sallogareas plugin
It's boring and a waste of time to have to keep registering in
include/sal/log-areas.dox new log areas that other people have introduced.

We don't really have a uniform policy for logging anyway, so why bother trying
to enforce a such for the log areas? Anybody uses whatever log areas and log
output style and formatting they want in the code they happen to be working
on. And that's fine with me. We were supposed to be the project that avoids
unnecessary process, rules and bureaucracy, right?

Change-Id: I6bddcb56b58edcd885e5dc743c8730878de0036d
2014-09-11 09:28:35 +03:00
Stephan Bergmann
889e27c165 codebase is not yet cleaned up for loplugin:cstylecast
Change-Id: Ic2faece46bebea046eee984a0d53d9cd2892e0c9
2014-09-08 09:04:19 +02:00
Noel Grandin
ed75aa2719 create clang plugin to warn about C-style casts
We don't like C-style casts in our nice C++ code

Change-Id: I94e7ec90de9275cd6e20c4146d4f3a74bed93c9d
Reviewed-on: https://gerrit.libreoffice.org/10367
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Reviewed-by: Norbert Thiebaud <nthiebaud@gmail.com>
Tested-by: Norbert Thiebaud <nthiebaud@gmail.com>
2014-09-07 02:42:30 -05:00
Stephan Bergmann
05ead076b4 Adapt compilerplugins to Clang trunk towards 3.6
Change-Id: Id1ce6c59f705f9c42855995e0ad590c6a3646613
2014-08-28 11:33:32 +02:00
Stephan Bergmann
311fb9d5e6 Adapt compilerplugins to Clang trunk towards 3.6
Change-Id: I0b7be1616a3e4206982f9f925de141ed9d53b96e
2014-08-11 15:16:08 +02:00
Stephan Bergmann
222c94f5a4 Adapt loplugin:derefnullptr to old Clang versions
...where prior to r183883 "Implement core issue 903: only integer literals with
value 0 and prvalues of type std::nullptr_t are null pointer constants from
C++11 onwards," Expr::isNullPointerConstant with NPC_NeverValueDependent could
go into an llvm_unreachable case.

Change-Id: I29cf093f18ece4cd83fd759e30f72c2a71f69554
2014-07-30 16:21:55 +02:00
Noel Grandin
145b0de156 fix for running externandnotdefined plugin on Ubuntu
Change-Id: I00804b2dd63df44478a14a3eaf2fdcd4e4ce5d09
2014-07-29 09:46:41 +02:00
Juan Picca
9f282bdd86 compilerplugins: Fix tutorials plugins
Broken in commit 1f078fcaddd45bb074e4d0a4933db01f6e8b623e

Change-Id: Ica93c3b9309b2ae4d973ccc34a84b5accac7472c
Reviewed-on: https://gerrit.libreoffice.org/10478
Reviewed-by: Thomas Arnhold <thomas@arnhold.org>
Tested-by: Thomas Arnhold <thomas@arnhold.org>
2014-07-24 08:17:16 +00:00
Noel Grandin
dac4ca5f68 new loplugin: externalandnotdefined
Find "missing headers," where a function is declared directly in the
.cxx (as extern) and not defined, and should arguably instead be declared
in an include file.

Change-Id: I6d83ee432b2ab0cd050aec2b27c3658d32ac02a2
2014-07-11 14:12:25 +02:00
Stephan Bergmann
4da8281d5a compat for Clang 3.2
Change-Id: I2746abd05edd00dadfe613c17b9874b1035c3be4
2014-07-02 19:19:17 +02:00
Stephan Bergmann
0e8d69fa7d Make configmgr loplugin:salbool-clean
Change-Id: Ib1f33387c50bcd853140eb2fc46995d23d7f367b
2014-07-02 18:48:18 +02:00
Stephan Bergmann
6397b93eb3 loplugin:salbool: Fix handling of potentially overriding functions
Change-Id: I63d00cf5ab1dac953fae07ca4eb4d987610551a2
2014-07-02 17:03:54 +02:00
Stephan Bergmann
9263b101c3 Activate the "suspicious cast to sal_Bool" parts of loplugin:salbool
Change-Id: I78a368ef2899b2462251b45a327fc7b1f31fe764
2014-07-01 17:49:10 +02:00
Stephan Bergmann
e50ef195bc New loplugin:stringconcat
Change-Id: Id7c517fb37bc28797c45fc0dde83e866f2aa4aac
2014-07-01 15:45:52 +02:00
Stephan Bergmann
e48a233960 loplugin:unreffun: also warn about redundant redeclarations
Change-Id: I9a812220b58cf6da00d854e65794f7c673ab239d
2014-06-27 15:27:39 +02:00
Stephan Bergmann
9a741fcad4 loplugin:unreffun: also warn about unused function templates
Change-Id: I4a6280f47ca3c4a77b4e42fe05d79ded7fc30ef1
2014-06-27 07:51:51 +02:00
Noel Grandin
a74193306a compilerplugins: move isUnoIncludeFile to base class
to reduce copy-pasted code

Change-Id: I7728d85dea7d0161998c326d6648ca681a8250d0
2014-06-24 12:48:17 +02:00