Commit Graph

288 Commits

Author SHA1 Message Date
Stephan Bergmann
5beac3c0b7 Add clarifying comment
Change-Id: Ie891404a4d21e1917e5e653737e35257df3dfcae
2015-04-24 15:01:20 +02:00
Stephan Bergmann
2d855ab9d0 loplugin:simplifybool
Change-Id: I44b563269a68cd2d57a906e10939ac290a0a2ebd
2015-04-24 12:36:32 +02:00
Stephan Bergmann
6052a839f5 Mac OS X ctype.h isdigit is not extern "C"
Change-Id: Ied43178bacc020b848ee3196080713e08c780133
2015-04-23 23:48:01 +02:00
Stephan Bergmann
4d7b194dd5 Improved loplugin:literaltoboolconversion looking into cond. exprs.
Change-Id: If54ab99fc82c7895da6bb88ebf18a11570f597ed
2015-04-23 18:39:07 +02:00
Stephan Bergmann
59076a9825 Improve loplugin:implicitboolconversion cond. expr. handling
...so that

  ... ? isdigit(...) : true

will not trigger a warning (where isdigit is the standard C function returning
int).  (Odd code like that will fall out of the improved
loplugin:literaltoboolconversion rewriter shortly.)

Change-Id: If51402bd5f4b3f8b0630e874988f4b836ae246f8
2015-04-23 18:39:06 +02:00
Noel Grandin
7ab8b08b6c loplugin:staticmethods
Change-Id: Iab2f10b000ef41fb090e0034785d4ed0bda4cf43
2015-04-23 13:08:48 +02:00
Noel Grandin
0a7b739cc3 loplugin:staticmethods
Change-Id: I2ee91d07cf9d46cdc385a4db8473550b05e2f0ad
2015-04-23 13:08:48 +02:00
Noel Grandin
79ed057b95 loplugin:staticmethods
Change-Id: I6207b475127099872c6f3764331006688129b673
2015-04-23 13:08:48 +02:00
Noel Grandin
12ba9e3cad loplugin:staticmethods
Change-Id: Ib0c0841e48814d1a6e13bcd4575725d86ffa5e5e
2015-04-23 13:08:48 +02:00
Noel Grandin
6d5ae48427 loplugin:staticmethods
Change-Id: I200fdb2e193127f0c9e8cec4859845d3ec19cea0
2015-04-23 13:08:47 +02:00
Stephan Bergmann
8e4d82cd11 loplugin:implicitboolconversion: warn about conversions to unsigned char
...while avoiding warnings about conversions to bool-like typedefs (sal_Bool
etc.), also in cases where those typedefs are used as type arguments of
template specializations (which is no little feat, and the current code is only
an approximation of it, one that appears to cover the relevant cases in our code
base though).

Change-Id: I0ed3801aec7787bf38b429b66e25244ec00cac9b
2015-04-17 15:20:48 +02:00
Noel Grandin
71b809959b remove unnecessary use of void in function declarations
ie.
    void f(void);
becomes
    void f();

I used the following command to make the changes:

  git grep -lP '\(\s*void\s*\)' -- *.cxx \
    | xargs perl -pi -w -e 's/(\w+)\s*\(\s*void\s*\)/$1\(\)/g;'

and ran it for both .cxx and .hxx files.

Change-Id: I314a1b56e9c14d10726e32841736b0ad5eef8ddd
2015-04-15 11:47:12 +02:00
Stephan Bergmann
373a9b9bb6 loplugin:redundantcast: redundant const_cast followed by implicit upcast
Change-Id: I58297ba336d96358eb0683684bbd763870ef56cb
2015-04-13 12:36:36 +02:00
Noel Grandin
ee094bd46f loplugin:staticmethods
Change-Id: If97f01a05294fa7efd59a8934c7b6f65cda5084a
2015-04-13 09:37:12 +02:00
Noel Grandin
26ec80f47d loplugin:staticmethods
Change-Id: I33a8ca28b0c3bf1c31758d93238e74927bebde9c
2015-04-13 09:37:12 +02:00
Noel Grandin
14505bb67e loplugin:staticmethods
Change-Id: I715374b531da2850434b2436633b6042ecb9ebe0
2015-04-09 11:01:06 +02:00
Noel Grandin
35163715ea loplugin:staticmethods
Change-Id: Ie348778ea666c24e95e048386547f301083a0017
2015-04-09 10:13:18 +02:00
Noel Grandin
e9cb5577f4 loplugin:staticmethods
Change-Id: Ibf0c73ac17ec19ed672f66907db47057920babca
2015-04-02 09:38:29 +02:00
Stephan Bergmann
90ed482496 Reduce to static_cast any reinterpret_cast from void pointers
Change-Id: I514e183571e4ac109f59c4bdfccdc553c36c26ee
2015-03-31 13:18:16 +02:00
Stephan Bergmann
2688a88297 Remove leftover debug code
Change-Id: I874fc4d677abb2646bffb4331a220f3812443b66
2015-03-30 13:48:45 +02:00
Stephan Bergmann
a52cf476e7 Clean up template-parameter-dependent C-style casts
Change-Id: Ia1ab134a0afbeeb3ae40264bd4233a47df26b734
2015-03-29 15:13:45 +02:00
Stephan Bergmann
0bd502af47 Clean up remaining C-style casts among void pointers
Change-Id: I1b49c020d597b569e330482f4dbf20c15ccdae3f
2015-03-29 09:17:47 +02:00
Stephan Bergmann
78ad5ecd98 Clean up isMacroBodyExpansion
Change-Id: I745b320dd5f44d54371d8a0b961c49793e3e0ad6
2015-03-28 19:16:47 +01:00
Stephan Bergmann
ef44d45a4e Clean up C-style casts from pointers to void
Change-Id: Idff46e5642034cf751d557de9a49c02a7abf27bb
2015-03-28 19:09:29 +01:00
Stephan Bergmann
13e45d6fde loplugin:redundantcast: Don't warn about certain casts in macros
...that might depend on macro arguments and not really be redundant

