Commit graph

117 commits

Author SHA1 Message Date
Noel Grandin
60728712f0 loplugin:ostr in cppu,cppuhelper
Change-Id: I15c00d7a87396d07be2d10a0311f308a93e8eec3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166751
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Jenkins
2024-04-27 15:11:25 +02:00
Stephan Bergmann
5687eba49f Drop obsolete preprocessor directives from UNOIDL files
...which were used by ildc, which is gone since
a8485d558f "[API CHANGE] Remove deprecated idlc
and regmerge from the SDK", and have always been ignored as legacy by its
unoidl-write replacement.

This change has been carried out (making use of GNU sed extensions) with

> for i in $(git ls-files \*.idl); do sed -i -z -E -e 's/\n\n((#[^\n]*\n)+\n)*(#[^\n]*\n)+\n?/\n\n/g' -e 's/\n(#[^\n]*\n)+/\n/g' "$i"; done && git checkout extensions/source/activex/so_activex.idl odk/examples/OLE/activex/so_activex.idl

which apparently happened to do the work.  (The final two files are not UNOIDL
source files.)

Change-Id: Ic9369e05d46e8f7e8a304ab01740b171b92335cd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135683
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-06-13 16:27:45 +02:00
Pragat Pandya
6abc09926c tdf#147021 Use std::size() instead of SAL_N_ELEMENTS() macro
Change-Id: I54257e87da0cd66da59d820c7960c3e4b020fda3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134027
Reviewed-by: Bartosz Kosiorek <gang65@poczta.onet.pl>
Tested-by: Jenkins
2022-05-09 20:42:03 +02:00
Noel
44d308c5fb loplugin:referencecasting in cppuhelper
Change-Id: Ie19f01a35ef656f5532c5ec41dbed1c0e4cf77d8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111026
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-02-17 09:12:56 +01:00
nienzu
c1e157b58f tdf#88205 Adapt uses of css::uno::Sequence to use initializer_list ctor
Change-Id: Ic61c1d5829b510a71b8d444f29ffed36ee540ea8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94717
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-06-05 11:34:10 +02:00
Noel Grandin
6751a89552 compact namespace in canvas..cui
Change-Id: I7bd0c2a55b936896fcfe7e1a374871008a18618f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93706
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-05-08 12:40:03 +02:00
Stephan Bergmann
f853ec317f Extend loplugin:external to warn about classes
...following up on 314f15bff0 "Extend
loplugin:external to warn about enums".

Cases where free functions were moved into an unnamed namespace along with a
class, to not break ADL, are in:

  filter/source/svg/svgexport.cxx
  sc/source/filter/excel/xelink.cxx
  sc/source/filter/excel/xilink.cxx
  svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx

