Commit Graph
1571 Commits
Author SHA1 Message Date
Caolán McNamara 1ac449874c update pches
Change-Id: I3e22c2000da03f6f3345353846213203993aa865
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107192
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2020-12-04 12:05:13 +01:00
Philipp Hofer fddcbd5d28 tdf#123936 Formatting files in module cppu with clang-format
Change-Id: I98281fce06c2a8c094db9e80c1f6bdf35ce70ccd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105657
Tested-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
2020-11-13 15:14:36 +01:00
Stephan Bergmann de26b2661b loplugin:stringview (macOS)
Change-Id: Ie3a6db501328e787d7b87dfd1aef73d9d79a49ae
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105608
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-11-12 08:09:35 +01:00
Noel Grandin 242320d303 new loplugin:reducevarscope
Change-Id: Iefe922c2e0d605114d54673d63eccc5e4abd545d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102143
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-11-10 17:11:00 +01:00
Gabor Kelemen 7bdbb50a50 tdf#42949 Fix new IWYU warnings in directories c*
Found with bin/find-unneeded-includes
Only removal proposals are dealt with here.

Change-Id: Iac1e7802dbe1efa01c2befdd10406231788d4fc1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105315
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2020-11-06 08:18:45 +01:00
Stephan Bergmann 1a1d432420 Add single-instance attribute for *.compoonent <implementation>s
...to ease the implementation in C++ code of constructor-based <implementation>s
that shall be single-instance (and which would have been implemented with e.g.
cppu::creaetOneInstanceFactory for non--constructor-based <implementation>s).
See e.g. 6e35794cad "terminate XDesktop properly
in unit tests" and 6362ebab29 "dbaccess: create
instances with uno constructors" for the clumsy approach used until now, where
the C++ constructor function uses a static instance that is cleared in
dispose(), adding fake <singleton> entries to <implementation>s where necessary
so that the ServiceManager will call those XComponent::dispose() functions when
it itself gets disposed.

For every <implementation>, the ServiceManager already holds an Implementation
data structure, so it can easily hold a singleInstance there and clear it when
the ServiceManager gets disposed.  (One consequence is that single-instance
implementations are now created with their Instance.mutex locked, but that
should not cause problems in practice, given that the construction of a single-
instance implementation should not recursively request its own construction
anyway.)

The new single-instance="true" attribute is mostly useful in combination with
the constructor attribute (see above), but it can also be used for non--
constructor-based <implementation>s, at least in theory.

(The single-instance="true" attribute is orthogonal to <singleton> elements.
There are existing single-instance services---even if those should arguably have
been defined as singletons in the first place---that can benefit from
single-instance="true".  And there are <implementation>s that support one or
more <singleton>s alongside one or more <service>s, where the latter are not
single-instance.)

This new single-instance="true" attribute in *.component files should not
interfere with the lo_get_constructor_map machinery in the DISABLE_DYNLOADING
branch of cppuhelper::detail::loadSharedLibComponentFactory
(cppuhelper/source/shlib.cxx) used by Android, iOS and some fuzzer code.
AFAIU, the lo_get_constructor_map machinery should only ever come into play
after the ServiceManager has decided whether or not to create a new instance
based on the single-instance attributes in the *.component files.

This commit only provides the new single-instance="true" attribute.  Actual
changes of <implementation>s and their C++ constructor functions are delegated
to a series of follow-up commits.  (So that they can easily be reverted
individually should the need arise.)

Change-Id: Iea6c0fc539d74477b7a536dc771b198df6b0510e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103734
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-10-01 09:44:53 +02:00
Caolán McNamara 72fd000cc6 update pches
Change-Id: I41a204fbc5e2c9b819fb948c5288f8d7b4195489
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103117
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2020-09-21 20:10:38 +02:00
Stephan Bergmann e6dfaf9f44 Turn OUStringLiteral into a consteval'ed, static-refcound rtl_uString
...from which an OUString can cheaply be instantiated.  This is the OUString
equivalent of 4b9e440c51 "Turn OStringLiteral into
a consteval'ed, static-refcound rtl_String".  Most remarks about that commit
apply here too (this commit is just substantially bigger and a bit more
complicated because there were so much more uses of OUStringLiteral than of
OStringLiteral):