Change-Id: If19de3835a4972add58965ea7c0936fad7ef6957
2015-03-28 19:09:17 +01:00
Noel Grandin
c4a9241f72 new clang plugin: staticmethods
Genius suggestion from Tor Lillqvist, write a clang plugin that finds
methods that can be static.

Change-Id: Ie6684cc95d088e8750b300a028b49f763da00345
2015-03-27 10:51:08 +02:00
Stephan Bergmann
1c78277801 const_cast: convert some C-style casts and remove some redundant ones
Change-Id: I876736d18db6676629c283fccd65e1b6fb2bb2be
2015-03-26 15:33:41 +01:00
Noel Grandin
6aa542445f move the constantfunction plugin into /store
as sberg points out, it needs a massive blacklist, which is going
to be a pain to maintain. Until I can think of a way to make this
more resilient, move it where it can't bother people.

Change-Id: I64fc498146a3cb4ea9c1e37150c4ef50023b7bd5
2015-03-26 14:24:43 +02:00
Stephan Bergmann
1f1ce7e01a loplugin:constantfunction: vcl/unx/gtk3
Change-Id: I66ffc0c3a73d45e9d4b54f46092a65913b753d26
2015-03-26 10:52:35 +01:00
Stephan Bergmann
6409db7838 loplugin:constantfunction: vcl/unx/gtk3
Change-Id: Ieedf89bebb59e783dfe13ef2d5ae7ba3347cdc62
2015-03-26 10:30:52 +01:00
Stephan Bergmann
82f4f6b19f loplugins:constantfunction: properly detect overloaded operators
Change-Id: I484e1206d1f17305d21f7e750b8aca9d1c8d809b
2015-03-26 09:25:13 +01:00
Stephan Bergmann
44753f7cf0 Expr::EvaluateAs... does not work for type-dependent expressions
Change-Id: Iea1cd468528d00ffa07e13b2063ca5fce5cc4fae
2015-03-25 21:37:48 +01:00
Noel Grandin
c7a50d072f new constantfunction loplugin
Change-Id: Ie9b7a0c41fc4dbd2560ceff6bae9ab85357f518b
2015-03-25 08:55:31 +02:00
Noel Grandin
5229726b4d loplugin: add Dialog to unusedvariablecheck
so that we find dialog that have been instantiated but not actually
executed

Change-Id: Ia308e832780627c0a8de71a9d64dabcb3b861a9c
2015-03-17 11:15:28 +02:00
Stephan Bergmann
62b124b270 Ensure RTTI symbol visibility for Linux Clang -fsanitize=function,vptr
The problem being that any lib later loaded via osl_loadModule (e.g.,
libgcc3_uno.so) would not bind to the same global (RTTI-related) symbols as
libsofficeapp.so and its dependencies (so, e.g., -fsanitize=function would
erroneously assume that bridges/source/cpp_uno/shared/component.cxx's
uno_initEnvironment is called with a different, non-matching uno_Environment
type).

