summaryrefslogtreecommitdiff
path: root/vcl/unx/generic/fontmanager/fontconfig.cxx
AgeCommit message (Collapse)AuthorFilesLines
2024-03-31tdf#146619 Drop unused 'using namespace' in: vcl/Gabor Kelemen1-1/+0
Change-Id: Id25d5e3dbf84dea1f9aca5a6ec921d30cbe84bf7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165524 Tested-by: Jenkins Reviewed-by: Gabor Kelemen <gabor.kelemen.extern@allotropia.de>
2024-02-15workaround for OpenDyslexic font disrupting glyph fallback during testsCaolán McNamara1-4/+23
Change-Id: Iee6bc4e9dc5ed39d8e9b2897e3c31ef4cb62f550 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163373 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2024-01-05report what font is missing when terminating testCaolán McNamara1-0/+2
even in release mode Change-Id: I3e9673cc498202c64ba00f5cd2cd0e7429d77834 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161659 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2023-12-30move IsFuzzing to comphelperCaolán McNamara1-1/+1
and try something a bit more generic Change-Id: I1d8256576cd02f0a589df350ba7b53059dd586a5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161250 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2023-11-02tdf#157939 drop duplicates from the FontConfig SetCaolán McNamara1-1/+31
when we drop them from our own font list, that way we don't get suggestions for glyph fallback which we can't satisfy Also prefer our application fonts to system fonts when they share the same version number where they should be the same, but more than once we have a system-side font with oddities. Change-Id: I90bd3311e0f37bacd60d20e1c1a6769b551b8b76 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158841 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2023-09-24Drop some newly obsolete __GNUC__ version checksStephan Bergmann1-7/+0
...after 6ef2d358ac053ce0f6de9cf0f8f25e8bae66d441 "Adapt Clang and GCC minimum version checks" Change-Id: I5f3bcda2ce8e0e093af3bdd9d2cca741a5b95306 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157202 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-09-10using decls should come after #includeNoel Grandin1-2/+1
Change-Id: I058551e87bca42adede860f6f299b0f7ae2af3b5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156798 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-08-24tdf#140881: Ignore WOFF/WOFF2 fonts with FontConfigKhaled Hosny1-0/+10
FC_FONT_WRAPPER requires unreleased FontConfig, but lets have this in so it works when FontConfig have it. Change-Id: I8f48ac1f68a3af6e1853e9eb1925d382b57136c0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156049 Tested-by: Jenkins Reviewed-by: خالد حسني <khaled@libreoffice.org>
2023-08-03tdf#114192: Speed up populating font list when FontConfig is usedKhaled Hosny1-100/+43
Instead of calling psp::PrintFontManager::analyzeFontFile() get the font names and metadata, use the values taken from FontConfig which nowadays provides everything we need. This speeds up startup time significantly, especially when there is a large number of fonts installed. This also uses the correct style name, we were mixing name id 1 (family) with name id 17 (typographic subfamily) while we should have been using name id 2 (subfamily). The name ids 1, 2 and 16, 17 should be used together not mixed and matched, and we need the former because it is compatible with the R/I/B/BI model we (and the other office suite) use. So instead of "Foo Black, Black", we now get "Foo Black, Regular". On a system with 6616 fonts installed. Before: $ export OOO_EXIT_POST_STARTUP=1 $ time ./instdir/program/soffice.bin --headless real 0m4.744s user 0m1.672s sys 0m2.547s after: $ export OOO_EXIT_POST_STARTUP=1 $ time ./instdir/program/soffice.bin --headless real 0m1.377s user 0m0.563s sys 0m0.297s Change-Id: Ib7e358f16530c2daabc7ef677ef6a148fdf08e6e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155313 Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com> Tested-by: Jenkins Reviewed-by: خالد حسني <khaled@libreoffice.org>
2023-08-03Raise minimum FontConfig version to 2.12.0Khaled Hosny1-9/+4
I want to use FC_SYMBOL and this the first stable version to have it, and our baseline has 2.13.x already. Change-Id: I606b99190020085cdf20a52788a021543c365fca Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155312 Tested-by: Jenkins Reviewed-by: خالد حسني <khaled@libreoffice.org>
2023-08-02vcl: Drop the PrintFont -> FastPrintFontInfo -> FontAttributes indirectionKhaled Hosny1-16/+24
We want FontAttributes at the end, so lets have them up front instead of the intermediary structures. Change-Id: Iafdf17f4a7615f0c3d972e6080cebea0183840b7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155191 Tested-by: Jenkins Reviewed-by: خالد حسني <khaled@libreoffice.org>
2023-07-03Rename ImplFontMetricData -> FontMetricDataKhaled Hosny1-1/+1
Change-Id: I0f8753a5ef1865f4ea0431125e74d0f52aa1c396 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153868 Tested-by: Jenkins Reviewed-by: خالد حسني <khaled@libreoffice.org>
2023-06-21Require icu-i18n >= 66Khaled Hosny1-4/+0
We were requiring ICU 4.6 which was released in 2011, and ifdef'ing our way through newer ICU versions. ICU is a core dependency and it makes no sense to build LibreOffice with such ancient versions of it. This change requires ICU 66 (released in 2020), and removes all the ifdefs for older versions. There are more cleanups to do, but these will be done separately. Change-Id: I2e4f7608a08f4d531b0a4c74bbfdf91a451f833f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153387 Tested-by: Jenkins Reviewed-by: خالد حسني <khaled@libreoffice.org>
2023-06-13When adding application fonts, add them also to FontConfigKhaled Hosny1-2/+18
This way FontConfig can use them for missing chars font fallback. Change-Id: I63be8a62db9bdacc83be2327555c558d4cd476bf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152954 Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com> Tested-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2023-03-18loplugin:stringadd use more O[U]StringCharNoel Grandin1-1/+1
Change-Id: I196e4539ad430a39415eff9d7170b33df7228230 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149062 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-12-06Resolves: tdf#151722 use UI Language for localized font namesCaolán McNamara1-6/+3
instead of system locale Change-Id: Ie1f33644fcb8529b237db372b7d8daea19af8ede Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143706 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-09-27sufficient at this point to silently allow MissingJustBulletCaolán McNamara1-5/+1
to not assert that there are unexpected glyph substitutions Change-Id: Ie4231c84fc1a509f86eac4242270c9e496bf7e35 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140649 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-09-27tdf#144348: Remove EmojiOne Color fontKhaled Hosny1-1/+1
The EmojiFont setting is now a comma-separated list of the three common color emoji fonts, it should fallback to the next font if the first is missing. Change-Id: I7aa134f914ab829704e9b707f511f166a81a0089 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140623 Tested-by: Jenkins Reviewed-by: خالد حسني <khaled@aliftype.com>
2022-09-02Fix setting SAL_NON_APPLICATION_FONT_USEStephan Bergmann1-2/+1
...after a342b72f4218cd617aa6fb413fcf5fbb182c316f "gbuild: set SAL_NON_APPLICATION_FONT_USE in gb_CppunitTest_use_more_fonts" had caused e.g. CppunitTest_vcl_pdfexport to be executed with merely SAL_NON_APPLICATION_FONT_USE=deny rather than the stronger SAL_NON_APPLICATION_FONT_USE=abort that vcl/CppunitTest_vcl_pdfexport.mk asked for. So introduce a dedicated gb_CppunitTest_set_non_application_font_use that accumulates the requested modes and then selects the strongest requested one ("allow" over "abort" over "deny"). That also means we can go back to model "allow" with an unset SAL_NON_APPLICATION_FONT_USE env var. Change-Id: I32ba0a94c1965f0e3336e676b17f4f5efb85efce Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139251 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-09-01we have one CJK text test that explicitly attempts to use not bundled fontsCaolán McNamara1-1/+4
add "allow" to NON_APPLICATION_FONT_USE= =abort to crash and burn if there is font/glyph fallback, and =deny to just restrict to the bundled fonts for the test =allow to explictly denote a tests want to attempt to search for and use some specific system-side installed font. note: currently this only affects fontconfig using platforms Change-Id: Iadc8a70531ac363b4c3f0c52d9f7bd79191b0139 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139148 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-09-01change ABORT_ON_NON_APPLICATION_FONT_USE to NON_APPLICATION_FONT_USE=...Caolán McNamara1-2/+5
with =abort to crash and burn if there is font/glyph fallback, and lesser =deny to just restrict to the bundled fonts for the test. Change-Id: I0a8f7046260c24f3bf24ec3a91489924486fb844 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139132 Reviewed-by: Stephan Bergmann <sbergman@redhat.com> Tested-by: Stephan Bergmann <sbergman@redhat.com>
2022-08-22add Noto Sans Arabic to fonts known not to have bulletCaolán McNamara1-1/+2
when measured by ImplFontMetricData::ImplInitTextLineSize Change-Id: I328436b3728927b58adc75f51061ebfa1d00b01d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138680 Tested-by: Caolán McNamara <caolanm@redhat.com> Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-08-18Move tools/diagnose_ex.h to comphelper/diagnose_ex.hxxStephan Bergmann1-1/+1
...so that its TOOLS_WARN_EXCEPTION can be used in comphelper/source/misc/logging.cxx in a follow-up commit. (And while at it, rename from diangose_ex.h to the more appropriate diagnose_ex.hxx. The comphelper module is sufficiently low-level for this immediate use case, so use that at least for now; o3tl might be even more suitable but doesn't have a Library until now. Also, for the immediate use case it would have sufficed to only break DbgGetCaughtException, exceptionToString, TOOLS_WARN_EXCEPTION, TOOLS_WARN_EXCEPTION_IF, and TOOLS_INFO_EXCEPTION out of include/tools/diagnose_ex.h into an additional new include/comphelper/diagnose_ex.hxx, but its probably easier overall to just move the complete include file as is.) Change-Id: I9f3222d4ccf1a9ac29d7eb9ba1530d53e2affaee Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138451 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-08-11don't worry about Linux Libertine O vs Linux Libertine GCaolán McNamara1-0/+2
Change-Id: I3f7418380e655b6c25e675493d859444e343d646 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138149 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-08-04Fix typos, __clang_ -> __clang__Stephan Bergmann1-1/+1
Change-Id: I89b8a2cb778f91610b6a8e8efc0c4e6ed96a7644 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137778 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-06-03elide some makeStringAndClear() classNoel Grandin1-1/+1
when we are passing the result to a string_view, it is pointless. Change-Id: Id5906bbd7315e80358d09a0d036e605c54ccbf93 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135328 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-05-01abort more writer layout tests if a font isn't foundCaolán McNamara1-2/+2
Change-Id: I4d94b60531505f2d5a493b4c51f4c9110d3a4517 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133633 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-05-01abort writer layout tests if a font isn't foundCaolán McNamara1-1/+28
if (the default) of --with-fonts is enabled then additionally restrict fontconfig to those "application" fonts so the linux ci can be used to safeguard that font and glyph fallback isn't in operation during the layout tests Change-Id: Ic7fc705827c8177b8367cf41f55cdd8ae002c1f5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133523 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-03-07Drop useless parameterTor Lillqvist1-3/+1
The parameter to PrintFontManager::countFontconfigFonts() was only written to since babf6d5e53516e80e8e3f2485796ebfaeb20e9c1. Change-Id: Ie206fdbd620f1cfc6402c1d02709c3b653140c85 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131097 Tested-by: Jenkins Reviewed-by: Tor Lillqvist <tml@collabora.com>
2021-09-27vcl: move FontSelectPattern to own file and into vcl::font namespaceChris Sherlock1-2/+2
Change-Id: I2f01a8e67c52ece9b434777203aa9fbc9ac8be02 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122613 Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Tested-by: Jenkins
2021-09-21vcl: add sal/config.h in preparation for patchChris Sherlock1-0/+2
The convention is that we need to add sal/config.h to the start of files. This patch is created in preparation of a patch I have queued to test and move PhysicalFontFace to vcl::font namespace. Change-Id: I15dd24d7f01e077d407ac192a0413d796517eb72 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122228 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-09-15loplugin:constvarsNoel Grandin1-1/+1
Change-Id: I9b35d6333afa6b305bf73fc55a7e60c8365674e9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122134 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-06-28No need to Stop() a Timer before Start()Jan-Marek Glogowski1-3/+0
Start() resets a timer per default, otherwise check IsActive(). Also add a debug name to it. Change-Id: I1588161bb3fead42c3b26282dfa05d149aa94c52 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118020 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
2021-06-18Workaround only for GCC 10Stephan Bergmann1-2/+3
Change-Id: I7425dfd674149b33e069bf20c1ff6a4ca622db20 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117453 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Stephan Bergmann <sbergman@redhat.com> Tested-by: Jenkins
2021-06-18avoid maybe-uninitialised in FontConfigNoel Grandin1-0/+6
triggers inside the std::optional<PrintFont> with gcc 10.2.0 Change-Id: Id34e46ddfff447cb48b886003f04203979c30732 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117399 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-05-27no need to allocate PrintFont separatelyNoel Grandin1-6/+6
Change-Id: I8bc213e096ad6ae83d88c548ff8685a872c5ea91 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116258 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-05-11change usage of boost::hash_combine to o3tl::hash_combineTomaž Vajngerl1-6/+6
Change-Id: I840518a36ac43d36c95f38e09c7bfcfe1a25a525 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114984 Tested-by: Tomaž Vajngerl <quikee@gmail.com> Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2021-04-25loplugin:unusedfieldsNoel Grandin1-13/+0
Change-Id: I52af3509afde02dae494747527ab800590682fa3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114591 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-04-21loplugin:stringadd replace OUStringLiteral temporaries with OUString::ConcatNoel Grandin1-1/+1
Change-Id: I656f06a74d9f0180ae460264563d6a935c7d2c60 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114377 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-04-14add pitch to the patternCaolán McNamara1-4/+7
Change-Id: Ic32527feabb0405f17bd59779cf19553afaa1e7b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114086 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-04-14tdf#140639 cache FcPattern for font optionsCaolán McNamara1-4/+107
Change-Id: Ibb1b1e06630e505924e05ea4b5b454e58738d743 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114083 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-04-14use original FontAttributes instead of an intermediate FastPrintFontInfoCaolán McNamara1-3/+3
Change-Id: Id8f8ea9b9d144d5bf9eace81ecc07e6b5dce6d41 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114077 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-04-14getFontOptions is always called with pitch of PITCH_DONTKNOWCaolán McNamara1-1/+2
getFontOptions is called from only one location and there the pitch value is left at its default PITCH_DONTKNOW which is suspicious but that's the way it currently is Change-Id: I7e4a487b800a0111133a0edd472731ffa5122177 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114076 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-04-14hintstyle is unusedCaolán McNamara1-9/+1
left behind after... commit 561a02ec72cf963d7cd59cfb9a183c1032f0861b Date: Thu Jun 15 15:28:46 2017 +0200 loplugin:unusedfields in vcl part3 Change-Id: Iaf76a02a6f85e5bb3e72d0f4804d3cf4601dca64 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114068 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2020-12-11Adapt the remaining OUString functions to std string_viewStephan Bergmann1-1/+3
...for LIBO_INTERNAL_ONLY. These had been missed by 1b43cceaea2084a0489db68cd0113508f34b6643 "Make many OUString functions take std::u16string_view parameters" because they did not match the multi-overload pattern that was addressed there, but they nevertheless benefit from being changed just as well (witness e.g. the various resulting changes from copy() to subView()). This showed a conversion from OStringChar to std::string_view to be missing (while the corresponding conversion form OUStringChar to std::u16string_view was already present). The improvement to loplugin:stringadd became necessary to fix > [CPT] compilerplugins/clang/test/stringadd.cxx > error: 'error' diagnostics expected but not seen: > File ~/lo/core/compilerplugins/clang/test/stringadd.cxx Line 43 (directive at ~/lo/core/compilerplugins/clang/test/stringadd.cxx:42): simplify by merging with the preceding assignment [loplugin:stringadd] > File ~/lo/core/compilerplugins/clang/test/stringadd.cxx Line 61 (directive at ~/lo/core/compilerplugins/clang/test/stringadd.cxx:60): simplify by merging with the preceding assignment [loplugin:stringadd] > 2 errors generated. Change-Id: Ie40de0616a66e60e289c1af0ca60aed6f9ecc279 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107602 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-09-05rhbz#1875377 if sort order is equivalent keep order fontconfig presentsCaolán McNamara1-1/+1
there are two fonts in fedora 32/33 for regular Cantarell /usr/share/fonts/cantarell/Cantarell-Regular.otf and /usr/share/fonts/cantarell/Cantarell-VF.otf where VF is the Variable Font version. The Cantarell-Regular ones has a CFF table and export to pdf creates a font subset that works perfectly fine. The VF one does not have a CFF table and the fallback case doesn't work for pdf export. Both have the same version, use a stable sort to retain their relative order that fontconfig presents so we use the Cantarell-Regular version we would see if we didn't sort by version at all. Change-Id: I750006b980810fc59e0a152d42ae17f29f46e3b3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102062 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2020-08-04loplugin:flatten in vcl/unxNoel Grandin1-12/+12
Change-Id: Ib9df009a51db1ed96c6eea7bda68e288755e7a56 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100032 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-04-20tdf#130924 [vcl] replace `*printf`s with `SAL_*` logging macros.Yukio Siraichi1-2/+4
Change-Id: Ie3ec1e1767478bce12eecf7bfee02ed2d45fe58c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92331 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-11-22Extend loplugin:external to warn about classesStephan Bergmann1-1/+2
...following up on 314f15bff08b76bf96acf99141776ef64d2f1355 "Extend loplugin:external to warn about enums". Cases where free functions were moved into an unnamed namespace along with a class, to not break ADL, are in: filter/source/svg/svgexport.cxx sc/source/filter/excel/xelink.cxx sc/source/filter/excel/xilink.cxx svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx All other free functions mentioning moved classes appear to be harmless and not give rise to (silent, even) ADL breakage. (One remaining TODO in compilerplugins/clang/external.cxx is that derived classes are not covered by computeAffectedTypes, even though they could also be affected by ADL-breakage--- but don't seem to be in any acutal case across the code base.) For friend declarations using elaborate type specifiers, like class C1 {}; class C2 { friend class C1; }; * If C2 (but not C1) is moved into an unnamed namespace, the friend declaration must be changed to not use an elaborate type specifier (i.e., "friend C1;"; see C++17 [namespace.memdef]/3: "If the name in a friend declaration is neither qualified nor a template-id and the declaration is a function or an elaborated-type-specifier, the lookup to determine whether the entity has been previously declared shall not consider any scopes outside the innermost enclosing namespace.") * If C1 (but not C2) is moved into an unnamed namespace, the friend declaration must be changed too, see <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71882> "elaborated-type-specifier friend not looked up in unnamed namespace". Apart from that, to keep changes simple and mostly mechanical (which should help avoid regressions), out-of-line definitions of class members have been left in the enclosing (named) namespace. But explicit specializations of class templates had to be moved into the unnamed namespace to appease <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92598> "explicit specialization of template from unnamed namespace using unqualified-id in enclosing namespace". Also, accompanying declarations (of e.g. typedefs or static variables) that could arguably be moved into the unnamed namespace too have been left alone. And in some cases, mention of affected types in blacklists in other loplugins needed to be adapted. And sc/qa/unit/mark_test.cxx uses a hack of including other .cxx, one of which is sc/source/core/data/segmenttree.cxx where e.g. ScFlatUInt16SegmentsImpl is not moved into an unnamed namespace (because it is declared in sc/inc/segmenttree.hxx), but its base ScFlatSegmentsImpl is. GCC warns about such combinations with enabled-by-default -Wsubobject-linkage, but "The compiler doesn’t give this warning for types defined in the main .C file, as those are unlikely to have multiple definitions." (<https://gcc.gnu.org/onlinedocs/gcc-9.2.0/gcc/Warning-Options.html>) The warned-about classes also don't have multiple definitions in the given test, so disable the warning when including the .cxx. Change-Id: Ib694094c0d8168be68f8fe90dfd0acbb66a3f1e4 Reviewed-on: https://gerrit.libreoffice.org/83239 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-11-03loplugin:stringaddNoel Grandin1-3/+3
tweak the plugin to be more permissive, then validate by hand afterwards Change-Id: I40c5c911fe6ff7e45baaca372abf7dac211d9654 Reviewed-on: https://gerrit.libreoffice.org/81942 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>