The one downside is that OUStringLiteral now needs to be a template abstracting
over the string length.  But any uses for which that is a problem (e.g., as the
element type of a container that would no longer be homogeneous, or in the
signature of a function that shall not be turned into a template for one reason
or another) can be replaced with std::u16string_view, without loss of efficiency
compared to the original OUStringLiteral, and without loss of expressivity.

The new OUStringLiteral ctor code would probably not be very efficient if it
were ever executed at runtime, but it is intended to be only executed at compile
time.  Where available, C++20 "consteval" is used to statically ensure that.

The intended use of the new OUStringLiteral is in all cases where an
object that shall itself not be an OUString (e.g., because it shall be a
global static variable for which the OUString ctor/dtor would be detrimental at
library load/unload) must be converted to an OUString instance in at least one
place.  Other string literal abstractions could use std::u16string_view (or just
plain char16_t const[N]), but interestingly OUStringLiteral might be more
efficient than constexpr std::u16string_view even for such cases, as it should
not need any relocations at library load time.  For now, no existing uses of
OUStringLiteral have been changed to some other abstraction (unless technically
necessary as discussed above), and no additional places that would benefit from
OUStringLiteral have been changed to use it.

Global constexpr OUStringLiteral variables defined in an included file would be
somewhat suboptimal, as each translation unit that uses them would create its
own, unshared instance.  The envisioned solution is to turn them into static
data members of some class (and there may be a loplugin coming to find and fix
affected places).  Another approach that has been taken here in a few cases
where such variables were only used in one .cxx anyway is to move their
definitions from the .hxx into that one .cxx (in turn causing some files to
become empty and get removed completely)---which also silenced some GCC
-Werror=unused-variable if a variable from a .hxx was not used in some .cxx
including it.

To keep individual commits reasonably manageable, some consumers of
OUStringLiteral in rtl/ustrbuf.hxx and rtl/ustring.hxx are left in a somewhat
odd state for now, where they don't take advantage of OUStringLiteral's
equivalence to rtl_uString, but just keep extracting its contents and copy it
elsewhere.  In follow-up commits, those consumers should be changed
appropriately, making them treat OUStringLiteral like an rtl_uString or
dropping the OUStringLiteral overload in favor of an existing (and cheap to use
now) OUString overload, etc.

In a similar vein, comparison operators between OUString and std::u16string_view
have been added to the existing plethora of comparison operator overloads.  It
would be nice to eventually consolidate them, esp. with the overloads taking
OUStringLiteral and/or char16_t const[N] string literals, but that appears
tricky to get right without introducing new ambiguities.  Also, a handful of
places across the code base use comparisons between OUString and OUStringNumber,
which are now ambiguous (converting the OUStringNumber to either OUString or
std::u16string_view).  For simplicity, those few places have manually been fixed
for now by adding explicit conversion to std::u16string_view.

Also some compilerplugins code needed to be adapted, and some of the
compilerplugins/test cases have become irrelevant (and have been removed), as
the tested code would no longer compile in the first place.

sal/qa/rtl/strings/test_oustring_concat.cxx documents a workaround for GCC bug
<https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96878> "Failed class template
argument deduction in unevaluated, parenthesized context".  That place, as well
as uses of OUStringLiteral in extensions/source/abpilot/fieldmappingimpl.cxx and
i18npool/source/localedata/localedata.cxx, which have been replaced with
OUString::Concat (and which is arguably a better choice, anyway), also caused
failures with at least Clang 5.0.2 (but would not have caused failures with at
least recent Clang 12 trunk, so appear to be bugs in Clang that have meanwhile
been fixed).

Change-Id: I34174462a28f2000cfeb2d219ffd533a767920b8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102222
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-09-16 23:02:09 +02:00
George Bateman 08cc983e26 tdf#124176 Use #pragma once in cppu, cppuhelper
This commit was carried out by a Python script, source of which
is at https://bugs.documentfoundation.org/show_bug.cgi?id=124176#c97.

