Commit Graph

226 Commits

Author SHA1 Message Date
Stephan Bergmann
99661d3f5f Deprecate getCppuType et al in favor of cppu::UnoType
...which doesn't suffer from the sal_uInt16 vs. sal_Unicode ambiguity.

Change-Id: I4de265145e720615652e88b6a68e03903ad8cba2
2015-04-01 08:43:56 +02:00
Noel Grandin
aa7a829e7d loplugin:staticfunction
Change-Id: Id796b799f8e2fcc3eae98d43800c5e31fec27fef
2015-03-27 10:51:08 +02:00
Stephan Bergmann
4d79146adf loplugin:deletedspecial
Change-Id: Ice7788ebcfbc638ec21a824c4267757218c14478
2015-02-07 12:35:56 +01:00
Stephan Bergmann
b4f6b26b5a SAL_DLLPUBLIC_RTTI for proper RTTI visibility for LLVM
The Itanium C++ ABI mandates that for a unique (complete) C++ type a single
unique symbol for the type's RTTI name is used across a process's dynamic
objects (so type equivalence can be determined via pointer comparison on the
RTTI names).

GCC nowadays deviates from that, using strcmp to determine equivalence, so it is
resilient to RTTI names being bound locally within dynamic objects (which has
performance benefits, but also makes it impossible to have unrelated types that
happen to have the same name "encapsulated" in individual dynamic objects---
whether or not that would violate the ODR would be open to interpretation of how
dynamic objects fit into the C++ Standard).

LLVM sticks to the Itanium ABI, which becomes notable in at least two places:

For one, libc++abi's __dynamic_cast uses strict checking.  It still has a
_LIBCXX_DYNAMIC_FALLBACK for now that additionally uses strcmp checking and
syslogs visibility violations.  Mac OS X uses libc++abi with
_LIBCXX_DYNAMIC_FALLBACK enabled, and running LO routinely logs dynamic_cast
errors to the Console there.

For another, RTTI-based UBSan checks unconditionally only use strict checking
(cf. isDerivedFromAtOffset in lib/ubsan/ubsan_type_hash.cc).  This causes false
positives from Clang -fsanitize=function and -fsanitize=vptr even on Linux not
using libc++abi.

Therefore, introduce SAL_DLLPUBLIC_RTTI to mark types for which RTTI needs to
have default visibility under the Itanium/LLVM semantics.  There is
unfortunately no way to mark only the (implicitly generated) RTTI symbols for
default visibility, but at least with the cases where SAL_DLLPUBLIC_RTTI is used
for now that is no real problem---any class type marked SAL_DLLPUBLIC_RTTI only
has inline (covered by -fvisibility-inlines-hidden) or undefined pure virtual
functions.  It appears that even the vtables of those classes remain hidden, at
least with Mach-O on Mac OS X.  (That also means there is no need for a
SAL_DLLPRIVATE_RTTI marker analoguous to the---also superfluous in retrospect---
CPPU_GCC_DLLPRIVATE one.)

Nevertheless, the number of exported symbols of course increases when
SAL_DLLPUBLIC_RTTI is "active."  For a full-blown --enable-dbgutil build on Mac
OS X,

  find instdir/LibreOffice.app/Contents -name \*.dylib\* -exec nm -gU {} \; \
    wc -l

increased from 125541 to 139239.  For Linux, an option might be to "activate"
SAL_DLLPUBLIC_RTTI only for __clang__ plus !ENABLE_RUNTIME_OPTIMIZATIONS.

The set of types marked SAL_DLLPUBLIC_RTTI with this patch (wholesale cppumaker-
generated UNO enum, struct, and interface types; plus some IEmbeddedHelper and
IUndoManager) is chosen so that a full "make check" on Mac OS X no longer
syslogs any dynamic_cast errors to the Console.