Change-Id: I08b0cbc1f9eb74641eb617c46587a0a528a56c31
2015-03-11 10:56:06 +01:00
Stephan Bergmann
5035225803 Fix copy/paste error
Change-Id: I3fd9d6447adfa365a823ca6e87f0939670bcb39b
2015-03-11 10:56:06 +01:00
Stephan Bergmann
24a89b2772 Improve loplugin:passstuffbyref
Change-Id: I88ab4c51ff59312127681d3087d22b9c79192b94
2015-03-03 08:56:01 +01:00
Stephan Bergmann
88a031e593 Missing initialization
Change-Id: I45eabbe9d1a4e3f85f16c2869c4031fc06f5ef31
2015-03-02 17:47:23 +01:00
Stephan Bergmann
9e6c2369a1 plugin:literaltoboolconversion: Recurse into comma operator's rhs
...inspired by <http://www.viva64.com/en/b/0308/#ID0EE4BI>'s V639 finding.

Change-Id: I3b49f00dd4a593ed0b94d81398fa89ff64f6c79b
2015-03-02 17:14:33 +01:00
Stephan Bergmann
193957750a Adapt compilerplugins to Clang trunk towards 3.7
Change-Id: I5b41039bf63a4c2f313fe7a57c0f6934dcb0752d
2015-02-26 17:22:01 +01:00
Stephan Bergmann
92db2f17b3 Adapt loplugin:passstuffbyref to Clang 3.2
Change-Id: I24d0b7531feba32f86f761daf18170397cfe5d2f
2015-02-09 10:40:19 +01:00
Stephan Bergmann
a6f8766d35 loplugin:deletedspecial (Mac OS X)
Change-Id: Ia09e2e7b3e40bd04da64b52fe29258017b90b156
2015-02-07 17:24:43 +01:00
Stephan Bergmann
d2e9b222d7 loplugin:deletedspecial to help add SAL_DELETED_FUNCTION annotations
...to special member function declarations that were left undefined.  Helps
compilers do a better job at identifiying unused class members.  This plugin
uses heuristics and whitelists do identify applicable declarations, but is not
appropriate for "unattended" use so is placed into store/.

The following commits contain the results of running this plugin, per module:

* Declarations of undefined special member functions are mmarked
  SAL_DELETED_FUNCTION (aka "= delete", which is deemed superior to deriving the
  class from boost::noncopyable, cf. Howard Hinnant's reply to
  <http://stackoverflow.com/questions/7823990/what-are-the-advantages-of-boostnoncopyable>.

* Any redundant "explicit" or SAL_DLLPRIVATE markers are removed from the
  deleted definitions.

* Some redundant declarations of undefined default ctors are simply removed;
  smelled like clueless cargo-cult to have them declared at all.

* Some declarations of undefined operator == etc. are left in (and marked
  SAL_DELETED_FUNCTION) for now, to be on the safe side, though they are likely
  clueless cargo-cult, too.

* Most "static-only" classes are replaced with namespaces (and some where that
  would be non-trivial due to private members are marked TODO for later).

* Newly identified unused class members are removed.

Change-Id: Ibeaae4fd579d7a0971a2c2a654a2263acd13414a
2015-02-07 12:35:55 +01:00
Stephan Bergmann
0a1c6d4554 Extend loplugin:passstuffbyref to handle lambdas
...even if it is known to be dangerous

Change-Id: Ied96284e33b966bf072d0961054479ec7f891dea
2015-02-05 16:54:10 +01:00
Stephan Bergmann
331faca18e Extract loplugin:redundantcast from loplugin:cstylecast
Change-Id: I08f17dd9cc092206083ff41bbbc178e0322e86d0
2015-01-29 22:21:04 +01:00
Stephan Bergmann
4e3da621fe Some more loplugin:cstylecast clean-up
Change-Id: I132d22e2af3cf673c17d8964f690d48990834884
2015-01-28 13:50:37 +01:00
Noel Grandin
414d84232d move these plugins into /store
we don't need to run them on an ongoing basis, and the current code
does not compile with older versions of clang.

Change-Id: I07ccacf7ff7b00e8e2453fff91a3f487dd5abed9
2015-01-26 09:39:18 +02:00
Noel Grandin
b44cbb26ef new loplugin: change virtual methods to non-virtual
Where we can prove that the virtual method is never overriden.

In the case of pure-virtual methods, we remove the method entirely.
Sometimes this leads to entire methods and fields being
eliminated.

Change-Id: I138ef81c95f115dbd8c023a83cfc7e9d5d6d14ae
2015-01-26 08:42:28 +02:00
Stephan Bergmann
3adaad3e36 loplugin:cstylecast: Warn about more of the potentially suspicious ones
Change-Id: Id7a596344c21e9265e35188c477e60ce510bcc6e
2015-01-22 08:13:42 +01:00
Stephan Bergmann
31498259bb loplugin:cstylecast: warn about certain redundant reinterpret_casts
Change-Id: Iaa46849742c215798722d03d9ee59bb39d8033f7
2015-01-09 16:42:42 +01:00