Change-Id: I0b7c5bec8e56bd21e719c8889fe263e377f3b8ca
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102547
Tested-by: Jenkins
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2020-09-13 15:28:21 +02:00
Caolán McNamara 0593f35f77 TabPage no longer needs to inherit from VclBuilderContainer
Change-Id: Iaab26ade1109daf732e58a2f3741cc43243e374c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102023
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2020-09-04 22:22:16 +02:00
Caolán McNamara cef50b5266 move Edit into toolkit only headers
Change-Id: If51bf7143116721e8f16272cf8aff797651d5ed1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101880
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2020-09-02 12:52:26 +02:00
Stephan Bergmann 33ecd0d5c4 Change OUStringLiteral from char[] to char16_t[]
This is a prerequisite for making conversion from OUStringLiteral to OUString
more efficient at least for C++20 (by replacing its internals with a constexpr-
generated sal_uString-compatible layout with a SAL_STRING_STATIC_FLAG refCount,
conditionally for C++20 for now).

For a configure-wise bare-bones build on Linux, size reported by `du -bs
instdir` grew by 118792 bytes from 1155636636 to 1155755428.

In most places just a u"..." string literal prefix had to be added.  In some
places

  char const a[] = "...";

variables have been changed to char16_t, and a few places required even further
changes to code (which prompted the addition of include/o3tl/string_view.hxx
helper function o3tl::equalsIgnoreAsciiCase and the additional
OUString::createFromAscii overload).

For all uses of macros expanding to string literals, the relevant uses have been
rewritten as

  u"" MACRO

instead of changing the macro definitions.  It should be possible to change at
least some of those macro definitions (and drop the u"" from their call sites)
in follow-up commits.

Change-Id: Iec4ef1a057d412d22443312d40c6a8a290dc6144
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101483
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-08-28 08:07:09 +02:00
Caolán McNamara 98b47440d2 remove some unused includes and update pches
Change-Id: I786548bef39fa711aabcff32b592b3fdc4a6f9fc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101486
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2020-08-27 20:14:43 +02:00
Andrea Gelmini c9a0cbc856 Fix typos
Change-Id: I58c510121a9f535b2a31854f10b5f6535554d379
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100988
Tested-by: Jenkins
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2020-08-19 15:41:21 +02:00
Noel Grandin e67657d521 loplugin:simplifybool more
look for expressions like
    !(a && !b)
which can be expanded out

Change-Id: I72515a9638762b050f9a258c08da39ebfa2ef8e7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100579
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-08-14 18:03:06 +02:00
Caolán McNamara 70a008181a SvTreeListBox can move into toolkit headers now
Change-Id: I6b3b6ef1530a192f4b6bf87aa9688687063683ea
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100591
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2020-08-12 20:23:20 +02:00
Stephan Bergmann 986bd8b93b -Werror,-Wuninitialized (apparently new in Clang 12 trunk)
> cppuhelper/source/typemanager.cxx:1571:47: error: field 'entity_' is uninitialized when used here [-Werror,-Wuninitialized]
>         ServiceBasedSingletonDescription_Base(entity_->isPublished()),
>                                               ^

The code was like that ever since it was introduced in
fa559f1c41 "WIP: Experimental new binary type.rdb
format".  Odd that that never caused an issue, but the code appears to at least
never be executed during `make check`.

Change-Id: I19fe78162c7c4a9211c380648595df9aa54bf4d7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100554
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-08-12 06:08:48 +02:00
Tor Lillqvist e2bd5afd72 Make the C++/UNO bridge work to some extent on macOS on arm64
Use the same code as for Linux on aarch64, with minor
additional hacks. But that will not actually work in all cases, as
there are slight differences in the ABI. See
https://developer.apple.com/library/archive/documentation/Xcode/Conceptual/iPhoneOSABIReference/Articles/ARM64FunctionCallingConventions.html

Thus we can drop the use of the lo_mobile_throwException() hack that
was very temporarily used.

The run-time code generation requires use of a new API on macOS to
work: See the use of pthread_jit_write_protect_np() in
bridges/source/cpp_uno/shared/vtablefactory.cxx.

For some reason, with the Xcode 12 betas, when compiling for
arm64-apple-macos, the symbols for the type_infos for the UNO
exception types (_ZTIN3com3sun4star3uno16RuntimeExceptionE etc) end up
as "weak private external" in the object file, as displayed by "nm -f
darwin". We try to look them up with dlsym(), but that then fails. So
use a gross hack: Introduce separate real variables that point to
these typeinfos, and look up and dereference them instead. If this
hack ends up needing to be permanent, instead of having a manually
edited set of such pointer variables, we should teach codemaker to
generate corresponding functions, and look up and invoke them to get
the std::type_info pointer.

