summaryrefslogtreecommitdiffstats
path: root/include/sot
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/sot
parentnew loplugin:redundantpointerops (diff)
downloadcore-595371e520ce4f64ad9d99a7866bdb8404271b6e.tar.gz
core-595371e520ce4f64ad9d99a7866bdb8404271b6e.zip
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/sot')
-rw-r--r--include/sot/stg.hxx2
1 files changed, 1 insertions, 1 deletions
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;