summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2024-03-04 14:42:25 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2024-03-05 14:39:06 +0100
commite8b9bcf021c1733c0def6043e4032d4f07bb889b (patch)
tree7442f98179ef1b6547a62c3c9b71380b564a4d05 /include
parentf03cb8214a2b1b3de8d93c1a19319ecc82e4b21d (diff)
map SAL_DLLPUBLIC_RTTI to visibility:default for gcc
Because I want to make more symbols private, but that runs into a problem with the special symbol "typeinfo for Foo" which is required for dynamic_cast. For clang, we can use SAL_DLLPUBLIC_RTTI to make just that magic "typeinfo for Foo" symbol visible. But for gcc, we are left with no option but to make the whole class visible via <MODULE>_DLLPUBLIC. (I have a feature request logged against gcc to support something like that at https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113958) But I also don't want to use <MODULE>_DLLPUBLIC, since that blocks progress of reducing symbol visibility for platforms other than gcc. So map SAL_DLLPUBLIC_RTTI to visiblity:default for gcc, which means that only gcc suffers the negative affects of not having that annotation. However, that runs into the problem that gcc does not like visibility:default in a couple of places, so I have to introduce some extra preprocessor stuff. Change-Id: Ib4fc5c1d2a1f8cf87d5159a4b5684137ec061605 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164356 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'include')
-rw-r--r--include/rtl/alloc.h3
-rw-r--r--include/rtl/ustring.h3
-rw-r--r--include/sal/types.h8
-rw-r--r--include/xmloff/xmlimppr.hxx4
4 files changed, 14 insertions, 4 deletions
diff --git a/include/rtl/alloc.h b/include/rtl/alloc.h
index 4ce01cf1bcb4..1dc9cefacb0d 100644
--- a/include/rtl/alloc.h
+++ b/include/rtl/alloc.h
@@ -153,7 +153,8 @@ SAL_DLLPUBLIC void SAL_CALL rtl_freeAlignedMemory (
/** Opaque rtl_arena_type.
*/
-typedef struct SAL_DLLPUBLIC_RTTI rtl_arena_st rtl_arena_type;
+struct SAL_DLLPUBLIC_RTTI rtl_arena_st;
+typedef struct rtl_arena_st rtl_arena_type;
#define RTL_ARENA_NAME_LENGTH 31
diff --git a/include/rtl/ustring.h b/include/rtl/ustring.h
index 303aff446023..ddc87e29205d 100644
--- a/include/rtl/ustring.h
+++ b/include/rtl/ustring.h
@@ -1197,7 +1197,8 @@ SAL_DLLPUBLIC double SAL_CALL rtl_ustr_toDouble(
/** @cond INTERNAL */
/** The implementation of a Unicode string.
*/
-typedef struct SAL_DLLPUBLIC_RTTI _rtl_uString
+struct SAL_DLLPUBLIC_RTTI _rtl_uString;
+typedef struct _rtl_uString
{
oslInterlockedCount refCount; /* opaque */
sal_Int32 length;
diff --git a/include/sal/types.h b/include/sal/types.h
index c61956f647d7..a2ef256239e1 100644
--- a/include/sal/types.h
+++ b/include/sal/types.h
@@ -220,7 +220,7 @@ typedef void * sal_Handle;
# define SAL_DLLPUBLIC_IMPORT __attribute__ ((visibility("hidden")))
# define SAL_DLLPRIVATE __attribute__ ((visibility("hidden")))
# define SAL_DLLPUBLIC_TEMPLATE __attribute__ ((visibility("hidden")))
-# define SAL_DLLPUBLIC_RTTI
+# define SAL_DLLPUBLIC_RTTI __attribute__ ((visibility("default")))
# else
# define SAL_DLLPUBLIC_EXPORT __attribute__ ((visibility("default")))
# define SAL_JNI_EXPORT __attribute__ ((visibility("default")))
@@ -234,7 +234,11 @@ typedef void * sal_Handle;
# define SAL_DLLPUBLIC_RTTI __attribute__ ((visibility("default")))
# endif
# else
-# define SAL_DLLPUBLIC_RTTI
+// GCC does not have currently have equivalent functionality to clang's type_visibility
+// but I have a feature request for that at https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113958
+// Until that is implemented, just make the whole class visible, which is what I would need to
+// do anyhow if something wants to import the typeinfo symbol.
+# define SAL_DLLPUBLIC_RTTI __attribute__ ((visibility("default")))
# endif
# endif
# else
diff --git a/include/xmloff/xmlimppr.hxx b/include/xmloff/xmlimppr.hxx
index adfba4eadc60..1f537a322eea 100644
--- a/include/xmloff/xmlimppr.hxx
+++ b/include/xmloff/xmlimppr.hxx
@@ -39,7 +39,11 @@ namespace com::sun::star::uno { template <typename > class Reference; }
namespace com::sun::star::uno { template <typename > class Sequence; }
namespace com::sun::star::xml::sax { class XAttributeList; }
namespace com::sun::star::xml::sax { class XFastAttributeList; }
+#if defined __GNUC__ // gcc does not like visibility annotation on enum
+namespace com::sun::star::drawing { enum class FillStyle; }
+#else
namespace com::sun::star::drawing { enum class SAL_DLLPUBLIC_RTTI FillStyle; }
+#endif
struct XMLPropertyState;
class XMLPropertySetMapper;