When compiling for x86_64-apple-macos, the type_info symbols end up as
"weak external" which is fine.

With this, LibreOffice starts and seems to work to some extent, and
many unit tests succeed.

Change-Id: I05f46a122a51ade1ac7dccd57cb90e594547740e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100408
Tested-by: Jenkins
Reviewed-by: Tor Lillqvist <tml@collabora.com>
2020-08-10 17:51:27 +02:00
Tor Lillqvist 24d94f9a15 Use the lo_mobile_throwException() thing on macOS on arm64 for now
Change-Id: I58720d25c4838f1f4ee79a2586a61cc7d03ef853
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100281
Tested-by: Jenkins
Reviewed-by: Tor Lillqvist <tml@collabora.com>
2020-08-07 13:32:12 +02:00
Stephan Bergmann 37587df624 Remove no longer relevant assert
...that was apparently meant to guard the following

  &context_values[0]

that got changed to

  context_values.data()

in c18e2ea2a5 "New loplugin:data"

Change-Id: Ic63d8e775f3b75cca7df2b08665cccc0b4c3ec3e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99316
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-07-23 19:49:49 +02:00
Caolán McNamara b050b7eeff update pches
Change-Id: I75602277a5a26b012a12f2c4f4b7ff5bb663b0b9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98474
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2020-07-12 12:20:05 +02:00
Thorsten Behrens c5b985bc9b replace usage of blacklist with excludelist for IWYU
Background and motivation:
  https://tools.ietf.org/html/draft-knodel-terminology-02

Change-Id: I2f22d455d2a936a85750eaab1fda215ebb6d9d48
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98182
Tested-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
2020-07-10 02:03:40 +02: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 054c0e7177 loplugin:simplifypointertobool improve
to look for the
    x.get() != null
pattern, which can be simplified to
    x

I'll do the
   x.get() == nullptr
pattern in a separate patch, to reduce the chances of a mistake