Change-Id: I42fa6ec01c2503ec24bcd9c0518abb112afa3235
2015-01-22 10:18:20 +01:00
Caolán McNamara
be94376c74 coverity#1019327 Unchecked dynamic_cast
Change-Id: Ibc5a1478d196681cbc124886924eebf065bbdb11
2014-12-27 23:00:44 +00:00
Caolán McNamara
6198aa8c14 coverity#1019325 Unchecked dynamic_cast
Change-Id: Ic1607eea119a7321f65b0a0145a263a03406ed6d
2014-12-27 23:00:43 +00:00
Stephan Bergmann
9d5e53b67c protected -> private
Change-Id: I807b31eaa0b0cd68e0ca018b6df4269c1aab5763
2014-12-08 10:34:37 +01:00
Michael Stahl
537befbb2f cppumaker: only include rtl/instance.hxx and mutex.hxx when necessary
Change-Id: Ib21a3cfe4b02e421f8848a6e2cca4e2a1c04adb9
2014-11-18 18:51:48 +01:00
Riccardo Magliocchetti
2c1bf30bda More iwyu suggested headers removal
Signed-off-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
Signed-off-by: Stephan Bergmann <sbergman@redhat.com>, undid one remove that was
detrimental to loplugin:unreffun

Change-Id: I18d8252084d828f94ef7a954e1dbfb45743d7970
2014-11-18 10:32:40 +01:00
Stephan Bergmann
fc0d57b7af Revert "use the new OUString::fromUtf8 method"
This reverts commit 05050cdb23,
not all places that use e.g. OStringToOUString to convert potential UTF-8
are guaranteed to fulfil the prerequisites necessary to use fromUtf8 (and
some places like e.g. in codemaker are happy with the best-effort effect
of OStringToOUString's OSTRING_TO_OUSTRING_CVTFLAGS).
2014-11-06 17:24:13 +01:00
Noel Grandin
05050cdb23 use the new OUString::fromUtf8 method
Change-Id: I771004b7ccab3344a67e827e45bc34c22ffa5f77
2014-11-06 13:51:10 +02:00
Caolán McNamara
b536f9ae62 coverity#441989 Uncaught exception
Change-Id: I579bfc6f4a57aea49e2b023917d0dbd7c3db6c88
2014-10-24 09:24:51 +01:00
Caolán McNamara
3d9d0b78a7 coverity#1242375 Don't call fscanf without specifiers
Change-Id: I58082770ca79da9c4d235b5ea0dc79c688c7498b
2014-10-07 14:29:55 +01:00
Caolán McNamara
09d79da135 coverity#1219788 Unchecked dynamic_cast
Change-Id: I1bedfb601320bc27adc0d0d72fcb8b3c5dfe73ff
2014-07-25 11:46:57 +01:00
Stephan Bergmann
e50ef195bc New loplugin:stringconcat
Change-Id: Id7c517fb37bc28797c45fc0dde83e866f2aa4aac
2014-07-01 15:45:52 +02:00
Noel Grandin
e2080e70fe new compilerplugin returnbyref
Find places where we are returning a pointer to something, where we can
be returning a reference.
e.g.
   class A {
     struct X x;
     public X* getX() { return &x; }
   }
which can be:
     public X& getX() { return x; }

Change-Id: I796fd23fd36a18aedf6e36bc28f8fab4f518c6c7
2014-06-24 11:34:21 +02:00
Noel Grandin
0e507ae031 various: remove SAL_THROW macro
Change-Id: I9464179a736b91f5bc32eb5e5e89b3b4e3da3494
2014-06-05 08:17:52 +02:00
Caolán McNamara
c6c135930c coverity#1019311 Unchecked return value
Change-Id: I682ca0b62e6eb0d02113218de97d1440089b782c
2014-05-26 15:51:56 +01:00
Caolán McNamara
e947342b9c coverity#1019326 Unchecked dynamic_cast
Change-Id: Ib3f0776048ca3dbb8a7efa4d9240f4ee9d6ac9dd
2014-05-26 15:51:56 +01:00
Caolán McNamara
9c82cb60de coverity#1019329 Unchecked dynamic_cast
Change-Id: Ic340559c9ab9b74f4f932c90e08f2530c08e8d08
2014-05-26 15:51:55 +01:00
Caolán McNamara
353188ecc4 coverity#1019330 Unchecked dynamic_cast
Change-Id: I9c7893f7c9af2b42dcc50f2d1463ec497bb85e30
2014-05-26 15:51:55 +01:00
Noel Grandin
7d4924a402 improve parameter flow in cpputype.cxx
after commit
  c5d47c327a
  "add default value for Context param in uno::Exception constructors"

Change-Id: Ib429b58c559ecd48764a8df2f49d5470057c2c63
2014-05-23 16:44:25 +02:00
Noel Grandin
c5d47c327a add default value for Context param in uno::Exception constructors
and all it's subtypes, which is almost never used, so this allows us to
simplify lots of call sites.

Change-Id: I0b05793ea2bdd1027679f63252d42ce4af89433b
2014-05-23 15:05:59 +02:00
Noel Grandin
8d54796bf1 enhance pass-by-ref plugin to detect large arguments
Detect arguments larger than 64 chars passed by value.

Change-Id: I9b0ea9ccb99d115984a26eab67c9cf6afd5f6cae
Signed-off-by: Stephan Bergmann <sbergman@redhat.com>
2014-05-20 11:17:22 +02:00
Caolán McNamara
934a7925de coverity#1213117 Unchecked dynamic_cast
Change-Id: I6f55030ea7bebce99537c7cdd5156c83c38a765a
2014-05-11 21:06:01 +01:00
Jan Holesovsky
2188a7ac2e Reduce the amount of strings in the release builds.
I guess even in the debug builds these strings do not add much info, but...

Change-Id: I5cf765539a821513b5ce77c5484071d181459881
2014-04-14 15:46:22 +02:00
Noel Grandin
20f14ed4a1 codemaker: sal_Bool->bool
Change-Id: I0a0691df58455b712eb27695f4cce15fd3494b65
2014-04-04 13:44:18 +02:00
Stephan Bergmann
362d4f0cd4 Explicitly mark overriding destructors as "virtual"
It appears that the C++ standard allows overriding destructors to be marked
"override," but at least some MSVC versions complain about it, so at least make
sure such destructors are explicitly marked "virtual."

Change-Id: I0e1cafa7584fd16ebdce61f569eae2373a71b0a1
2014-04-01 19:22:54 +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
07d3807e99 codemaker: sal_Bool -> bool
Change-Id: I2cacac2aa7e48b3b9d8d060137d5c6d6f1d06b3f
2014-02-17 17:55:17 +01:00
Stephan Bergmann
9e77c2fb7c Remove UNOIDL "array" and "union" vaporware remnants
...and deprecate what cannot be removed for compatibility.

Change-Id: I1ea335af775b867b468b8285113631167729a92a
2014-01-31 10:15:47 +01:00
Matúš Kukan
fb92c8d6a4 copy&paste typo
Change-Id: I528a6a747e88fe2a4b4abfd9372daddf4e8aa502
2014-01-28 19:47:27 +01:00
Matúš Kukan
3774a6fd94 Support direct ctor calls for singletons too.
Change-Id: I6db797c950b8222b3ad95faff86adf5e7b41ff4b
2014-01-28 18:52:21 +01:00
Caolán McNamara
f5bcc7d91c coverity#440030 Logically dead code
Change-Id: I77428c6cf1f79dcc0e2c5e1d52f9b4b8c88130e3
2014-01-28 11:29:15 +00:00
Jan Holesovsky
68ba6ddef5 codemaker: Allow compiler to share these generated strings.
There is really no need to see tons of

component context fails to supply service <something long> of type <something else long>:

and

component context fails to supply service <something long> of type <something else long>

in the binary ;-) - let's split the strings to parts that the linker can
share easily.

