diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2024-03-04 14:42:25 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2024-03-05 14:39:06 +0100 |
commit | e8b9bcf021c1733c0def6043e4032d4f07bb889b (patch) | |
tree | 7442f98179ef1b6547a62c3c9b71380b564a4d05 /codemaker | |
parent | tdf#99969: chart2_uichart: Add unittest (diff) | |
download | core-e8b9bcf021c1733c0def6043e4032d4f07bb889b.tar.gz core-e8b9bcf021c1733c0def6043e4032d4f07bb889b.zip |
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 'codemaker')
-rw-r--r-- | codemaker/source/cppumaker/cpputype.cxx | 4 |
1 files changed, 4 insertions, 0 deletions
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"; |