summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2017-09-01 20:14:25 +0200
committerStephan Bergmann <sbergman@redhat.com>2017-09-04 09:08:16 +0200
commit595371e520ce4f64ad9d99a7866bdb8404271b6e (patch)
tree8997c953f9ee83de8afd3d3625164a6c66cd9b1f /include
parent326295bf10985a19ac913f988980c8761c301967 (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')
-rw-r--r--include/editeng/langitem.hxx2
-rw-r--r--include/sot/stg.hxx2
-rw-r--r--include/svl/aeitem.hxx2
-rw-r--r--include/svl/eitem.hxx2
-rw-r--r--include/svx/dlgctrl.hxx2
-rw-r--r--include/svx/sdgmoitm.hxx2
-rw-r--r--include/vbahelper/vbacollectionimpl.hxx4
7 files changed, 8 insertions, 8 deletions
diff --git a/include/editeng/langitem.hxx b/include/editeng/langitem.hxx
index d901d510f92d..e90b6cbee1f2 100644
--- a/include/editeng/langitem.hxx
+++ b/include/editeng/langitem.hxx
@@ -33,7 +33,7 @@ class SvXMLUnitConverter;
*/
// MSVC hack:
-class SvxLanguageItem_Base: public SfxEnumItem<LanguageType> {
+class SAL_DLLPUBLIC_RTTI SvxLanguageItem_Base: public SfxEnumItem<LanguageType> {
protected:
explicit SvxLanguageItem_Base(sal_uInt16 nWhich, LanguageType nValue):
SfxEnumItem(nWhich, nValue)
diff --git a/include/sot/stg.hxx b/include/sot/stg.hxx
index e565c3e7b266..f0d8ee70ff1b 100644
--- a/include/sot/stg.hxx
+++ b/include/sot/stg.hxx
@@ -81,7 +81,7 @@ public:
enum class SotClipboardFormatId : sal_uLong;
-class BaseStorage : public StorageBase
+class SAL_DLLPUBLIC_RTTI BaseStorage : public StorageBase
{
public:
virtual const OUString& GetName() const = 0;
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)
diff --git a/include/svl/eitem.hxx b/include/svl/eitem.hxx
index e8933f0bcdaf..cbfc1a4930a0 100644
--- a/include/svl/eitem.hxx
+++ b/include/svl/eitem.hxx
@@ -26,7 +26,7 @@
template<typename EnumT>
-class SfxEnumItem : public SfxEnumItemInterface
+class SAL_DLLPUBLIC_RTTI SfxEnumItem : public SfxEnumItemInterface
{
EnumT m_nValue;
diff --git a/include/svx/dlgctrl.hxx b/include/svx/dlgctrl.hxx
index 4fbbacde7361..612548934266 100644
--- a/include/svx/dlgctrl.hxx
+++ b/include/svx/dlgctrl.hxx
@@ -294,7 +294,7 @@ class SdrObject;
class SdrPathObj;
class SdrModel;
-class SAL_WARN_UNUSED SvxPreviewBase : public Control
+class SAL_WARN_UNUSED SAL_DLLPUBLIC_RTTI SvxPreviewBase : public Control
{
private:
SdrModel* mpModel;
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) {}
diff --git a/include/vbahelper/vbacollectionimpl.hxx b/include/vbahelper/vbacollectionimpl.hxx
index db65f542dcb2..94afa6daee1a 100644
--- a/include/vbahelper/vbacollectionimpl.hxx
+++ b/include/vbahelper/vbacollectionimpl.hxx
@@ -233,7 +233,7 @@ public:
// including a HelperInterface implementation
template< typename... Ifc >
-class ScVbaCollectionBase : public InheritedHelperInterfaceImpl< Ifc... >
+class SAL_DLLPUBLIC_RTTI ScVbaCollectionBase : public InheritedHelperInterfaceImpl< Ifc... >
{
typedef InheritedHelperInterfaceImpl< Ifc... > BaseColBase;
protected:
@@ -341,7 +341,7 @@ public:
};
template < typename... Ifc > // where Ifc must implement XCollectionTest
-class CollTestImplHelper : public ScVbaCollectionBase< ::cppu::WeakImplHelper< Ifc... > >
+class SAL_DLLPUBLIC_RTTI CollTestImplHelper : public ScVbaCollectionBase< ::cppu::WeakImplHelper< Ifc... > >
{
typedef ScVbaCollectionBase< ::cppu::WeakImplHelper< Ifc... > > ImplBase;