Change-Id: I07f149a587c05985045028c3b6530c6efd081ff5
2014-01-27 11:41:15 +01:00
Matúš Kukan
22832569e1 Do not acquire again in direct constructor function calls.
Missing in c2c530da69 "Introduce static
inline cppu::acquire(), and make use of that."

Change-Id: I4a856eeaff1fce3f429c62c1897fe3898371d1ec
2014-01-23 11:41:29 +01:00
Jan Holesovsky
306efefe22 Minimize the constructor functions to a bare minimum.
Most of the constructors are supposed to be only a call of

  new TheInstance(arguments)

or an equivalent; so let's just change the constructor caller accordingly, to
accept unacquired new instance.

If there are exceptions that need to do more heavy lifting, they do not have
to use the constructor feature, or there can be a wrapper for the real
implementation, doing the additional work in their (C++) constructor.

Change-Id: I035c378778aeda60d15af4e56ca3761c586d5ded
2014-01-20 17:37:40 +01:00
Matúš Kukan
2dc9f1791a Fix declaration for ctor functions in generated headers.
Change-Id: I329ff80da68c629d7a82921253c4412563743b34
2014-01-20 09:27:20 +01:00
Matúš Kukan
a0ada918c1 Initialize also implementations created directly by generated function.
This was forgotten in commit bdeb57c239.