Change-Id: I45e0d178e75359857cdf50d712039cb526016555
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95354
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-06-03 10:51:57 +02:00
Noel Grandin 9a0faf09a8 use for-range on Sequence in cppuhelper,cui
Change-Id: I482d48e29ddc9690d9c671cde2f6b0c611ec378d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94550
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-05-20 08:37:46 +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
Noel Grandin 23dad0aa08 loplugin:flatten in cppuhelper
Change-Id: I814a109b7822d7a6cd23b5aa4220d496a4da2fb8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92425
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-04-17 21:07:27 +02:00
Noel Grandin 1178521759 loplugin:buriedassign in c*
Change-Id: Id14fed7e5c0f588ad3c927f12251432d12c1a7c8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92190
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-04-14 16:35:38 +02:00
Andrea Gelmini 8305d28f8d Fix typo
Change-Id: Id3fe1d66cb1d3cb57f8aa5e652bf1c9ad6346091
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90286
Tested-by: Jenkins
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2020-03-10 20:43:41 +01:00
Michael Weghorn cd6b32ef1f tdf#127781 Android Viewer: aarch64: Avoid throwing exceptions through bridges
This basically extends what commit
eb15ac837e ("android: Avoid
throwing exceptions through the bridges.", 2019-11-29), amended
by f2f8a2ec10 ("android:
Actually let's avoid the exceptions via bridges only on aarch4.",
2019-12-02) did for the online-based Android app to cover the Android
Viewer case as well.

This makes Android Viewer work on aarch64, which previously crashed
whenever trying to load a document.

Change-Id: Id8b30e1dced583159cc4d81aaa18f4c25b901cff
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90047
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2020-03-05 20:17:24 +01:00
Jan Holesovsky f2f8a2ec10 android: Actually let's avoid the exceptions via bridges only on aarch4.
Change-Id: Id2830f09ca6afd11f6f866565f37bdb7ba45bfb1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/84205
Tested-by: Jenkins
Reviewed-by: Andras Timar <andras.timar@collabora.com>
2020-02-11 15:24:34 +01:00
Luboš Luňák 69e0d871ec make update_pch also consider files in <module>/src/**/inc
With --enable-pch=full there's not much difference between a "public"
header in <module>/inc and a private one in <module>/src/somewhere/inc .
And since the script searches recursively, this apparently helps to
find even more headers for lower pch levels.

Change-Id: I8483d0aa5b4fea5a59107c20a8aa5f1ef694af0a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87799
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2020-02-01 20:12:21 +01:00
Stephan Bergmann aef7feb3e6 New loplugin:unsignedcompare
"Find explicit casts from signed to unsigned integer in comparison against
unsigned integer, where the cast is presumably used to avoid warnings about
signed vs. unsigned comparisons, and could thus be replaced with
o3tl::make_unsigned for clairty." (compilerplugins/clang/unsignedcompare.cxx)

o3tl::make_unsigned requires its argument to be non-negative, and there is a
chance that some original code like

  static_cast<sal_uInt32>(n) >= c

used the explicit cast to actually force a (potentially negative) value of
sal_Int32 to be interpreted as an unsigned sal_uInt32, rather than using the
cast to avoid a false "signed vs. unsigned comparison" warning in a case where
n is known to be non-negative.  It appears that restricting this plugin to non-
equality comparisons (<, >, <=, >=) and excluding equality comparisons (==, !=)
is a useful heuristic to avoid such false positives.  The only remainging false
positive I found was 0288c8ffec "Rephrase cast
from sal_Int32 to sal_uInt32".

But which of course does not mean that there were no further false positivies
that I missed.  So this commit may accidentally introduce some false hits of the
assert in o3tl::make_unsigned.  At least, it passed a full (Linux ASan+UBSan
--enable-dbgutil) `make check && make screenshot`.

It is by design that o3tl::make_unsigned only accepts signed integer parameter
types (and is not defined as a nop for unsigned ones), to avoid unnecessary uses
which would in general be suspicious.  But the STATIC_ARRAY_SELECT macro in
include/oox/helper/helper.hxx is used with both signed and unsigned types, so
needs a little oox::detail::make_unsigned helper function for now.  (The
ultimate fix being to get rid of the macro in the first place.)

Change-Id: Ia4adc9f44c70ad1dfd608784cac39ee922c32175
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87556
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-01-28 07:42:15 +01:00
Noel Grandin de60c73db3 simplify InterfaceContainerHelper::clear
instead of relying on side-effects from instantiating an iterator

Change-Id: Ie66b9e7ceeb3c4a0f4243fdd0a5ac37af77e98ab
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87412
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-01-26 08:00:59 +01:00
Noel Grandin e5cfe9c050 loplugin:makeshared in connectivity..cppuhelper
Change-Id: Id8064e961a64bb03bc0fb61e375cdcf769b340cd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87276
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-01-24 07:18:44 +01:00
Noel Grandin ec94926665 Use std::vector in OInterfaceContainerHelper instead of Sequence
instead of fighting the fact that Sequence is intended to be immutable

getSequence() will become a little slower, but since getSequence()
is called 5k times during 'make check', while add/remove are called
3M times, I think it's safe to say mutation is dominant.

Change-Id: I23d127c93c589050d6c06c0da47871e1ebe7b52d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86929
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-01-17 13:40:59 +01:00
Noel Grandin 2b8cf734e3 improve "convert OSL_ASSERT to assert"
this fixes commit 3a0c457444, by
converting the assert in removeInterface() to SAL_WARN_IF, and similarly
for the related addInterface() method

Comment from sberg on the original commit:

This leaves OInterfaceContainerHelper::add-/removeInterface in somewhat
inconsistent state (as addInterface OSL_ASSERTs non-null but then also
explicitly checks for null, i.e., effectively supports null).

css.lang.XComponent::add-/removeEventListener do not explicitly specify
whether or not their arg may be null.  I /think/ we traditionally
supported null; asserting non-null thus might cause issues for 3rd-party
code.

Change-Id: I1e28cc03aa7dfe662125c573d60b447309009448
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86827
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-01-15 10:34:49 +01:00
Noel Grandin 3a0c457444 convert OSL_ASSERT to assert
and fix the one place triggering it

Change-Id: I87ec57c6a92ed89fdacfcb0d650525eaeaa266b9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86822
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-01-15 08:27:52 +01:00
Noel Grandin 248ddbc4e9 clang-tidy modernize-concat-nested-namespace in cppcanvas..cppuhelper
Change-Id: I0bb4ea91288a15fb590d077fb390c53be8b50400
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86801
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-01-15 06:58:12 +01:00
Stephan Bergmann 35fbf45405 Remove unused prefix="direct" feature
It got introduced with b6cebf4a3e "Allow UNO
component libraries to have each implementation in its own function", then
ae3a0c8da5 "Add .component <implementation
constructor='...' feature" removed all of its uses and noted:  "[...] (which had
previously been adapted to use the prefix="direct" feature, which may become
unnecessary again in the end, depending on how to handle single-instance
services/singletons)."  Handling of single-instance services/singletons has been
added with 997d211833 "Support for singleton
constructor functions" and the feature has really become unnecessary again.

Change-Id: I1ab910805d61421f892a244313c8778cd453f98c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86765
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-01-14 16:31:57 +01:00
Noel Grandin 175a2063ef use more std::make_shared
found using 'git grep', I tried using clang-tidy, but it only
successfully found a tiny fraction of these

Change-Id: I61c7d85105ff7a911722750e759d6641d578da33
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86526
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-01-10 13:07:41 +01:00
Stephan Bergmann c97965e1b5 Merge ImplementationInfo back into Implementation
...and rename constructor members to constructorName/constructorFn for
disambiguation.

"Splitting ImplementationInfo out of Implementation has become necessary to
avoid circular references" in c16d0dd846
"fdo#49291 Postpone actual factory instantiation as long as possible", but was
no longer necessary since 997d211833 "Support for
singleton constructor functions" (which also removed the need to hold
ImplemenationInfo by shared_ptr, which has already been cleaned up with
fc11bce491 "ImplementationInfo can be inlined").

