From e8b9bcf021c1733c0def6043e4032d4f07bb889b Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Mon, 4 Mar 2024 14:42:25 +0200 Subject: 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 _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 _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 --- codemaker/source/cppumaker/cpputype.cxx | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'codemaker') diff --git a/codemaker/source/cppumaker/cpputype.cxx b/codemaker/source/cppumaker/cpputype.cxx index 9ae5d689072e..b2ba3413402c 100644 --- a/codemaker/source/cppumaker/cpputype.cxx +++ b/codemaker/source/cppumaker/cpputype.cxx @@ -3328,7 +3328,11 @@ void EnumType::addComprehensiveGetCppuTypeIncludes( void EnumType::dumpDeclaration(FileStream& o) { o << "\n#if defined LIBO_INTERNAL_ONLY\n"; + o << "\n#if defined __GNUC__\n"; // gcc does not like visibility annotation on enum + o << "\nenum class " << id_ << "\n{\n"; + o << "\n#else\n"; o << "\nenum class SAL_DLLPUBLIC_RTTI " << id_ << "\n{\n"; + o << "\n#endif\n"; o << "\n#else\n"; o << "\nenum SAL_DLLPUBLIC_RTTI " << id_ << "\n{\n"; o << "\n#endif\n"; -- cgit