Change-Id: Idd339222e3c464abc2524f78f16c8fe0a02dcd5b
2014-01-18 17:02:35 +01:00
Stephan Bergmann
e500b25b08 ...and support direct calls of non-default ctors, too
Change-Id: I507a5664e642c75f6e9e9fe0c95c97ea76a8e5b3
2013-12-19 16:54:36 +01:00
Stephan Bergmann
15abebbde5 WIP: Direct service ctor calls at least on Android/iOS
Change-Id: I8a1907bc4b8f2134efb15d38a0fb5176b4384317
2013-12-19 14:42:10 +01:00
Caolán McNamara
944a086d92 if there is one typo, its guaranteed to duplicated somewhere
Change-Id: Ia81069afa47fa5790b973247c68bead7de87d718
2013-12-17 10:26:21 +00:00
Stephan Bergmann
0bc89aac4c cppumaker: Allow UNO interface functions to throw std::exception
...so that exceptions like std::bad_alloc need not be treated in C++
implementations of UNO interfaces to not cause std::unexpected.  Of course, this
requires implementations to be adapted and actually mention std::exception in
their exception specifications.

Change-Id: Ie7f91e7ca47d8a81e3d0ba817e65d83c7823af75
2013-10-20 16:10:53 +02:00
Noel Grandin
44b96b1d76 fdo#70285 cleanup generated C++ code
Change-Id: Ic43628de53c5139ef43bb48723fb1e0788af1cd1
Signed-off-by: Stephan Bergmann <sbergman@redhat.com>
2013-10-20 16:10:53 +02:00
Stephan Bergmann
254f59f623 rhbz#1014010: Missing dependencies in isBootstrapType list
...the list has been fixed now by copying its elements into an ENTRIES file and
running "unoidl-write udkapi/ @ENTITIES TEMP && unoidl-read TEMP >/dev/null" and
adding any reported unknown entities until it succeeds.

However, the updated list lead to deadlock when css.reflection.ParamInfo UnoType
resolves css.reflection.XIdlClass UnoType resolves css.reflection.XIdlMethod
UnoType resolves css.reflection.ParamInfo UnoType, so broke the circle by no
longer resolving the interface methods' return and parameter types in
InterfaceType::dumpMethodsCppuDecl (which is why those type infos are only
generated on demand anyway; looks like this had been a careless thinko in the
generation of comprehensive type info that had remained unnoticed all the time).

Change-Id: I50ef2fde16242298e055c6fa5971e70fad1a2b68
2013-10-01 14:44:44 +02:00
Stephan Bergmann
a80fb45fe4 Revert "WIP: add cppumaker -U to directly read from .idl files"
This reverts commit c4113906d7, which is not
necessary after all with recent "Hook SourceProvider into unoidl::loadProvider."
2013-09-16 13:29:49 +02:00
Stephan Bergmann
c4113906d7 WIP: add cppumaker -U to directly read from .idl files
Change-Id: I420847515b6b691ae81a249a8820cf9a3d132372
2013-09-12 17:45:12 +02:00
Stephan Bergmann
54dd4ae0dd Add cppumaker -nD "no dependent types are generated"
...just like javamaker.

Change-Id: I7634a65a948ca7abdb7ad75d0aeca8becb38ab87
2013-09-12 15:28:11 +02:00
Stephan Bergmann
2618ff4734 UNO interface UIKs are unused for a very long time
...so mark them as @deprecated more thoroughly and always force them to zero.

Change-Id: I5db2dab924fc5a4145a0e5dd055b654985ce2ef9
2013-09-04 14:37:54 +02:00
Mark Wielaard
e39e9e4cd8 Source files shouldn't have executable bit set.
Change-Id: Iafad6249a7998d7c749c1ca2979a606078cfcb5e
Reviewed-on: https://gerrit.libreoffice.org/4070
Reviewed-by: Fridrich Strba <fridrich@documentfoundation.org>
Tested-by: Fridrich Strba <fridrich@documentfoundation.org>
2013-05-28 12:09:27 +00:00