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/svx/sdgmoitm.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/svx/sdgmoitm.hxx')
-rw-r--r-- | include/svx/sdgmoitm.hxx | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/include/svx/sdgmoitm.hxx b/include/svx/sdgmoitm.hxx index 9b0eeb431464..7e508e16cabd 100644 --- a/include/svx/sdgmoitm.hxx +++ b/include/svx/sdgmoitm.hxx @@ -26,7 +26,7 @@ #include <svx/svxdllapi.h> // MSVC hack: -class SdrGrafModeItem_Base: public SfxEnumItem<GraphicDrawMode> { +class SAL_DLLPUBLIC_RTTI SdrGrafModeItem_Base: public SfxEnumItem<GraphicDrawMode> { protected: SdrGrafModeItem_Base(GraphicDrawMode eMode): SfxEnumItem(SDRATTR_GRAFMODE, eMode) {} |