All other free functions mentioning moved classes appear to be harmless and not
give rise to (silent, even) ADL breakage.  (One remaining TODO in
compilerplugins/clang/external.cxx is that derived classes are not covered by
computeAffectedTypes, even though they could also be affected by ADL-breakage---
but don't seem to be in any acutal case across the code base.)

For friend declarations using elaborate type specifiers, like

  class C1 {};
  class C2 { friend class C1; };

* If C2 (but not C1) is moved into an unnamed namespace, the friend declaration
must be changed to not use an elaborate type specifier (i.e., "friend C1;"; see
C++17 [namespace.memdef]/3: "If the name in a friend declaration is neither
qualified nor a template-id and the declaration is a function or an
elaborated-type-specifier, the lookup to determine whether the entity has been
previously declared shall not consider any scopes outside the innermost
enclosing namespace.")

* If C1 (but not C2) is moved into an unnamed namespace, the friend declaration
must be changed too, see <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71882>
"elaborated-type-specifier friend not looked up in unnamed namespace".

Apart from that, to keep changes simple and mostly mechanical (which should help
avoid regressions), out-of-line definitions of class members have been left in
the enclosing (named) namespace.  But explicit specializations of class
templates had to be moved into the unnamed namespace to appease
<https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92598> "explicit specialization of
template from unnamed namespace using unqualified-id in enclosing namespace".

Also, accompanying declarations (of e.g. typedefs or static variables) that
could arguably be moved into the unnamed namespace too have been left alone.

And in some cases, mention of affected types in blacklists in other loplugins
needed to be adapted.

And sc/qa/unit/mark_test.cxx uses a hack of including other .cxx, one of which
is sc/source/core/data/segmenttree.cxx where e.g. ScFlatUInt16SegmentsImpl is
not moved into an unnamed namespace (because it is declared in
sc/inc/segmenttree.hxx), but its base ScFlatSegmentsImpl is.  GCC warns about
such combinations with enabled-by-default -Wsubobject-linkage, but "The compiler
doesn’t give this warning for types defined in the main .C file, as those are
unlikely to have multiple definitions."
(<https://gcc.gnu.org/onlinedocs/gcc-9.2.0/gcc/Warning-Options.html>)  The
warned-about classes also don't have multiple definitions in the given test, so
disable the warning when including the .cxx.

Change-Id: Ib694094c0d8168be68f8fe90dfd0acbb66a3f1e4
Reviewed-on: https://gerrit.libreoffice.org/83239
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-11-22 12:57:32 +01:00
Noel Grandin
0d36b32755 loplugin:sequentialassign
Change-Id: I56a9bf698b60bd278c71cc632aacef2bd2f4c13f
Reviewed-on: https://gerrit.libreoffice.org/76501
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-07-29 08:53:23 +02:00
Stephan Bergmann
5206992e6e Some uses of C++17 class template argument deduction
Change-Id: I47c469c0fcdff41d83729be9489c946e81ef3686
Reviewed-on: https://gerrit.libreoffice.org/68020
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-02-19 17:39:16 +01:00
Gabor Kelemen
7bad59533d tdf#42949 Fix IWYU warnings in cppuhelper/
Found with bin/find-unneeded-includes
Only removal proposals are dealt with here.

Change-Id: I0eebd82b96d630da0597166cf87d398072607c13
Reviewed-on: https://gerrit.libreoffice.org/67473
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2019-02-14 13:36:03 +01:00
Tamás Zolnai
afbfe42e63 clang-tidy: (WIP) bugprone-too-small-loop-variable findings 2
Change-Id: I1ddf3fe0e5fad265ae14712a23469b684253079d
Reviewed-on: https://gerrit.libreoffice.org/63241
Tested-by: Jenkins
Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com>
2018-11-10 23:11:28 +01:00
Noel Grandin
6f50961e69 remove more rtl::OUString and OString prefixes
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-24 14:43:34 +02:00
Caolán McNamara
6ddecf61ec fillUnoException not working on std::rethrow_exception exceptions
used since...

commit dacc1b40df
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-08-04 15:37:30 +02:00
Stephan Bergmann
71a6caf49b More loplugin:cstylecast: cppuhelper
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-12 20:26:29 +01:00
Caolán McNamara
3511baaf94 add cppu::throwException test case
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-25 15:54:38 +01:00
Noel Grandin
c9253818ec loplugin:oncevar
extend oncevar to any POD type

Change-Id: Ia98ee0a67f183e40fb0c38477760124b2c411dc0
Reviewed-on: https://gerrit.libreoffice.org/40564
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-07-31 08:25:07 +02:00
Noel Grandin
48e83f7be2 makeAny->Any in cppuhelper..cui
Change-Id: Ia54e6e9b71df68bd04c304a0bb02da8ebac74420
Reviewed-on: https://gerrit.libreoffice.org/34603
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-02-24 09:17:34 +00:00
Noel Grandin
2670ca3fc5 a whole bunch of SAL_WARN_UNUSED
Change-Id: Iea28debc7d3abc58cca21bd3856cb65b321dc1e6
Reviewed-on: https://gerrit.libreoffice.org/33693
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-01-31 05:32:03 +00:00
Stephan Bergmann
e57ca02849 Remove dynamic exception specifications
...(for now, from LIBO_INTERNAL_CODE only).  See the mail thread starting at
<https://lists.freedesktop.org/archives/libreoffice/2017-January/076665.html>
"Dynamic Exception Specifications" for details.

Most changes have been done automatically by the rewriting loplugin:dynexcspec
(after enabling the rewriting mode, to be committed shortly).  The way it only
removes exception specs from declarations if it also sees a definition, it
identified some dead declarations-w/o-definitions (that have been removed
manually) and some cases where a definition appeared in multiple include files
(which have also been cleaned up manually).  There's also been cases of macro
paramters (that were used to abstract over exception specs) that have become
unused now (and been removed).

Furthermore, some code needed to be cleaned up manually
(avmedia/source/quicktime/ and connectivity/source/drivers/kab/), as I had no
configurations available that would actually build that code.  Missing @throws
documentation has not been applied in such manual clean-up.

Change-Id: I3408691256c9b0c12bc5332de976743626e13960
Reviewed-on: https://gerrit.libreoffice.org/33574
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-01-26 12:54:43 +00:00
Jochen Nitschke
61b00192cd tdf#88206 replace cppu::WeakImplHelper* in cppuhelper
Change-Id: I3130a3fe28c00bd83cade9667a6e3b3abcb719f7
Reviewed-on: https://gerrit.libreoffice.org/31714
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2016-12-07 13:25:50 +00:00
Stephan Bergmann
91dd2db17b loplugin:override: No more need for the "MSVC dtor override" workaround
The issue of 362d4f0cd4 "Explicitly mark
overriding destructors as 'virtual'" appears to no longer be a problem with
MSVC 2013.

(The little change in the rewriting code of compilerplugins/clang/override.cxx
was necessary to prevent an endless loop when adding "override" to

  OOO_DLLPUBLIC_CHARTTOOLS    virtual ~CloseableLifeTimeManager();

in chart2/source/inc/LifeTime.hxx, getting stuck in the leading
OOO_DLLPUBLIC_CHARTTOOLS macro.  Can't remember what that
isAtEndOfImmediateMacroExpansion thing was originally necessary for, anyway.)

Change-Id: I534c634504d7216b9bb632c2775c04eaf27e927e
2016-09-13 13:19:22 +02:00
Miklos Vajna
b3c72c7340 cppuhelper: fix loplugin:cppunitassertequals warnings
Change-Id: Ia7c3de84b8001a30dbe1863be58a9639167cfa11
Reviewed-on: https://gerrit.libreoffice.org/28760
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Jenkins <ci@libreoffice.org>
2016-09-09 08:23:44 +00:00
Stephan Bergmann
d4857e30b1 loplugin:override
Change-Id: Ic89d255bf56234a82b23ad6cc36d8d1250acbcab
2015-11-20 09:11:00 +01:00
Noel Grandin
8569c6d0ad use initialiser list for Sequence<OUString>
Change-Id: Ia5e47261d1fc6fac2d046656c05a1c5eedb07e02
Reviewed-on: https://gerrit.libreoffice.org/19978
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
2015-11-16 08:35:42 +00:00
Noel Grandin
96c26b0d9d use initialiser for Sequence<OUString>
using variations of:
git grep -lP 'Sequence.*OUString.*\(\s*1\s*\)' | xargs perl -0777 -pi -e "s/Sequence<OUString> (\w+)\(1\)\;
\s*OUString\* pArray.*;
.*\[0\]\s*=\s*(\S+)\;/Sequence<OUString> \1 { \2 };/g"

Change-Id: I03c64334ff30ee14dce0d17b67f5122a3893bbe3
Reviewed-on: https://gerrit.libreoffice.org/19971
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Tested-by: Noel Grandin <noelgrandin@gmail.com>
2015-11-15 12:20:39 +00:00
Stephan Bergmann
bf3f840302 loplugin:nullptr (automatic rewrite)
Change-Id: I62a63915dfc0bced2cd8ffe3999cbde5c4d97b0b
2015-11-10 10:31:21 +01:00
Stephan Bergmann
b36963c0a6 Replace "SAL_OVERRIDE" with "override" in LIBO_INTERNAL_ONLY code
Change-Id: I2ea407acd763ef2d7dae2d3b8f32525523ac8274
2015-10-12 17:52:29 +02:00
Noel Grandin
b55166d266 Revert "return and use std::vector from OInterfaceContainerHelper"
This reverts commit e57314f61f.
2015-06-29 10:11:53 +02:00
Noel Grandin
e57314f61f return and use std::vector from OInterfaceContainerHelper
since most of the time we don’t need a heavyweight uno::Sequence.
Adds a new method getElementsAsVector().

Change-Id: I9e72bef0c0c723ffd0dd7d4152db5baec6784a7a
Reviewed-on: https://gerrit.libreoffice.org/15747
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Tested-by: Noel Grandin <noelgrandin@gmail.com>
2015-06-29 07:25:22 +00:00
Caolán McNamara
ad62165065 cppcheck: noExplicitConstructor
Change-Id: Ic33ee6936f40bec4f3a82aea39a180ae6e9a0928
2015-06-09 10:34:00 +01: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
d269b9ab6a Remove unused */qa/checkapi/
...superseded by CppunitTest_odk_checkapi

Change-Id: I5df89a1a12f496984deab153f0ba2734323c1293
2014-12-19 10:06:45 +01:00
Andrea Gelmini
c70f1545e2 Removed duplicated includes
Change-Id: I5362d997bfa086c9fb1726efcb15132a966684f6
Reviewed-on: https://gerrit.libreoffice.org/12160
Tested-by: LibreOffice gerrit bot <gerrit@libreoffice.org>
Reviewed-by: Michael Stahl <mstahl@redhat.com>
2014-10-31 16:18:30 +00:00
Noel Grandin
da906ab937 cppuhelper: remove SAL_THROW macro
Change-Id: I54141071396d04e7bead56da14a665b8556ba6d2
2014-06-05 08:17:46 +02:00
Thomas Arnhold
530899ba18 cppuhelper: fix includes
Change-Id: I0e6bc822d19cf266dea716fe92f2ccd08d87c51f
2014-06-04 21:18:39 +02:00
Julien Nabet
bd59628620 Prefer cppu::UnoType<T>::get() to ::getCppuType((T*)0) part10
Change-Id: I67acda35fa127547dcea0cd18c9dc16db7c00294
2014-05-11 10:16:42 +02:00
Stephan Bergmann
fa0ffdbeb5 cppu::OMultiTypeInterfaceContainerHelperVar hashImpl param is unused
...since f059134fab "INTEGRATION: CWS
cppuhelpshrink: #i72766# save memory in cppuhelper, using a vector instead of a
hash_map" (but a dummy "void" default is left in place for backwards
compatibility).

Change-Id: I3bb0af8158f34737d41c344464f3cf944e2891ed
2014-04-15 07:46:43 +02:00
Stephan Bergmann
70cc2b191b First batch of adding SAL_OVERRRIDE to overriding function declarations
...mostly done with a rewriting Clang plugin, with just some manual tweaking
necessary to fix poor macro usage.

Change-Id: I71fa20213e86be10de332ece0aa273239df7b61a
2014-03-26 16:39:26 +01:00
Stephan Bergmann
5e21a413c7 cppuhelper: retrofit std::exception into overriding exception specs
Change-Id: I56e32131b7991ee9948ce46765632eb823d463b3
2014-02-26 18:22:20 +01:00
Stephan Bergmann
9ed364774c Adapt all (non-extension, SharedLibrary) .components to environment="..."
Change-Id: I56f38bd786f3a026cb2908f28540dc9c4003af83
2013-12-17 11:06:00 +01:00
Stephan Bergmann
a83b2af9ab Clean-up uno/lbnames.h
Change-Id: I4bd729499aa8be58f04194656e35c1f79d5d4919
2013-12-16 21:43:12 +01:00
Caolán McNamara
3656a57e88 add mode lines to new files (and idls) since last run
Change-Id: Id1e74f18c90e69d1a781c8f02e30dc3c005ed4fd
2013-09-22 12:21:34 +01:00
Herbert Dürr
1857688e1f Resolves: #i122208# introduce rtl::CStringHash and rtl::CStringEqual
unify the various c-string compares and hashes.

(cherry picked from commit b7e3470a154538a92f0a21b14e726d75723f4a92)

Conflicts:
	oox/inc/oox/export/shapes.hxx
	oox/source/export/shapes.cxx
	sal/inc/rtl/string.hxx
	sdext/source/minimizer/pppoptimizertoken.cxx
	svx/source/customshapes/EnhancedCustomShapeTypeNames.cxx
	vcl/source/glyphs/gcach_ftyp.cxx
	writerfilter/source/resourcemodel/TagLogger.cxx
	xmloff/source/draw/EnhancedCustomShapeToken.cxx

Change-Id: Ib742744077bfb4d38a462d88b44bdef45601b4ae
2013-05-10 12:36:33 +01:00
Thomas Arnhold
8b27d78b4a automated removal of RTL_CONSTASCII_USTRINGPARAM for quoted OUStrings
Done with a perl regex:

s/OUString\s*\(\s*RTL_CONSTASCII_USTRINGPARAM\s*\((\s*"[^")]*?"\s*)\)\s*\)/OUString\($1\)/gms

Change-Id: Idf28320817cdcbea6d0f7ec06a9bf51bd2c3b3ec
Reviewed-on: https://gerrit.libreoffice.org/2832
Reviewed-by: Thomas Arnhold <thomas@arnhold.org>
Tested-by: Thomas Arnhold <thomas@arnhold.org>
2013-03-19 09:00:26 +00:00
Michael Meeks
9d7c1dcbbb re-base on ALv2 code. Includes:
Patches contributed by Ocke Janssen
   converted reportdesign.
   http://svn.apache.org/viewvc?view=revision&revision=1396797
   http://svn.apache.org/viewvc?view=revision&revision=1394326

   Patch contributed by Oliver Rainer-Wittmann
   sw34bf06: #i117783# - Writer's implementation of XPagePrintable -
   apply print settings to new printing routines
   http://svn.apache.org/viewvc?view=revision&revision=1172115
2012-12-06 09:12:57 +00:00
Thorsten Behrens
66a175834c c++ API: use css alias in generated headers, adds global css decl
This changes all generated API headers (.hpp and .hdl) to use a
namespace alias 'css' instead of the pointlessly long com::sun::star

Makes the change in cppumaker & associated tools, adds a global
namespace alias definition in sal/types.h, and removes a kiloton
of local, now pointless-to-harmful versions of that alias from all
over the code.

Change-Id: Ice5a644a6b971a981f01dc0589d48f5add31cc0f
2012-11-30 14:36:36 +01:00
Tor Lillqvist
60cfa64345 Bin no longer used iOS cppunit stuff that even breaks the build
Change-Id: I459f7fd097a81ef5977974f52b0cc2c2f155a810
2012-08-02 19:16:53 +03:00
Luboš Luňák
6080259862 allow using rtl::OUString etc. simply as OUString, without rtl::
http://lists.freedesktop.org/archives/libreoffice/2012-April/029940.html

The RTL_USING #define (set by gbuild for anything that's not public
API) allows to use such classes simply by their name, without having
to use the namespace or do explicit using rtl::OUString (which half
of the sources do anyway).

Change-Id: I7edaf12cd278489cdc1d5ff782f0a86361c13c0a
2012-07-16 16:03:03 +02:00
Michael Meeks
2005a34318 re-base on ALv2 code. 2012-06-29 15:51:49 +01:00
Michael Meeks
328e2263fb targetted re-work of cppunit pieces. 2012-06-27 19:13:11 +01:00