summaryrefslogtreecommitdiff
path: root/cppuhelper
AgeCommit message (Collapse)AuthorFilesLines
2018-11-11cppCheck narrowed variableScope rEntryZdibák Zoltán1-2/+2
Change-Id: I04b0b0dc85afdceead9766d8a45e21055074d5fc Reviewed-on: https://gerrit.libreoffice.org/63248 Tested-by: Jenkins Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
2018-11-10clang-tidy: (WIP) bugprone-too-small-loop-variable findings 2Tamás Zolnai1-9/+9
Change-Id: I1ddf3fe0e5fad265ae14712a23469b684253079d Reviewed-on: https://gerrit.libreoffice.org/63241 Tested-by: Jenkins Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com>
2018-11-04replace double-checked locking patterns with thread safe local staticsMike Kaganski2-30/+9
Change-Id: I1bf67196e97411aeecc13ed4f91d1088a315e323 Reviewed-on: https://gerrit.libreoffice.org/62839 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2018-10-27tdf#120703 (PVS): V519 The variable is assigned values twice successivelyMike Kaganski1-5/+1
Change-Id: I9265425a215609ef6bf4298ba39c8399f215ce27 Reviewed-on: https://gerrit.libreoffice.org/62406 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2018-10-24remove more rtl::OUString and OString prefixesNoel Grandin29-552/+528
which seem to have snuck back in since the great rounds of removals. Change-Id: I85f7f5f4801c0b48dae8b50f51f83595b286d6a1 Reviewed-on: https://gerrit.libreoffice.org/62229 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-10-22pvs-studio: V794 The assignment operator should be protectedCaolán McNamara1-6/+12
Change-Id: Ia443a0e61a091d877c8da26bf7d45bf4261f8669 Reviewed-on: https://gerrit.libreoffice.org/62166 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2018-10-17loplugin:staticvar in cppuhelper..desktopNoel Grandin1-1/+1
Change-Id: I21cf6bafab6e865b90b29caa73183a8e00b538d1 Reviewed-on: https://gerrit.libreoffice.org/61865 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-10-17clang-tidy readability-redundant-smartptr-getNoel Grandin2-8/+6
redundant get() call on smart pointer Change-Id: Icb5a03bbc15e79a30d3d135a507d22914d15c2bd Reviewed-on: https://gerrit.libreoffice.org/61837 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-10-09Extend loplugin:redundantinline to catch inline functions w/o external linkageStephan Bergmann9-26/+26
...where "inline" (in its meaning of "this function can be defined in multiple translation units") thus doesn't make much sense. (As discussed in compilerplugins/clang/redundantinline.cxx, exempt such "static inline" functions in include files for now.) All the rewriting has been done automatically by the plugin, except for one instance in sw/source/ui/frmdlg/column.cxx that used to involve an #if), plus some subsequent solenv/clang-format/reformat-formatted-files. Change-Id: Ib8b996b651aeafc03bbdc8890faa05ed50517224 Reviewed-on: https://gerrit.libreoffice.org/61573 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-10-01loplugin:useuniqueptr in ComponentContextNoel Grandin1-44/+29
no need to store such small movable and ref-counted objects separately Change-Id: Idf4262a8edbfe07fcb4b96d1025924224b72b5b6 Reviewed-on: https://gerrit.libreoffice.org/61113 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-09-17New loplugin:externalStephan Bergmann3-5/+5
...warning about (for now only) functions and variables with external linkage that likely don't need it. The problems with moving entities into unnamed namespacs and breaking ADL (as alluded to in comments in compilerplugins/clang/external.cxx) are illustrated by the fact that while struct S1 { int f() { return 0; } }; int f(S1 s) { return s.f(); } namespace N { struct S2: S1 { int f() { return 1; } }; int f(S2 s) { return s.f(); } } int main() { return f(N::S2()); } returns 1, both moving just the struct S2 into an nunnamed namespace, struct S1 { int f() { return 0; } }; int f(S1 s) { return s.f(); } namespace N { namespace { struct S2: S1 { int f() { return 1; } }; } int f(S2 s) { return s.f(); } } int main() { return f(N::S2()); } as well as moving just the function f overload into an unnamed namespace, struct S1 { int f() { return 0; } }; int f(S1 s) { return s.f(); } namespace N { struct S2: S1 { int f() { return 1; } }; namespace { int f(S2 s) { return s.f(); } } } int main() { return f(N::S2()); } would each change the program to return 0 instead. Change-Id: I4d09f7ac5e8f9bcd6e6bde4712608444b642265c Reviewed-on: https://gerrit.libreoffice.org/60539 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-09-15Re-think cppu::throwException() and the C++/UNO bridge on iOSTor Lillqvist1-0/+8
It seems that on iOS, where we don't have any Java, Python, BASIC, or other scripting, the only thing that would use the C++/UNO bridge functionality that invokes codeSnippet() was cppu::throwException(). codeSnippet() is part of what corresponds to the code that uses run-time-generated machine code on other platforms. We can't generate code at run-time on iOS, that has been known forever. Instead we have used some manually written assembler to handle it instead. We used to have a Perl script to generate a set of code snippets for different cases, different numbers of parameters of the called function and whatnot, but that went away at some stage some year ago. (It is unclear whether that broke the C++/UNO bridge on iOS, or whether the stuff continued to work even after that.) Anyway, this handwritten assembly, or the manual construction of internal data structures for exceptions, or something else, seemed to have bit-rotten. Exceptions thrown with cppu::throwException() were not catchable properly any longer. Instead of digging in and trying to understand what is wrong, I chose another solution. It turns out that the number of types of exception objects thrown by cppu::throwException() is fairly small. During startup of the LibreOffice code, and loading of an .odt document, only one kind of exception is thrown this way... (The lovely css::ucb:InteractiveAugmentedIOException.) So we can simply have code that checks what the type of object being thrown is, and explicitgly throws such an object then with a normal C++ throw statement. Seems to work. Sadly the cppu::getCaughtException() API still needs some inline assembly in the C++/UNO brige. That seems to work though, knock on wood. This commit also adds a small "unit test" for iOS, copied from cppuhelperm to ImplSVMain(). Ideally we should not copy code around of course, but have a separate unit test app for iOS that would somehow include relevant unit tests from source files all over the place. Later. Change-Id: Ib6d9d5b6fb8cc684ec15c97a312ca2f720e87069 Reviewed-on: https://gerrit.libreoffice.org/60506 Tested-by: Jenkins Reviewed-by: Tor Lillqvist <tml@collabora.com>
2018-09-10tdf#42949 Fix IWYU warnings in include/cppuhelper/*Gabor Kelemen6-0/+7
Found with bin/find-unneeded-includes Only removal proposals are dealt with here. Change-Id: Ib420e9216b8313f5ed7634ec375e39ceb741fd45 Reviewed-on: https://gerrit.libreoffice.org/59297 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
2018-08-29replace rtl_allocateMemory with std::mallocNoel Grandin1-1/+1
where used directly, since rtl_allocateMemory now just calls into std::malloc Change-Id: I59f85bdb7efdf6baa30e8fcd2370c0f8e9c999ad Reviewed-on: https://gerrit.libreoffice.org/59685 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-08-28Fix typo in codeAndrea Gelmini1-1/+1
To complete commit: e9fa088735bfbd34bc81f1925438691f746db070 It passed "make check" on Linux Change-Id: I2772b1ac5d4024bb11f3e09e24afc566b7091fb8 Reviewed-on: https://gerrit.libreoffice.org/59693 Reviewed-by: Julien Nabet <serval2412@yahoo.fr> Tested-by: Jenkins
2018-08-13Fix typosAndrea Gelmini1-1/+1
Change-Id: Ie3baa2f843a98c1edc523050db53beaa2c803394 Reviewed-on: https://gerrit.libreoffice.org/58801 Reviewed-by: Julien Nabet <serval2412@yahoo.fr> Tested-by: Jenkins
2018-08-09No more need for CppunitTest_cppuhelper_qa_weak to be a subsequentcheckStephan Bergmann1-4/+0
...as gbuild can handle such dependencies from tests to libraries from modules higher up in the hierarchy Change-Id: Ia3993c50feba3916572febe0748c99561b8a8675 Reviewed-on: https://gerrit.libreoffice.org/58775 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-08-09Remove unnecessary test dependencyStephan Bergmann1-1/+0
Change-Id: I8202cf38e4b54fc4b457d2a7d70ad42b29ee9dec Reviewed-on: https://gerrit.libreoffice.org/58769 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-08-09No need for CppunitTest_cppuhelper_qa_misc to be a subsequentcheckStephan Bergmann1-1/+1
Change-Id: I5b27c4803a9927ff9e2be084e7abbae7fdf94f55 Reviewed-on: https://gerrit.libreoffice.org/58696 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-08-04fillUnoException not working on std::rethrow_exception exceptionsCaolán McNamara1-0/+32
used since... commit dacc1b40df67d154c96b256b0d920460f38c3d11 Date: Sat Jul 28 16:33:22 2018 +0100 ofz#9597 rethrown IOException not caught by catch IOException the adjustedPtr seems to be as expected, but the type_info not. Presumably these are thrown as 'dependent exceptions' (?) https://github.com/gcc-mirror/gcc/blob/master/libstdc%2B%2B-v3/libsupc%2B%2B/eh_type.cc#L42 Change-Id: Ibd736abe941bb1d5facdb88139b3a0e6cf32cf1f Reviewed-on: https://gerrit.libreoffice.org/58477 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2018-07-29replace double checked locking patternsJochen Nitschke1-15/+7
with thread safe static initialization Change-Id: I4c751a47e3bdf52bbfb67d4f3aabd6f442e30118 Reviewed-on: https://gerrit.libreoffice.org/58287 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-07-19Fix typosAndrea Gelmini1-1/+1
Change-Id: If7365b05c8f4fd1bf130678cb28f05c9a1add4c7 Reviewed-on: https://gerrit.libreoffice.org/57598 Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com> Tested-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
2018-07-16Add missing sal/log.hxx headersGabor Kelemen5-0/+5
rtl/string.hxx and rtl/ustring.hxx both unnecessarily #include <sal/log.hxx> (and don't make use of it themselves), but many other files happen to depend on it. This is a continuation of commit 6ff2d84ade299cb3d14d4110e4cf1a4b8070c030 to be able to remove those unneeded includes. This commit adds missing headers to every file found by: grep -FwL sal/log.hxx $(git grep -Elw 'SAL_INFO|SAL_INFO_IF|SAL_WARN|SAL_WARN_IF|SAL_DETAIL_LOG_STREAM|SAL_WHERE|SAL_STREAM|SAL_DEBUG') to directories from connectivity to cui Change-Id: I9903c10d0a04bbeb93d0f776d1d252b152459499 Reviewed-on: https://gerrit.libreoffice.org/57408 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
2018-06-29tdf#96099 Remove trivial std::map typedefs in [cd]*Arkadiy Illarionov1-5/+3
Change-Id: I043d265d3d73a3e16f05d5ca7e29a09341651d82 Reviewed-on: https://gerrit.libreoffice.org/56639 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-05-31cppuhelper : use rtl::isAlphaNumeric instead of recreate the method.Arnaud Versini1-16/+6
Change-Id: I30bd9e0bf99c2a115b67a59377b2d2ef6fdefef0 Reviewed-on: https://gerrit.libreoffice.org/54194 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Arnaud Versini <arnaud.versini@libreoffice.org>
2018-05-29loplugin:unusedfields-in-constructor in variousNoel Grandin1-3/+2
Change-Id: Ie0fb647938e3cf730976fb2e435b92bfd67ef645 Reviewed-on: https://gerrit.libreoffice.org/54998 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-05-25Improve re-throwing of UNO exceptionsNoel Grandin3-52/+76
(*) if we are already throwing a Wrapped*Exception, get the exception using cppu::getCaughtexception. (*) when catching and then immediately throwing UNO exceptions, use cppu::getCaughtException to prevent exception slicing (*) if we are going to catch an exception and then immediately throw a RuntimeException, rather throw a WrappedTargetRuntimeException and preserve the original exception information. Change-Id: Ia7a501a50ae0e6f4d05186333c8517fdcb17d558 Reviewed-on: https://gerrit.libreoffice.org/54692 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-02-26loplugin:oncevar extend to tools/gen.hxx typesNoel Grandin1-1/+1
Change-Id: I5c75875da44334569c02e2ff039b33c38397a0a2 Reviewed-on: https://gerrit.libreoffice.org/50283 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-02-11Pre-load key UNO mappings.Michael Meeks1-0/+20
Change-Id: I415e07d737c734d63ac969783464babcbb9ea884 Reviewed-on: https://gerrit.libreoffice.org/48365 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
2018-02-11lok: allow libraries to pre-init themselves.Michael Meeks1-0/+13
Populate static module references before entering a jail containing no code. Implement for scfilt, scui, swui, sdui. Change-Id: I8fec2aa78e67053a7945926c818122bd4290103c Reviewed-on: https://gerrit.libreoffice.org/49545 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
2018-02-01cppuhelper: MSVC: pragma warning: make more specific, remove obsoleteMike Kaganski1-4/+0
Change-Id: Ib097ea1764d275a3123d0dccf05d52315b4858a1 Reviewed-on: https://gerrit.libreoffice.org/48971 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2018-01-19SAL_W32 is just an alias for _WIN32Stephan Bergmann1-2/+2
...so consistently use the latter instead of the former Change-Id: I144d5e7c472632f93b2258461510346bc85892d9 Reviewed-on: https://gerrit.libreoffice.org/48135 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-01-17Fix typosAndrea Gelmini1-3/+3
Change-Id: Id1c7ddf6c49ec709e38947a82731fe31a64aad04 Reviewed-on: https://gerrit.libreoffice.org/48076 Reviewed-by: Julien Nabet <serval2412@yahoo.fr> Tested-by: Julien Nabet <serval2412@yahoo.fr>
2018-01-15More loplugin:cstylecast: cppuhelperStephan Bergmann1-8/+8
Change-Id: I193884eea6289653d648489edd1a8e929524a3c5
2018-01-12More loplugin:cstylecast: cppuhelperStephan Bergmann3-5/+5
auto-rewrite with <https://gerrit.libreoffice.org/#/c/47798/> "Enable loplugin:cstylecast for some more cases" plus solenv/clang-format/reformat-formatted-files Change-Id: I3966d302241a52014aaad41f72924a2095ea6621
2018-01-12Revert "Print the important failure messages on iOS even in a non-debug build"Stephan Bergmann1-8/+0
This reverts commit ab07f81d0b5ffc4297d5f15d2458c5cc9217800f. > Jan 12 10:21:35 <sberg> tml_, is ab07f81d0b5ffc4297d5f15d2458c5cc9217800f > still relevant? (one could imagine that if one wants such debug output during > development in a non-debug build, one could build with --enable-sal-log?) > Jan 12 10:22:01 <tml_> I have no idea what's relevant on iOS any longer > Jan 12 10:22:26 <tml_> ... but my gut feeling would be no, can be removed > Jan 12 10:23:14 <tml_> the rationale in the commit message sounds a bit thin > Jan 12 10:24:02 <tml_> surely one should test an ap well enough before > submitting, to verify that it isn't possible to get it to try to invoke a > constructor that isn't included Change-Id: I20ce8aa40a00205c1cae9d6ed4a87a6093745dc4 Reviewed-on: https://gerrit.libreoffice.org/47791 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-01-11Log just one line in cppuhelper::ServiceManager::preloadImplementations()Tor Lillqvist1-3/+48
That *is* what we want, I guess, so better I do it proactively before I am told to do it. Sorry for the back and forth, but my main point in touching this code was anyway the filtering out of the component (the KDE4Backend thing) that causes a crash for me, at least, and which it presumably is fairly pointless to preload anyway. Also, filter out libraries that for some reason have an empty name. Change-Id: I2cffd51e67c23977e0779e7f0d6faaf59d8819d9
2018-01-10Do use just std::cerr in cppuhelper::ServiceManager::preloadImplementations()Tor Lillqvist1-3/+4
As the 1aedb6c4345719a963a883b13fa983db3ab4b9a8 commit message said, the point is that we want this output even with a LO built for production where SAL_INFO() and SAL_WARN() are no-ops. Change-Id: I5f788c3914286ca8df2c7e290150adae0be42820
2018-01-10Bin superfluous using declarationsTor Lillqvist1-3/+0
Change-Id: Icf8a2703b7e72f48bde1cc3bc6fd0de2e663a407
2018-01-10Don't try to preload the KDE4 shell backend as that crashesTor Lillqvist1-0/+7
Change-Id: I1c1ff4ec7cda00a76bdeb018366afed2187c7ef8
2018-01-10Simplify logging in cppuhelper::ServiceManager::preloadImplementations()Tor Lillqvist1-39/+4
Use just SAL_INFO(), with tag "cppuhelper.preload". No unconditional writes to std::cerr. Also, log the loading attempt beforehand, so that it is printed before any crash during the loading of a component. Change-Id: Ifde8be8cb5d18dd88df21c45c906deb575d36960
2017-12-23loplugin:passstuffbyref improved returnsNoel Grandin1-2/+2
improve the detection of stuff we can return by const &, instead of by copying Change-Id: I479ae89d0413125a8295cc3cddbc0017ed61ed69 Reviewed-on: https://gerrit.libreoffice.org/46915 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-12-11loplugin:salcall fix functionsNoel Grandin5-6/+6
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-07loplugin:countusersofdefaultparams in comphelperNoel Grandin1-2/+2
Change-Id: Idb704adbe78a42bf2f2aaf7f6110698d5559e836 Reviewed-on: https://gerrit.libreoffice.org/45936 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-12-05loplugin:salcall fix non-virtual methodsNoel Grandin1-2/+2
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-11-28not used with disable-dynloadingCaolán McNamara1-1/+1
Change-Id: Idad8a7b9b984147b7a64caf7527d8ad21bdd55a2 Reviewed-on: https://gerrit.libreoffice.org/45433 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2017-11-25iOS, simplifyModule in cppuhelper is unusedlibreoffice-6-0-branch-pointjan Iversen1-0/+2
function simplifyModule is reported unused == error on iOS, therefore guarded with an #ifndef IOS Change-Id: I751cf68bd46ed17032251fede030f9082ce4e4f5
2017-11-25add cppu::throwException test caseCaolán McNamara3-0/+88
that is definitely run by the ubsan tinderbox to flush out cppuhelper/source/exc_thrower.cxx:201:15: runtime error: member call on address "foo" which does not point to an object of type 'cppuhelper::detail::XExceptionThrower' Change-Id: Ia798cc6695011480717c1a80d0ab7830080b5de1 Reviewed-on: https://gerrit.libreoffice.org/45244 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2017-11-25LOK: provide user feedback while preloading.Michael Meeks1-1/+41
Problems are hard enough to debug in a jailed kit process inside a docker image; provide some visual feedback via stderr. Change-Id: I54b0a21c1375be2acc9da0bbacf959a419471b08 Reviewed-on: https://gerrit.libreoffice.org/45256 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
2017-10-27Better fix for CppunitTest_servicesStephan Bergmann2-5/+16
...than 25313923b08018bd837cfe3fc99a5e141602cafc "Fix CppunitTest_services for constructor-based implementations..." (which this commit reverts again). My claim that "the 'factory' would be the object itself" is nonsense, it would rather be an ImplementationWrapper (but one that was freshly created for each ServiceManager::createContentEnumeration). Change-Id: I85c683cff6f9ba78d0f8567a53f8fcbc56fe55cf