Change-Id: I51467aa7b1fce56d6549738efd1f34f91925dac5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86013
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-12-30 19:42:49 +01:00
Noel Grandin fc11bce491 ImplementationInfo can be inlined
no need to hold by shared_ptr, it is never shared

Change-Id: I4818c08e4beab57d777e90d181d92a3edddffbf5
Reviewed-on: https://gerrit.libreoffice.org/85772
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-12-24 11:38:51 +01:00
Noel Grandin 685c9642c1 sal_Char->char in cppcanvas..cui
Change-Id: I7e9fa7011f1e0bf143f86055718c772caebf8ee6
Reviewed-on: https://gerrit.libreoffice.org/85397
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-12-18 17:40:23 +01:00
Andrea Gelmini 7eb5b4a0de Fix typo
Change-Id: I3c8a0d5fb2b17ccef3c931f13230f99b1945a4bc
Reviewed-on: https://gerrit.libreoffice.org/84566
Tested-by: Jenkins
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2019-12-05 18:52:38 +01:00
Jan Holesovsky eb15ac837e android: Avoid throwing exceptions through the bridges.
From some reason it does not work, so let's do the same we are doing on
iOS; at least for now.

Change-Id: I915f8683a112548fc3defc1114f9dce3aa7be30e
Reviewed-on: https://gerrit.libreoffice.org/84067
Reviewed-by: Tor Lillqvist <tml@collabora.com>
Tested-by: Tor Lillqvist <tml@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/84204
Tested-by: Jenkins
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
2019-12-05 11:02:01 +01:00
Noel Grandin f656547d4d remove some useless comment lines
which merely announce that the next declaration is a class

Change-Id: Ifdb1398bcd99816b13e0b3769b46d0562bfbc1dc
Reviewed-on: https://gerrit.libreoffice.org/84229
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-12-03 12:46:27 +01: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
Michael Meeks d4381cdad5 preload: cleanup failed module load warnings and rename them.
Change-Id: Iafa89df6f724fa6b64712d970502091e38300dad
Reviewed-on: https://gerrit.libreoffice.org/83341
Tested-by: Jenkins
Reviewed-by: Aron Budea <aron.budea@collabora.com>
2019-11-21 02:48:02 +01:00
Luboš Luňák 7d7fea7f75 make bin/update_pch.s always include code in trivial #if's
E.g. #ifdef LIBO_INTERNAL_ONLY is always true for code that builds
with our PCHs.

Change-Id: I3cf311ea3621b909105754cfea2cb0116b8b67f5
Reviewed-on: https://gerrit.libreoffice.org/80961
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2019-10-18 11:00:04 +02:00