diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2017-09-01 20:14:25 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2017-09-04 09:08:16 +0200 |
commit | 595371e520ce4f64ad9d99a7866bdb8404271b6e (patch) | |
tree | 8997c953f9ee83de8afd3d3625164a6c66cd9b1f /include/svl/aeitem.hxx | |
parent | 326295bf10985a19ac913f988980c8761c301967 (diff) |
New loplugin:dyncastvisibility
...to find uses of dynamic_cast where the static (base) type has hidden
visibility while the dynamic (derived) one has default visibility, and which may
thus fail at least on macOS like happened in
d5ed3cd6dbd22bb18542778f1c48f4d5b3ae0f95 "Make WinMtfFontStyle's base class
EMFIO_DLLPUBLIC, too".
libcxxabi's __dynamic_cast takes static_type and dst_type arguments. Now, if
dst_type (the derived type, with default visibility) is taken from .so A (and
thus references the version of the base type info hidden in .so A) but the
__dynamic_cast call is made from .so B, it passes for static_type the base type
information hidden in .so B, and __dynamic_cast will consider the cast to fail.
I'm not sure whether hidden intermediary types (in the hierarchy between the
dynamic_cast's base and derived types) acutally cause a problem too, but lets
flag them with the plugin anyway.
The fixes use SAL_DLLPUBLIC_RTTI. For one, there appear to be no other reasons
than type visibility to make those classes SAL_DLLPUBLIC. For another, this
nicely avoids any actual changes on Windows (where SAL_DLLPUBLIC expands to
nothing, and many of the affected classes were explicityl introduced into class
hierarchies as "MSVC hacks").
Change-Id: Ia85a9635cebffb1009a9efc1484b8bd4025585d4
Reviewed-on: https://gerrit.libreoffice.org/41802
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'include/svl/aeitem.hxx')
-rw-r--r-- | include/svl/aeitem.hxx | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/include/svl/aeitem.hxx b/include/svl/aeitem.hxx index 9f99ea85a934..73cb3b345a86 100644 --- a/include/svl/aeitem.hxx +++ b/include/svl/aeitem.hxx @@ -30,7 +30,7 @@ class SfxAllEnumValueArr; // MSVC hack: -class SfxAllEnumItem_Base: public SfxEnumItem<sal_uInt16> { +class SAL_DLLPUBLIC_RTTI SfxAllEnumItem_Base: public SfxEnumItem<sal_uInt16> { protected: explicit SfxAllEnumItem_Base(sal_uInt16 nWhich, sal_uInt16 nValue): SfxEnumItem(nWhich, nValue) |