summaryrefslogtreecommitdiff
path: root/starmath
AgeCommit message (Collapse)AuthorFilesLines
2020-05-11remove archaic Content.xml fallbackCaolán McNamara4-23/+5
there's no evidence that Content.xml (or Meta.xml) was written by any released version to necessitate the fallback reportdesign Settings.xml and Style.xml fallbacks appear to be cargocult influenced by the Content.xml/Meta.xml examples Change-Id: I51d138344edaffc6d21e17c2d28047ea6316304e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93970 Reviewed-by: Michael Stahl <michael.stahl@cib.de> Tested-by: Jenkins
2020-05-10compact namespace in sal..svgioNoel Grandin5-7/+7
Change-Id: I7e70614ea5a1cb1a1dc0ef8e9fb6fd48e85c3562 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93904 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-05-07tdf#118418 implement scrollSubstringTo() for gtkColomban Wendling2-0/+7
Define & use new accessibility scroll type compatible with IAccessible2 and extend the XAccessibleText interface to require scrollSubstringTo(). Co-authored-by: Martin Pieuchot <mpi@grenadille.net> Change-Id: Id3b2e8616892d7dcbfb41a14b72a8a457fd1dbf6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89851 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-05-07fix memory leak of xmlDoc objectsNoel Grandin1-6/+6
in unit tests Change-Id: Id16731bbbe2f1b0e3642722d77aba04fc98db4cc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93508 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-04-29simplify handling of comparing XML_NAMESPACE valuesNoel Grandin1-1/+1
Change-Id: I18bbf1ee206285842250891ce556d523489855b1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93075 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-04-29weld SfxTemplatePanelControlCaolán McNamara1-0/+1
Change-Id: Ib3f6d01ddec37afc3987423dc15ab84ad6475f37 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92942 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2020-04-28move the castToFastAttributeList functionNoel Grandin1-27/+13
to the slightly higher namespace, to make it easy and more readable to use directly in a for-loop-range expression. And make it return a reference rather than a pointer, since it is never allowed to be nullptr. Change-Id: I15d0b32493ef65cfc601b247c272b318f1eadfd8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93049 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-04-27Make upcasting css::uno::Reference ctor require complete typesStephan Bergmann1-0/+1
The main reason for the "home-grown" UpCast introduced with 904b3d1fceee5827076758ed2a81f80cb73493ca "Up-cast conversion constructor for css::uno::Reference" in 2013 was probably that we could not yet rely on C++11 std::is_base_of back then. A (welcome) side effect was that the derived class could be incomplete. However, specializations of UpCast relying on whether or not T2 is incomplete are obviously an ODR violation if the type is incomplete in some TUs and complete (and derived from T1) in others. And even if UpCast had internal linkage, it would still be brittle that its behavior depends on the completeness of T2 at the point of the template's instantiation, and not necessarily at the point of use. That means we should better base that ctor on std::is_base_of (which we can do now since 39a1edd6fec902ef378acce8af42c4d7fba280d0 "Make css::uno::Reference upcast ctor LIBO_INTERNAL_ONLY"), which causes a compilation error at least on Clang and GCC if the completeness requirements are not met. This change fixes all the cases where types need to be complete now, plus any resulting loplugin:referencecasting warnings ("the source reference is already a subtype of the destination reference"). Change-Id: Ieb9e3552e90adbf2c5a5af933dcb872e20661a2f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92950 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-04-26update pchesCaolán McNamara1-1/+2
Change-Id: I83a61da7dda6c72552eecd377f1c3744c92a797e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92909 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2020-04-25loplugin:unusedenumconstantsNoel Grandin1-84/+0
Change-Id: If2473097c1c8e66e09238061da9d186d4c8e3d9e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92871 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-04-24tdf#132305: Teach Starmath MS_COMBOVERLINE = 0x0305Julien Nabet2-0/+4
Change-Id: I04b282d3f0dae68d459002f5a3822ac06fdb7986 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92698 Reviewed-by: Julien Nabet <serval2412@yahoo.fr> Tested-by: Jenkins
2020-04-22tdf#42949 Simplify use of rtl::math::approxEqual in include/basegfx/Gabor Kelemen3-0/+3
Turns out we can save about 500Mb of preprocessor input if we use rtl_math_approxEqual from rtl/math.h instead of its C++ wrapper rtl::math::approxEqual from rtl/math.hxx and manage the fallout accordingly. Before: bin/includebloat.awk | head sum total bytes included (excluding system headers): 19017296671 After: $ bin/includebloat.awk | head sum total bytes included (excluding system headers): 18535432672 Change-Id: I1691171f3a309405a7099882ad9989d147f59118 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92508 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2020-04-22uiobject.hxx only needs forward declaresCaolán McNamara1-2/+2
and update pches accordingly Change-Id: I411712532fd85961bffe6678416fcdc1d9c7f53d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92617 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2020-04-16loplugin:buriedassign in starmath..svlNoel Grandin7-25/+54
Change-Id: I979faf4c476a7de91a0b6e06dd8717cee25525f1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92313 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-04-15add an IsEmpty method to tools::Size and use itNoel Grandin3-7/+6
Change-Id: I7f5201e2ea6c74329336e16bf219630e38ff92cf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92264 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-04-12improve fastparser loggingNoel Grandin1-7/+7
so we print out the full namespace, which is quite handy when tracking down attributes that are not being parsed. Change-Id: I085d39b365d43c1a53a7c176b633ea38e6a7fb45 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92064 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-04-11rename vcl::Window::Update to PaintImmediatelyNoel Grandin2-2/+2
To make the code easier to read. Change-Id: Iebc648150391939fba5d1cd815c72dbcf02ceec6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90378 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-04-09tdf#129372: PPTX: error at SfxBaseModel::storeToStorage: 0x20d(row,col)Julien Nabet1-2/+7
Teach starmath how to deal with surrogate pairs see https://en.wikipedia.org/wiki/Universal_Character_Set_characters#Surrogates + comments from: https://bugs.documentfoundation.org/show_bug.cgi?id=129372#c6 Here's the culprit character: 𝜕 %uD835%uDF15 I didn't dig why these 2 (found in reduced example attached to the bugtracker) didn't need this patch 𝑋 %uD835%uDC4B 𝑢 %uD835%uDC62 Change-Id: I3bf2322a9e7f1974aa8622a91812aeb11e613ace Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91941 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2020-04-07loplugin:unusedvariableplus in starmathNoel Grandin1-11/+7
in this situation, convert std::unique_ptr to allocating on stack, saving us a malloc/free operation, which is particularly nice since these classes don't even need any storage. Change-Id: Ic4fd076f5f86b754cef86207fee4abcce3e769ec Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91791 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-03-19loplugin:redundantpointerops add some more smart pointer typesNoel Grandin1-1/+1
Change-Id: Ia7f3441404d8d2e5de501e70da496b6fdc6c9a4a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90728 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-03-13Revert "loplugin:constfields in starmath"Noel Grandin14-26/+26
This reverts commit e494cc2942899fd92a2273eaed2bf41eb74ea8a9. Change-Id: Ie73ecb4b7299e70dea729c374763f9e2df2aa6f8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90421 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-02-21Drop o3tl::optional wrapperStephan Bergmann3-3/+3
...now that macOS builds are guaranteed to have std::optional since 358146bbbd1b9775c12770fb5e497b6ec5adfc51 "Bump macOS build baseline to Xcode 11.3 and macOS 10.14.4". The change is done mostly mechanically with > for i in $(git grep -Fl optional); do > sed -i -e 's:<o3tl/optional\.hxx>\|\"o3tl/optional\.hxx\":<optional>:' \ > -e 's/\<o3tl::optional\>/std::optional/g' \ > -e 's/\<o3tl::make_optional\>/std::make_optional/g' "$i" > done > for i in $(git grep -Flw o3tl::nullopt); do > sed -i -e 's/\<o3tl::nullopt\>/std::nullopt/g' "$i" > done (though that causes some of the resulting #include <optional> to appear at different places relative to other includes than if they had been added manually), plus a few manual modifications: * adapt bin/find-unneeded-includes * adapt desktop/IwyuFilter_desktop.yaml * remove include/o3tl/optional.hxx * quote resulting "<"/">" as "&lt;"/"&gt;" in officecfg/registry/cppheader.xsl * and then solenv/clang-format/reformat-formatted-files Change-Id: I68833d9f7945e57aa2bc703349cbc5a56b342273 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89165 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-02-16use fwd declsCaolán McNamara1-0/+1
Change-Id: I06a4049d84d3ef755b713c045f686361782bdfc1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88807 Tested-by: Caolán McNamara <caolanm@redhat.com> Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2020-02-01make update_pch also consider files in <module>/src/**/incLuboš Luňák1-3/+10
With --enable-pch=full there's not much difference between a "public" header in <module>/inc and a private one in <module>/src/somewhere/inc . And since the script searches recursively, this apparently helps to find even more headers for lower pch levels. Change-Id: I8483d0aa5b4fea5a59107c20a8aa5f1ef694af0a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87799 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2020-01-29push/pop mapmode to avoid 'incorrect MapMode?' warningCaolán McNamara1-0/+4
since... commit 644ebf7823c85973e2724cbfcf403cb63b054bfe Date: Tue Jan 28 20:40:15 2020 +0000 weld SmElementsDockingWindow Change-Id: I072f8b9d31be93722930d30b183766b7795f7a26 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87698 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2020-01-29bInterim is always trueCaolán McNamara1-1/+1
Change-Id: Id9f72fdb94a766ef58a44b3653a36f22335b5718 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87676 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2020-01-29weld SmElementsDockingWindowCaolán McNamara9-370/+253
Change-Id: Ieeaa1f1e0deb708ec6d3daf261384c61d2ade22b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87659 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2020-01-28tdf#96505: Get rid of cargo cult long integer literalsOnur Yilmaz1-30/+30
I checked return values. Long variables didn't affect the calculation. Change-Id: I05fe807e34beb962e3867a708939e557d56e5549 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87491 Reviewed-by: Stephan Bergmann <sbergman@redhat.com> Tested-by: Stephan Bergmann <sbergman@redhat.com>
2020-01-28tdf#96505: Get rid of cargo cult long integer literalsOnur Yilmaz2-5/+5
I checked return values. Long variables didn't affect the calculation. Change-Id: I1d5b5cffa291c20f7940dc14efa05cc64f3ff1ed Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87499 Reviewed-by: Stephan Bergmann <sbergman@redhat.com> Tested-by: Stephan Bergmann <sbergman@redhat.com>
2020-01-28remove some unused local varsNoel Grandin1-1/+0
found by my new loplugin:unusedvariableplus Change-Id: Ic3f55f492d43a53d8850a97d44059ff127fd69a2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87573 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-01-28New loplugin:unsignedcompareStephan Bergmann1-2/+3
"Find explicit casts from signed to unsigned integer in comparison against unsigned integer, where the cast is presumably used to avoid warnings about signed vs. unsigned comparisons, and could thus be replaced with o3tl::make_unsigned for clairty." (compilerplugins/clang/unsignedcompare.cxx) o3tl::make_unsigned requires its argument to be non-negative, and there is a chance that some original code like static_cast<sal_uInt32>(n) >= c used the explicit cast to actually force a (potentially negative) value of sal_Int32 to be interpreted as an unsigned sal_uInt32, rather than using the cast to avoid a false "signed vs. unsigned comparison" warning in a case where n is known to be non-negative. It appears that restricting this plugin to non- equality comparisons (<, >, <=, >=) and excluding equality comparisons (==, !=) is a useful heuristic to avoid such false positives. The only remainging false positive I found was 0288c8ffecff4956a52b9147d441979941e8b87f "Rephrase cast from sal_Int32 to sal_uInt32". But which of course does not mean that there were no further false positivies that I missed. So this commit may accidentally introduce some false hits of the assert in o3tl::make_unsigned. At least, it passed a full (Linux ASan+UBSan --enable-dbgutil) `make check && make screenshot`. It is by design that o3tl::make_unsigned only accepts signed integer parameter types (and is not defined as a nop for unsigned ones), to avoid unnecessary uses which would in general be suspicious. But the STATIC_ARRAY_SELECT macro in include/oox/helper/helper.hxx is used with both signed and unsigned types, so needs a little oox::detail::make_unsigned helper function for now. (The ultimate fix being to get rid of the macro in the first place.) Change-Id: Ia4adc9f44c70ad1dfd608784cac39ee922c32175 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87556 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-01-21Use FastParser in XMLDocumentSettingsContextNoel Grandin1-22/+5
and flatten the pImpl data Change-Id: I8d817cd2af0a3855d10dbfaa580c3379119d5067 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87126 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-01-15rework SvxUndoRedoControl to be a PopupWindowControllerCaolán McNamara1-2/+0
Change-Id: I78b4e03c76bc3aa8479013ae157a9e1316dcfecd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86841 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2020-01-12convert mathml to FastParserNoel Grandin2-876/+341
Change-Id: I2aa198e766df55143d59d41019cba9b569bd0622 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86599 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-01-11loplugin:finalclasses in starmathNoel Grandin10-54/+54
Change-Id: I65ac9a8767c298c50606a3b269a227dd1513a112 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86550 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-01-10use more std::make_sharedNoel Grandin1-2/+2
found using 'git grep', I tried using clang-tidy, but it only successfully found a tiny fraction of these Change-Id: I61c7d85105ff7a911722750e759d6641d578da33 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86526 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-01-07extract some common code from ImportContext classesNoel Grandin1-5/+1
which reduces code bloat, and lets us log when elements are ignored Change-Id: I5ca12bc1fcbfa3bea49ebde819fd80bd233a96a0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86338 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-12-25use FastParser in starmathNoel Grandin1-4/+4
Change-Id: I5633b8e17d3150fac356ac7f7c0369d119a2af60 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/85790 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-12-22sal_Char->char in sot..storeNoel Grandin9-22/+22
Change-Id: Ia133c1a7549d81f2e88e34ab7e6c9ea578c745ae Reviewed-on: https://gerrit.libreoffice.org/85702 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-12-17make approximate_char_width private and use approximate_digit_widthCaolán McNamara1-2/+2
Change-Id: I063cb5b9823d374014fd2c8129eba53384b96870 Reviewed-on: https://gerrit.libreoffice.org/85273 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2019-12-04some std::set->o3tl::sorted_vectorNoel Grandin1-2/+2
which is much better cache-wise Change-Id: Iacec0df48f043bcdd761ed30c1b1513850a00152 Reviewed-on: https://gerrit.libreoffice.org/84311 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-12-03Adapt SAL_WARN to C++20 deleted ostream << for sal_Unicode (aka char16_t)Stephan Bergmann1-2/+2
<http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1423r3.html> "char8_t backward compatibility remediation", as implemented now by <https://gcc.gnu.org/ git/?p=gcc.git;a=commit;h=0c5b35933e5b150df0ab487efb2f11ef5685f713> "libstdc++: P1423R3 char8_t remediation (2/4)" for -std=c++2a, deletes operator << overloads that would print an integer rather than a (presumably expected) character. Change-Id: Ic70d3e90e4b990d297e35f07379fe4952e138820 Reviewed-on: https://gerrit.libreoffice.org/84321 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-12-03Adapt CPPUNIT_ASSERT to C++20 deleted ostream << for sal_Unicode (aka char16_t)Stephan Bergmann2-0/+3
<http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1423r3.html> "char8_t backward compatibility remediation", as implemented now by <https://gcc.gnu.org/ git/?p=gcc.git;a=commit;h=0c5b35933e5b150df0ab487efb2f11ef5685f713> "libstdc++: P1423R3 char8_t remediation (2/4)" for -std=c++2a, deletes operator << overloads that would print an integer rather than a (presumably expected) character. But for simplicity (and to avoid issues with non-printing characters), keep printing an integer here. Change-Id: I751b99ee32d418eb488131ffa130d6f7d6d38dc7 Reviewed-on: https://gerrit.libreoffice.org/84348 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-12-03remove some useless comment linesNoel Grandin1-1/+0
which merely announce that the next declaration is a class Change-Id: Ifdb1398bcd99816b13e0b3769b46d0562bfbc1dc Reviewed-on: https://gerrit.libreoffice.org/84229 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-12-01Introduce o3tl::optional as an alias for std::optionalStephan Bergmann3-3/+3
...with a boost::optional fallback for Xcode < 10 (as std::optional is only available starting with Xcode 10 according to <https://en.cppreference.com/w/cpp/compiler_support>, and our baseline for iOS and macOS is still Xcode 9.3 according to README.md). And mechanically rewrite all code to use o3tl::optional instead of boost::optional. One immediate benefit is that disabling -Wmaybe-uninitialized for GCC as per fed7c3deb3f4ec81f78967c2d7f3c4554398cb9d "Slience bogus -Werror=maybe-uninitialized" should no longer be necessary (and whose check happened to no longer trigger for GCC 10 trunk, even though that compiler would still emit bogus -Wmaybe-uninitialized for uses of boost::optional under --enable-optimized, which made me ponder whether this switch from boost::optional to std::optional would be a useful thing to do; I keep that configure.ac check for now, though, and will only remove it in a follow up commit). Another longer-term benefit is that the code is now already in good shape for an eventual switch to std::optional (a switch we would have done anyway once we no longer need to support Xcode < 10). Only desktop/qa/desktop_lib/test_desktop_lib.cxx heavily uses boost::property_tree::ptree::get_child_optional returning boost::optional, so let it keep using boost::optional for now. After a number of preceding commits have paved the way for this change, this commit is completely mechanical, done with > git ls-files -z | grep -vz -e '^bin/find-unneeded-includes$' -e '^configure.ac$' -e '^desktop/qa/desktop_lib/test_desktop_lib.cxx$' -e '^dictionaries$' -e '^external/' -e '^helpcontent2$' -e '^include/IwyuFilter_include.yaml$' -e '^sc/IwyuFilter_sc.yaml$' -e '^solenv/gdb/boost/optional.py$' -e '^solenv/vs/LibreOffice.natvis$' -e '^translations$' -e '\.svg$' | xargs -0 sed -i -E -e 's|\<boost(/optional)?/optional\.hpp\>|o3tl/optional.hxx|g' -e 's/\<boost(\s*)::(\s*)(make_)?optional\>/o3tl\1::\2\3optional/g' -e 's/\<boost(\s*)::(\s*)none\>/o3tl\1::\2nullopt/g' (before committing include/o3tl/optional.hxx, and relying on some GNU features). It excludes some files where mention of boost::optional et al should apparently not be changed (and the sub-repo directory stubs). It turned out that all uses of boost::none across the code base were in combination with boost::optional, so had all to be rewritten as o3tl::nullopt. Change-Id: Ibfd9f4b3d5a8aee6e6eed310b988c4e5ffd8b11b Reviewed-on: https://gerrit.libreoffice.org/84128 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-11-25Turn on clang-format for these filesMiklos Vajna1-22/+11
I (tried to) keep these files consistent locally with astyle in the past, switching to clang-format makes sure that the recent problem with introducing inconsistencies with automatic loplugin rewrites doesn't happen again. Change-Id: I86def0d13a1d16f8cedb7cf9927a48ce14c2b3bf Reviewed-on: https://gerrit.libreoffice.org/83690 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2019-11-22Extend loplugin:external to warn about classesStephan Bergmann3-4/+77
...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-17Extend loplugin:external to warn about enumsStephan Bergmann1-0/+4
To mitigate the dangers of silently breaking ADL when moving enums into unnamed namespaces (see the commit message of 206b5b2661be37efdff3c6aedb6f248c4636be79 "New loplugin:external"), note all functions that are affected. (The plan is to extend loplugin:external further to also warn about classes and class templates, and the code to identify affected functions already takes that into account, so some parts of that code are not actually relevant for enums.) But it appears that none of the functions that are actually affected by the changes in this commit relied on being found through ADL, so no adaptions were necessary for them. (clang::DeclContext::collectAllContexts is non-const, which recursively means that External's Visit... functions must take non-const Decl*. Which required compilerplugins/clang/sharedvisitor/analyzer.cxx to be generalized to support such Visit... functions with non-const Decl* parameters.) Change-Id: Ia215291402bf850d43defdab3cff4db5b270d1bd Reviewed-on: https://gerrit.libreoffice.org/83001 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-11-03loplugin:stringaddNoel Grandin3-9/+6
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>
2019-11-02New loplugin:conditionalstringStephan Bergmann1-1/+1
Change-Id: I2eab990c15f845b44a3b598571aca361dadf9ff3 Reviewed-on: https://gerrit.libreoffice.org/81946 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>