summaryrefslogtreecommitdiff
path: root/jvmfwk/plugins
AgeCommit message (Collapse)Author
2021-11-18There was a typo in the AdoptOpenJDK java.vendor property valueStephan Bergmann
...ever since 61c4f96d6ae6a80370774e53287edb27cbce8067 "Support AdoptOpenJDK": At least the old AdoptOpenJDK 1.8.0_275 I had lying around on macOS reported it as "AdoptOpenJDK", not "AdoptOpenJdk". But instead of fixing all occurences of "AdoptOpenJdk", we can just as well get rid of that vendor listing completely now after 3d27b2fa9c5a03f78e5145377402f8a88e3da1be "tdf#124503: Support JRE installations with unknown java.vendor property" and 3460c16d7f749d8d2a59d8b927df5ec31f64a083 "Make getVersionInformation always return a VersionInfo ...even for JREs not listed in javavendors.xml, making it default to a VersionInfo with sMinVersion = "1.8.0". (For a rationale for not updating the <updated> elements of the modified jvmfwk/distributions/OpenOfficeorg/javavendors_*.xml see the commit message of 95c38f6d77f1cb6ff3dc229c5e7130b2e732891d "Drop support for dead GNU Java".) Change-Id: Iea34914201f604a0665a86dd07724628fa021c90 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125402 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-11-17tdf#144695 VendorBase::isValidArch also for macOSStephan Bergmann
Lets extend it only to macOS (where there is some confusion now with Rosetta- translated vs. native processes on Apple M1 machines), not to all Unix-like OSs: The comment that it "is not defined what the exact [os.arch] values are" is still relevant. At least for OpenJDK, while Windows has a hardcoded list of possible values in GetJavaProperties at <https://github.com/openjdk/jdk/blob/9604ee82690f89320614b37bfef4178abc869777/src/java.base/windows/native/libjava/java_props_md.c#L568>, the corresponding non-Windows code in GetJavaProperties at <https://github.com/openjdk/jdk/blob/319a3b994703aac84df7bcde272adfcb3cdbbbf0/jdk/src/solaris/native/java/lang/java_props_md.c#L175> uses ARCHPROPNAME which, via > -DARCHPROPNAME='"$(OPENJDK_TARGET_CPU_OSARCH)"' at <https://github.com/openjdk/jdk/blob/c363db8ed00ff27eadf06294364d908d6a7d03a6/jdk/makefiles/CompileNativeLibraries.gmk#L185>, appears to somehow come out of Autoconf at <https://github.com/openjdk/jdk/blob/228c21635b011fbf956b83a0b07fc297e9a34c46/common/autoconf/spec.gmk.in#L93>, so probably can show some variance in actual values being used. Change-Id: I16725cd9365f6bd034372c653aa43ab84d487b98 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125401 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-11-16rtl::Static->thread-safe static in jvmfwkNoel Grandin
Change-Id: I049148d82eb306e8ba7fdc9f0cc650f45b05da0c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125257 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-10-21Make getVersionInformation always return a VersionInfoStephan Bergmann
...even for JREs not listed in javavendors.xml, making it default to a VersionInfo with sMinVersion = "1.8.0". 3d27b2fa9c5a03f78e5145377402f8a88e3da1be "tdf#124503: Support JRE installations with unknown java.vendor property", which had changed getVersionInformation to return an optional<VersionInfo>, said in the commit message: "For simplicity, assume that any versions of such JREs are supported. Our baseline is Java 6, and there are unlikely any older versions of JREs from unknown vendors out there." Our baseline is Java 8 by now, and there are still unlikely any older JREs out there, but for macOS ARM64 we may want to restrict to at least Java 17 implementing <http://openjdk.java.net/jeps/391> "JEP 391: macOS/AArch64 Port", and this commit is a prerequisite for such a change (where we would then e.g. change the hardcoded "1.8.0" to "17" for just that one platform). (OtherInfo::compareVersions in jvmfwk/plugins/sunmajor/pluginlib/otherjre.cxx unconditionally returns 0, meaning "versions compare equal", so introducing a default version of "1.8.0" should have no negative effect on any JREs that use OtherInfo.) Change-Id: I34dc5f2b755c2254a91d42c262786ceec70c746e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123958 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-10-20Drop support for dead GNU JavaStephan Bergmann
...which no longer worked anyway at least since aafc10c9edb61e13ac557c7e43c8d4a31dce4f37 "Bump Java baseline to Java 8": According to <https://en.wikipedia.org/wiki/GNU_Compiler_for_Java>, the last version of GCC providing Java was GCC 6.5. But trying to add a build of that ("Tools - Options... - LibreOffice - Advanced - Java Options - Add...") would already have failed before this commit due to a java.lang.ClassFormatError ("JREProperties (unrecognized class file version)") when executing the JREProperties code compiled with --release 8. (Whereas now it fails because it cannot even determine a JRE installation there according to the SunInfo rather than GnuInfo rules used for the now-unknown vendor.) The <updated> elements of the modified jvmfwk/distributions/OpenOfficeorg/javavendors_*.xml have not been updated in line with the rules documented at the end of jvmfwk/README.md: As mentioned above, a GNU Java JRE cannot have been selected prior to this commit anyway, so even though this is nominally an incompatible change of the xml files, actually updating <updated> would only have negative ("just annoying if an already selected JRE is still supported") but no positive consequences. Change-Id: Ica245677dae977360bdb3c6544897eb060c3f844 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123906 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-10-20Azul is just another OpenJDK variantStephan Bergmann
...so there was no good reason for 0f95f8ffd7a3685ca53876005a9c96f2e2e7bc99 "Support Azul Zulu JRE (at least on Windows)" to map it to OtherInfo rather than SunInfo. (That way, it benefits from SunInfo::compareVersions's proper implementation, unlike OtherInfo::compareVersions which always returns 0. Although trying to add e.g. the too-old Java 7 <https://cdn.azul.com/zulu/bin/zulu7.50.0.11-ca-jdk7.0.322-linux_x64.tar.gz> would already have failed before this commit due to a java.lang.UnsupportedClassVersionError when executing the JREProperties code.) This also reverts all the "needed by Azul" additions in OtherInfo::getRuntimePaths; it is unlikely that any of the other JREs using OtherInfo silently also benefited from them, and JREs of unknown vendor use SunInfo (which does have those two paths already, as they are not only needed by Azul there). Change-Id: I4af9b4b9e65cd2346011522c105cfc62ec59f552 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123874 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-10-11loplugin:moveparam in jvmfwkNoel Grandin
Change-Id: I78970269bfd3eb7ad6b069ac99eeee707619d3e4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123416 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-10-05drop 'using namespace std' in h* i* j*Julien Nabet
Change-Id: I3c28651779f17e1a410505ffaa863b4773037ccf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123119 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2021-08-02convert #defines to OUStringLiteralNoel Grandin
mostly by doing $ git grep -l '#define.*\"' -- *.cxx | xargs perl -pi -e 's/^#define\s+(\w+)\s+(\".*\")/constexpr OUStringLiteral \1 = u\2;/g' Change-Id: Idface893449b0ef2a3c5254865a300585d752fbb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119669 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-07-09loplugin:indentation (clang-cl)Stephan Bergmann
Change-Id: Iae559ca8bee9650c01167a4d1b918e18cbf03c28 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118660 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-07-08Turn OSL_DEBUG_LEVEL >= 2 SelfTest into CppunitTestStephan Bergmann
...and move "10.0", "10.10", and "1.5.0_010" from badVersions[] to good versions[] to make the test succeed (assuming these shall indeed be classified as good by now, presumably due to changes to the SunVersion implementation in the meantime) Change-Id: Ia7cf9b0e607743a5e0534078c0221c1423f6cfb3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118570 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-07-07Revert "I suspect that we unlikely to use JRE older than 1.3.1_07"Michael Stahl
This reverts commit b3541dea4889b9d0039554f87bd16e55189cf8b1. Reason for revert: The code did not just deal with text encoding differences, but also with properties whose value contains line breaks. For example, OpenJ9 has line breaks in "java.vm.info" and "java.fullversion", which now trigger asserts; also there is "line.separator" but this one happened not to cause problems so far. Change-Id: I3ded8e824e96b6fcf21677dd9ba72cbf58c1d261 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118495 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-06-29Enable JVM also on macOS ARM64Stephan Bergmann
My previous attempts of `make check` and running a --with-java build against various Azul JDK 13--17 have always crashed with SIGBUS that smelled like our uses of pthread_jit_write_protect_np in bridges/source/cpp_uno/shared/vtablefactory.cxx colided with corresponding calls in the in-process JVM, randomly(?) causing some attempts of running generated code to SIGBUS. (See the email thread starting at <https://lists.freedesktop.org/archives/libreoffice/2020-December/086490.html> "Using Java on macOS ARM64".) But at least with the recent <https://cdn.azul.com/zulu/bin/zulu17.0.63-ea-jdk17.0.0-ea.27-macosx_aarch64.zip> on macOS 11.4, this appears to work reliably now: Multiple `make check screenshot` as well as some manual use of LibreOffice did not run into any such issues. Change-Id: I2b1327e7e877ed71420c174c1d88e68a96b3532e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118114 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-05-14Improve loplugin:stringviewStephan Bergmann
Issue the "instead of O[U]String, pass [u16]string_view" diagnostic also for operator call arguments. (The "rather than copy, pass subView()" diagnostic is already part of handleSubExprThatCouldBeView, so no need to repeat it explicitly for operator call arguments.) (And many call sites don't even require an explicit [u16]string_view, esp. with the recent ad48b2b02f83eed41fb1eb8d16de7e804156fcf1 "Optimized OString operator += overloads". Just some test code in sal/qa/ that explicitly tests the O[U]String functionality had to be excluded.) Change-Id: I8d55ba5a7fa16a563f5ffe43d245125c88c793bc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115589 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-05-10I suspect that we unlikely to use JRE older than 1.3.1_07Mike Kaganski
... and so possibly can rely on -Dfile.encoding=UTF8 now. This reverts 79ac0685de0b19d856db70a208a8372cb589646c and 3428bace79d64a10cfcabb79e4caa608ee5db233. Change-Id: Ia9e09025691b200c0f79427e0f4efe500f9c81f8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115272 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-01-02Fix some warnings for Raspberry pi 4 (part2)Julien Nabet
Fix these kinds: /home/pi/lo/libreoffice/bridges/source/cpp_uno/gcc3_linux_arm/uno2cpp.cxx:103:10: error: externally available entity 'is_complex_struct' is not previously declared in an included file (if it is only used in this translation unit, make it static; otherwise, provide a declaration of it in an included file) [loplugin:external] bool is_complex_struct(const typelib_TypeDescription * type) ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /home/pi/lo/libreoffice/bridges/source/cpp_uno/gcc3_linux_arm/uno2cpp.cxx:129:10: error: externally available entity 'is_float_only_struct' is not previously declared in an included file (if it is only used in this translation unit, make it static; otherwise, provide a declaration of it in an included file) [loplugin:external] bool is_float_only_struct(const typelib_TypeDescription * type) ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /home/pi/lo/libreoffice/bridges/source/cpp_uno/gcc3_linux_arm/uno2cpp.cxx:168:6: error: externally available entity 'MapReturn' is not previously declared in an included file (if it is only used in this translation unit, make it static; otherwise, provide a declaration of it in an included file) [loplugin:external] void MapReturn(sal_uInt32 r0, sal_uInt32 r1, typelib_TypeDescriptionReference * pReturnType, sal_uInt32* pRegisterReturn) /home/pi/lo/libreoffice/bridges/source/cpp_uno/gcc3_linux_arm/uno2cpp.cxx:446:32: error: static_cast from 'void **' to 'sal_Int32 *' (aka 'long *') is not allowed sal_Int32 * pTempIndices = static_cast<sal_Int32 *>(pCppArgs + nParams); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ or some of these: In file included from /home/pi/lo/libreoffice/bean/native/unix/com_sun_star_comp_beans_LocalOfficeWindow.c:26: /usr/lib/jvm/java-11-openjdk-armhf/include/jni.h:1945:1: error: unknown attribute 'externally_visible' ignored [-Werror,-Wunknown-attributes] _JNI_IMPORT_OR_EXPORT_ jint JNICALL ^ /usr/lib/jvm/java-11-openjdk-armhf/include/jni.h:1943:32: note: expanded from macro '_JNI_IMPORT_OR_EXPORT_' define _JNI_IMPORT_OR_EXPORT_ JNIIMPORT ^ /usr/lib/jvm/java-11-openjdk-armhf/include/linux/jni_md.h:35:42: note: expanded from macro 'JNIIMPORT' define JNIIMPORT __attribute__((externally_visible,visibility("default"))) Change-Id: I7cae1c52ee10306da666c9c234b9af7248efd04e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108567 Tested-by: Julien Nabet <serval2412@yahoo.fr> Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2020-12-29loplugin:stringviewparam: operator +Stephan Bergmann
Change-Id: I044dd21b63d7eb03224675584fa143009c6b6008 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108418 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-12-11Adapt the remaining OUString functions to std string_viewStephan Bergmann
...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-11-30loplugin:stringviewparam include comparisons with string literalsNoel
Change-Id: I8ba1214500dddaf413c506a4b82f43d63cda804b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106559 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-11-25loplugin:stringview (clang-cl)Stephan Bergmann
Change-Id: I47b44c80b2a5e3c9d84f5d7257efe17f138a1067 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106563 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-11-18tdf#123936 Formatting files in module jvmfwk with clang-formatPhilipp Hofer
Change-Id: Ie643402fbf10ac837c975d29068b7973e9dd6210 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105685 Tested-by: Jenkins Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
2020-09-22Manually select JDK outside /Library/Java/JavaVirtualMachines on macOSStephan Bergmann
32bc8ddbf335dd26019edcf12758643b4cff9913 "tdf#94716 allow Oracle's JDK to be used on OS X 10.10 and 10.11" had restricted both addJavaInfosDirScan (jvmfwk/plugins/sunmajor/pluginlib/util.cxx, relevant when LO scans for available Java runtimes) and JvmfwkUtil_isLoadableJVM (which is more central and also relevant when manually adding a Java installation on the Advanced options page) to JDK installations under /Library/Java/JavaVirtualMachines. Recent versions of OpenJDK for macOS are provided as *.tar.gz files (e.g., <https://download.java.net/java/GA/jdk15/779bf45e88a44cbd9ea6621d33e33db1/36/GPL /openjdk-15_osx-x64_bin.tar.gz> avaiable at <http://jdk.java.net/15/>) that can potentially be installed anywhere, so it looks useful to remove the /Library/Java/JavaVirtualMachines restriction from JvmfwkUtil_isLoadableJVM. I'm not sure whether that would have any nagative impact, esp. for any scenario that would still be relevant today. When I unpacked the above openjdk-15_osx-x64_bin.tar.gz to ~/OpenJDK/ on my macOS 10.15.6, and manually added /Users/stephan/OpenJDK/jdk-15.jdk/Contents/Home on the Advanced options page, everything appeared to work fine. Change-Id: I15545cc786a4a423f3bfe22ba477a45d6ef7fdf1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103212 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-09-16Turn OUStringLiteral into a consteval'ed, static-refcound rtl_uStringStephan Bergmann
...from which an OUString can cheaply be instantiated. This is the OUString equivalent of 4b9e440c51be3e40326bc90c33ae69885bfb51e4 "Turn OStringLiteral into a consteval'ed, static-refcound rtl_String". Most remarks about that commit apply here too (this commit is just substantially bigger and a bit more complicated because there were so much more uses of OUStringLiteral than of OStringLiteral): The one downside is that OUStringLiteral now needs to be a template abstracting over the string length. But any uses for which that is a problem (e.g., as the element type of a container that would no longer be homogeneous, or in the signature of a function that shall not be turned into a template for one reason or another) can be replaced with std::u16string_view, without loss of efficiency compared to the original OUStringLiteral, and without loss of expressivity. The new OUStringLiteral ctor code would probably not be very efficient if it were ever executed at runtime, but it is intended to be only executed at compile time. Where available, C++20 "consteval" is used to statically ensure that. The intended use of the new OUStringLiteral is in all cases where an object that shall itself not be an OUString (e.g., because it shall be a global static variable for which the OUString ctor/dtor would be detrimental at library load/unload) must be converted to an OUString instance in at least one place. Other string literal abstractions could use std::u16string_view (or just plain char16_t const[N]), but interestingly OUStringLiteral might be more efficient than constexpr std::u16string_view even for such cases, as it should not need any relocations at library load time. For now, no existing uses of OUStringLiteral have been changed to some other abstraction (unless technically necessary as discussed above), and no additional places that would benefit from OUStringLiteral have been changed to use it. Global constexpr OUStringLiteral variables defined in an included file would be somewhat suboptimal, as each translation unit that uses them would create its own, unshared instance. The envisioned solution is to turn them into static data members of some class (and there may be a loplugin coming to find and fix affected places). Another approach that has been taken here in a few cases where such variables were only used in one .cxx anyway is to move their definitions from the .hxx into that one .cxx (in turn causing some files to become empty and get removed completely)---which also silenced some GCC -Werror=unused-variable if a variable from a .hxx was not used in some .cxx including it. To keep individual commits reasonably manageable, some consumers of OUStringLiteral in rtl/ustrbuf.hxx and rtl/ustring.hxx are left in a somewhat odd state for now, where they don't take advantage of OUStringLiteral's equivalence to rtl_uString, but just keep extracting its contents and copy it elsewhere. In follow-up commits, those consumers should be changed appropriately, making them treat OUStringLiteral like an rtl_uString or dropping the OUStringLiteral overload in favor of an existing (and cheap to use now) OUString overload, etc. In a similar vein, comparison operators between OUString and std::u16string_view have been added to the existing plethora of comparison operator overloads. It would be nice to eventually consolidate them, esp. with the overloads taking OUStringLiteral and/or char16_t const[N] string literals, but that appears tricky to get right without introducing new ambiguities. Also, a handful of places across the code base use comparisons between OUString and OUStringNumber, which are now ambiguous (converting the OUStringNumber to either OUString or std::u16string_view). For simplicity, those few places have manually been fixed for now by adding explicit conversion to std::u16string_view. Also some compilerplugins code needed to be adapted, and some of the compilerplugins/test cases have become irrelevant (and have been removed), as the tested code would no longer compile in the first place. sal/qa/rtl/strings/test_oustring_concat.cxx documents a workaround for GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96878> "Failed class template argument deduction in unevaluated, parenthesized context". That place, as well as uses of OUStringLiteral in extensions/source/abpilot/fieldmappingimpl.cxx and i18npool/source/localedata/localedata.cxx, which have been replaced with OUString::Concat (and which is arguably a better choice, anyway), also caused failures with at least Clang 5.0.2 (but would not have caused failures with at least recent Clang 12 trunk, so appear to be bugs in Clang that have meanwhile been fixed). Change-Id: I34174462a28f2000cfeb2d219ffd533a767920b8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102222 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-08-28Change OUStringLiteral from char[] to char16_t[]Stephan Bergmann
This is a prerequisite for making conversion from OUStringLiteral to OUString more efficient at least for C++20 (by replacing its internals with a constexpr- generated sal_uString-compatible layout with a SAL_STRING_STATIC_FLAG refCount, conditionally for C++20 for now). For a configure-wise bare-bones build on Linux, size reported by `du -bs instdir` grew by 118792 bytes from 1155636636 to 1155755428. In most places just a u"..." string literal prefix had to be added. In some places char const a[] = "..."; variables have been changed to char16_t, and a few places required even further changes to code (which prompted the addition of include/o3tl/string_view.hxx helper function o3tl::equalsIgnoreAsciiCase and the additional OUString::createFromAscii overload). For all uses of macros expanding to string literals, the relevant uses have been rewritten as u"" MACRO instead of changing the macro definitions. It should be possible to change at least some of those macro definitions (and drop the u"" from their call sites) in follow-up commits. Change-Id: Iec4ef1a057d412d22443312d40c6a8a290dc6144 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101483 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-08-18Add missing punctuation/spaces to error messagesStephan Bergmann
Change-Id: I4be46342b24a5993df74dbd047d88842a8df0412 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100901 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-08-18Silence new Clang 12 trunk -Werror,-Wstring-concatenationStephan Bergmann
"suspicious concatenation of string literals in an array initialization; did you mean to separate the elements with a comma?" Change-Id: I83828d8cc6f8ab9b0c1ca8a1c3fb528592c46504 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100897 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-07-02tdf#129264: Make javaldx always print a line upon successful executionStephan Bergmann
...where "do not use a JRE" (implying that the printed line consists of just a terminating newline) is a sufficient condition for a successful execution, too. (Also, it appears that extend_library_path in desktop/unx/source/start.c would have introduced unwanted empty segments into the path environment variable when the line printed by javaldx consisted of just a terminating newline.) Change-Id: Ic2f86de8a829b3dea51c0e4da1ac236298e16366 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97756 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-05-19Avoid UB when calling setjmpStephan Bergmann
The C standard (and thus by reference also the C++ standard) has very picky constraints how invocations of the setjmp macro need to appear to not cause undefined behavior. Change-Id: I09418de340a044e4309261bae9816ca746700858 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94474 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-05-17jvmfwk: fix [-Werror,-Wunused-function]Thorsten Behrens
After recent cleanups, android build fails with sunjavaplugin.cxx:204:5: error: unused function 'createJvm' [-Werror,-Wunused-function] Change-Id: Idc9a97673debdd5da798fbdc729b8d90b6b7af9c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94371 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
2020-05-15Drop the JVM "feature" concept supportStephan Bergmann
...now that 6ba74150866d71469827de9f4f19268dfa7db137 "jfw::isAccessibilitySupportDesired is obsolete" demonstrated that there is no more need for JFW_FEATURE_ACCESSBRIDGE, the sole feature that had been provided. * The javasettings_*.xml format still supports the <feature> tag, but it is ignored when reading and always written as "0". * There is no trace that "the bootstrap parameter JFW_PLUGIN_NO_NOT_CHECK_ACCESSIBILITY" whose mention gets removed from jvmfwk/plugins/sunmajor/pluginlib/JREProperties.java had ever been supported. (The only mention was 6873b3be47d71f94c38262003101576081acd241 "INTEGRATION: CWS jre5issues (1.3.18); FILE MERGED: 2005/01/18 12:48:48 jl 1.3.18.1: #i40879# in build environment the JRE is not tested for accessibility, because of potential X server problems" introducing that comment.) * The "Features" column is removed from the JRE table on the "LibreOffice - Advance" options page. Change-Id: I332d34b60548e7f2f852241ea8edfbee0ffcf510 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94329 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-05-15Avoid any false GCC -WclobberedStephan Bergmann
...by moving the code that calls JNI_CreateJavaVM and the setjmp that it may longjmp to (from abort_handler that may be called from within JNI_CreateJavaVM) into its own small function. That way, no local variables in jfw_plugin_startJavaVirtualMachine should produce any such false "variable might be clobbered by ‘longjmp’ or ‘vfork’" GCC warnings any longer, and all the workarounds to silence such warnings can be removed. Change-Id: I6de134628e8efbf2d67fcd83a9cc2623b55762a7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94330 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-05-15Use symbolic JFW_FEATURE_ACCESSBRIDGEStephan Bergmann
(unclear why 43cc8abfb0a41878c4e78fd3b868b1d4f344c610 "#i20052# plugin lib for java framework" hadn't done so from the start, when 2b24c46035657a8a43c6552328f7b4dda1622ce5 "#i20052# java framework" had already introduced the macro) Change-Id: I7f83e5ee68300438bcf7b49bdd12512ca0cbea42 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94286 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-05-13The -Wclobbered hack appears to be needed for all versions of GCCStephan Bergmann
What apparently triggers it here is a combination of --enable-assert-always-abort --enable-optimized --enable-werror See <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95103> "Unexpected -Wclobbered in bits/vector.tcc with -O2" for a stripped-down reproducer. Change-Id: Ic2cff0e402290cd9fd67790168dc1183799e3f14 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94121 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-05-13gcc 10 also generates this clobber warningNoel Grandin
(specifically 10.1.1 is the version I have) Change-Id: I40fd720a9a75b809f24ca135c4ddb0ce61ecbe41 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94056 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-04-07loplugin:flatten in jvmfwkNoel Grandin
Change-Id: Ic58bc539ad6b4e1ef1d8049ec97547d1420be8a4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91817 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-04-07new loplugin:unusedvariableplusNoel Grandin
a particularly aggressive checker, which is why it is off by default Change-Id: Id5a0faa50b3ecc75e01f4aedc6579c5209e585da Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91643 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-03-27tdf#131399 Update java settings after slight java version changeilhan
Under linux, the version is now also checked for changes at startup of libreoffice. Change-Id: I572f718cf5afc83a70d98a6897f1d3d6877644f7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91037 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-01-25tdf#130137 Replace remaining uses of WNT define checks with _WIN32A_GAN
Change-Id: If95f1ea5a81de62eb4f725e5fcb30ccb8530062a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87372 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2019-12-19sal_Char->char in idlc..linguisticNoel Grandin
Change-Id: Ib30fe34123ad7e5d892e8db9c742e08c4ca8fcd2 Reviewed-on: https://gerrit.libreoffice.org/85477 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-12-16unused #includeStephan Bergmann
...after c0ac7ae73480cd2b01f24e88c01bee507e8638f9 "Remove JFW_PLUGIN_DO_NOT_CHECK_ACCESSIBILITY, JFW_PLUGIN_FORCE_ACCESSIBILITY" Change-Id: I359255127782efa061f1daa35e524fb414a0160c Reviewed-on: https://gerrit.libreoffice.org/85202 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-12-14Remove JFW_PLUGIN_DO_NOT_CHECK_ACCESSIBILITY, JFW_PLUGIN_FORCE_ACCESSIBILITYStephan Bergmann
JFW_PLUGIN_DO_NOT_CHECK_ACCESSIBILITY is no longer set anywhere since 6dcb3d4ef46312729bb6f16c473b433474863f68 "Related fdo#51252: No more prereg, no more unopkg sync" in 2012. JFW_PLUGIN_FORCE_ACCESSIBILITY had been introduced with 72b954df59d64fa47f6380e4322243401afb683f "Avoid using gconftool. Atk provides a11y not Java on Unix" in 2013, as a means for users on Unix-like systems to still force a JVM with a11y support, even though that should no longer be necessary for LO a11y. Both environment variables were documented as "unofficial", with the warning that the "may be removed in the future." Theoretically, they could still be set by some users, but the likelihood of their relevance today is considered low. Change-Id: Ib718fb275b67a6de7fd7bc88ae428fd60168f4f4 Reviewed-on: https://gerrit.libreoffice.org/85140 Reviewed-by: Michael Meeks <michael.meeks@collabora.com> Tested-by: Jenkins
2019-12-14Remove unused jvmfwk *rc filesStephan Bergmann
...and accompanying readme.txt. In the past, they got copied to "solver" and were used during the build. bf0e30f9cdee963d3cf889305c85b53c21b8c974 "jvmfwk: remove Package_*solver" stopped copying them. From jvmfwk3rc, the UNO_JAVA_JFW_ENV_JREHOME/CLASSPATH=true settings are found in OfficeConnection::setUp (unotest/source/cpp/officeconnection.cxx) and org.openoffice.test.OfficeConnection.setup (unotest/source/java/org/openoffice/test/OfficeConnection.java), used during tests. Setting UNO_JAVA_JFW_VENDOR_SETTINGS appears to not be necessary there (presumably because those UNO_JAVA_JFW_ENV_* settings override its use anyway?). The JFW_PLUGIN_DO_NOT_CHECK_ACCESSIBILITY=1 in sunjavapluginrc had been added as the fix for <https://bz.apache.org/ooo/show_bug.cgi?id=40879> "java framework: registration of Java components may fail", most of the relevant commit messages mention "#i40879# in build environment the JRE is not tested for accessibility, because of potential X server problems". There appears to be no replacement that still sets it in post "solver" times, presumably because that hack is just no longer relevant. Change-Id: I3028b2f69c00eed3c5d2103345773b8daac409a0 Reviewed-on: https://gerrit.libreoffice.org/85136 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-11-22Extend loplugin:external to warn about classesStephan Bergmann
...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-10-24Introduce OStringCharStephan Bergmann
...similar to OUStringChar, to be used in string concatenation expressions. And enable the corresponding loplugin:stringadd check, and fix its findings. Change-Id: I35ebb2253ba82bda6c98ae6ebd2ad4f27cf9abf9 Reviewed-on: https://gerrit.libreoffice.org/81456 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-10-17Remove some memset callsMike Kaganski
Replace them with default initialization or calloc Change-Id: I747f53c2ced2d0473fd5a5ede4f8520a0633dcc1 Reviewed-on: https://gerrit.libreoffice.org/80805 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-10-17Rename OUStringLiteral1 to OUStringCharStephan Bergmann
It started out as a wrapper around character literals, but has by now become a wrapper around arbitrary single characters. Besides updating the documentation, this change is a mechanical for i in $(git grep -Fl OUStringLiteral1); do sed -i -e s/OUStringLiteral1/OUStringChar/g "$i"; done Change-Id: I1b9eaa4b3fbc9025ce4a4bffea3db1c16188b76f Reviewed-on: https://gerrit.libreoffice.org/80892 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-08-12Fix typosAndrea Gelmini
Change-Id: Icdc486d64283961dad4a1d29ae662d66143f674b Reviewed-on: https://gerrit.libreoffice.org/77320 Reviewed-by: Julien Nabet <serval2412@yahoo.fr> Tested-by: Julien Nabet <serval2412@yahoo.fr>
2019-07-29Avoid memcpy nonnull issueStephan Bergmann
...as started to get reported by <https://ci.libreoffice.org/job/lo_ubsan/1341/> > /jvmfwk/plugins/sunmajor/pluginlib/util.cxx:368:33: runtime error: null pointer passed as argument 2, which is declared to never be null /usr/include/string.h:43:28: note: nonnull attribute specified here > #0 0x2b710cdb4e35 in jfw_plugin::AsynchReader::execute() /jvmfwk/plugins/sunmajor/pluginlib/util.cxx:368:13 > #1 0x2b70c87b8a27 in salhelper::Thread::run() /salhelper/source/thread.cxx:40:9 > #2 0x2b70c87bac9f in threadFunc /include/osl/thread.hxx:185:15 > #3 0x2b70ba8bb89d in osl_thread_start_Impl(void*) /sal/osl/unx/thread.cxx:235:9 > #4 0x2b70bc47fdd4 in start_thread (/lib64/libpthread.so.0+0x7dd4) > #5 0x2b70bcdb4eac in clone (/lib64/libc.so.6+0xfdeac) during UITest_calc_tests6 Change-Id: I6505061192a8d6b9a68d72980fd134d161e5e1a3 Reviewed-on: https://gerrit.libreoffice.org/76516 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-06-17simplify codeStephan Bergmann
...following up on b70ab9e9e5630a965c5e6cc40c2480dddf1e2384 "Fix swapping of vector elements" Change-Id: Ib67b43345fa808bc25dff5aff11b387bb3455464 Reviewed-on: https://gerrit.libreoffice.org/74173 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-06-11Fix swapping of vector elementsStephan Bergmann
...which had been broken with edc85fb55f8adc30a1416c6c854c89097060fb21 "clang-tidy performance-unnecessary-copy-init in idl..reportdesign" (and could cause "Tools - Options... - LibreOffice - Advanced - Java Options" to erroneously list a single JRE multiple times, instead of listing different JREs). Change-Id: I6799903be39a5c6aa601131fad6eab3edea8d9e4 Reviewed-on: https://gerrit.libreoffice.org/73679 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>