18 Commits

Author SHA1 Message Date
Stephan Bergmann
50f35e5b65 Fix for compilerplugins/clang/test/salcall.cxx with clang-cl
Change-Id: I6e58b6bf0d10297ed3ac20de25c1eea42c9f2334
Reviewed-on: https://gerrit.libreoffice.org/46844
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-12-20 18:13:08 +01:00
Stephan Bergmann
1bbefac109 Remove redundant, duplicated getSpellingLoc call
Change-Id: Ic1e4fd2833dd0bcc64363733e7794448b2d4de37
Reviewed-on: https://gerrit.libreoffice.org/46839
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-12-20 13:09:40 +01:00
Stephan Bergmann
6f4f5677ac No need to keep these whitelisted functions decorated with SAL_CALL
The only effect SAL_CALL effectively has on LO-internal code is to change non-
static member functions from __thiscall to __cdecl in MSVC (where all other
functions are __cdecl by default, anyway).  (For 3rd-party code, it could be
argued that SAL_CALL is useful on function declarations in the URE stable
interface other than non-static member functions, too, in case 3rd-party code
uses a compiler switch to change the default calling convention to something
other than __cdecl.  But loplugin:salcall exempts the URE stable interface,
anyway.)

One could argue that SAL_CALL, even if today it effectively only affects non-
static member functions in MSVC, could be extended in the future to affect more
functions on more platforms.  However, the current code would already not
support that.  For example, 3af500580b1c82eabd60335c9ebc458a3f68850c
"loplugin:salcall fix functions" changed FrameControl_createInstance in
UnoControls/source/base/registercontrols.cxx to no longer be SAL_CALL, even
though its address (in ctl_component_getFacrory, in the same file) is passed to
cppuhelper::createSingleFactory as an argument of type
cppu::ComponentInstantiation, which is a pointer to SAL_CALL function.

Change-Id: I3acbf7314a3d7868ed70e35bb5c47bc11a0b7ff6
Reviewed-on: https://gerrit.libreoffice.org/46436
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-12-14 13:03:06 +01:00
Stephan Bergmann
2f28d2b4fa Improve loplugin:salcall error reporting
Change-Id: Ib18f61f10225d5499f94144c8a0f9efff40e43aa
Reviewed-on: https://gerrit.libreoffice.org/46366
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-12-13 13:14:11 +01:00
Stephan Bergmann
a987aa3be7 Make loplugin:salcall look into macros too
"Indirect" calls to isSallCallFunction (for canonic and overridden
FunctionDecls) already needed to handle many cases of FunctionDecls spanning
macros, so it isn't that much more work to make that also work for cases called
directly from VisitFunctionDecl.

Change-Id: I529f148c8872b86aa1ef082c6cb73db8ab1866e7
Reviewed-on: https://gerrit.libreoffice.org/46367
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-12-13 12:44:31 +01:00
Noel Grandin
3af500580b loplugin:salcall fix functions
since cdecl is the default calling convention on Windows for
such functions, the annotation is redundant.

Change-Id: I1a85fa27e5ac65ce0e04a19bde74c90800ffaa2d
Reviewed-on: https://gerrit.libreoffice.org/46164
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-12-11 12:13:46 +01:00
Stephan Bergmann
492afb35b4 Improve loplugin:salcall error reporting
Change-Id: I214052491e90eb4147bf79d6fd3927266638c686
Reviewed-on: https://gerrit.libreoffice.org/46203
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-12-11 10:44:08 +01:00
Stephan Bergmann
456f943d22 Fix isSalCallFunction further
...after a31267be1bb42e8a5f80a3b660bbf969eeb5b647 "Fix isSalCallFunction so it
also works on Windows", so that it actually does work on Windows.

Change-Id: I0218fb41b3e1000e2325967a18dfaafaa95fe415
Reviewed-on: https://gerrit.libreoffice.org/46193
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-12-10 22:50:57 +01:00
Andrea Gelmini
06e5bd866b Fix typos
Change-Id: I2de8448564c963d3361a828bb96dcdb15eddf717
Reviewed-on: https://gerrit.libreoffice.org/46151
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2017-12-10 10:32:11 +01:00
Stephan Bergmann
17a8a03aec Add some debug checks to loplugin:salcall
Change-Id: I27b7281723dd705e4304958458be3ea2fee7f3e6
Reviewed-on: https://gerrit.libreoffice.org/46112
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-12-09 13:17:24 +01:00
Stephan Bergmann
959ecc9963 No more issues with these source files
...after a31267be1bb42e8a5f80a3b660bbf969eeb5b647 "Fix isSalCallFunction so it
also works on Windows"

Change-Id: Ic770230f2dd6183f5937801f27e929ebfd39bb4a
Reviewed-on: https://gerrit.libreoffice.org/46111
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-12-09 13:17:03 +01:00
Stephan Bergmann
a31267be1b Fix isSalCallFunction so it also works on Windows
...where FunctionDecl::getReturnTypeSourceRange returns an invalid range because
it fails to take AttributedTypeLoc (as caused by SAL_CALL -> __cdecl) into
account.

Change-Id: I7835dfca7b890ba1bfdb99adaad78a627b6e0e17
Reviewed-on: https://gerrit.libreoffice.org/45909
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-12-08 18:01:27 +01:00
Noel Grandin
dd0dceb511 loplugin:salcall handle static methods
Change-Id: Id6820abec4b8ca8bee26d62b333fd30b42a14aec
Reviewed-on: https://gerrit.libreoffice.org/46007
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-12-07 11:25:55 +01:00
Noel Grandin
c0ac78c971 loplugin:salcall handle virtual methods
Change-Id: Iab95db31188ea2914a46d63a7ebef3d825e6ec42
Reviewed-on: https://gerrit.libreoffice.org/45851
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-12-06 07:42:50 +01:00
Noel Grandin
720cc05a76 fix compile of salcall plugin
changes from sberg and myself crossed paths in the night

Change-Id: I2606902f84739e552b2aad292e63e7b8e6757965
2017-12-05 09:15:48 +02:00
Noel Grandin
9a06b99d2f loplugin:salcall fix non-virtual methods
first, since those are safer to change than virtual methods

Change-Id: Ie3b624019d75ee2b793cee33b3c5f64e994e8bfe
Reviewed-on: https://gerrit.libreoffice.org/45798
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-12-05 07:32:46 +01:00
Stephan Bergmann
5940f3020e -Werror=unused-function
Change-Id: I411a134daef6ad061ab54b300e379b882395905b
2017-12-04 18:41:09 +01:00
Noel Grandin
68f8645752 new loplugin salcall: remove unnecessary SAL_CALL
In this first commit, I use the plugin to verify the consistency of our
SAL_CALL annotations.
The point being to make the next commit more mechanical in nature,
purely using the rewriter.

There are various chunks of unix-only code that have never had to be
compiled by MSVC, hence the inconsistencies.

In bridges, I had to inline some typedefs to make the verification code
happy, since it cannot see into typedefs.

Change-Id: Iec6e274bed857febf7295cfcf5e9f21fe4a34da0
Reviewed-on: https://gerrit.libreoffice.org/45502
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-12-04 07:24:52 +01:00