summaryrefslogtreecommitdiff
path: root/sal
AgeCommit message (Collapse)AuthorFilesLines
2020-03-11Get rid of some SAL_MATH_FINITE useStephan Bergmann1-4/+2
Change-Id: I850efb6215c95d356d42e19e639c578c377d1507 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90316 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-03-04ofz#21036: Avoid UBSan signed-integer-overflow in external/dtoaStephan Bergmann1-0/+5
> workdir/UnpackedTarball/dtoa/src/dtoa.c:3624:12: runtime error: signed integer overflow: 10 * 858993459 cannot be represented in type 'int' > #0 in strtod_nolocale at workdir/UnpackedTarball/dtoa/src/dtoa.c:3624:12 (instdir/program/libuno_sal.so.3 +0x55286d) > #1 in double (anonymous namespace)::stringToDouble<char16_t>(char16_t const*, char16_t const*, char16_t, char16_t, rtl_math_ConversionStatus*, char16_t const**) at sal/rtl/math.cxx:976:20 (instdir/program/libuno_sal.so.3 +0x3b5f0e) > #2 in rtl_math_uStringToDouble at sal/rtl/math.cxx:1028:12 (instdir/program/libuno_sal.so.3 +0x3b1714) [...] Change-Id: If24fca1fb4829ddd763c9920a1af9a90dc2b138c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89966 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-02-27avoid memory leak in win32 sal::backtrace_get()Luboš Luňák2-63/+14
Running a presentation with OpenGL transitions with Skia+Vulkan as the VCL drawing very quickly runs out of memory in dbgutil builds. The trigger is svl/source/notify/lstner.cxx calling sal::backtrace_get() quite often. And that function calls SymInitialize() repeatedly even though its docs say not to do it, and that is also actually not necessary for CaptureStackBackTrace(), only for the symbol resolving Sym* functions. It actually still eventually aborts if called often enough, but this way it is triggered only by printing the backtrace and not just getting it. I have no idea why the problem is triggered only in these rather specific circumstances, e.g. Skia+raster seems to be fine. Also avoid the needless copy&paste while I'm at it. Change-Id: I50f9e0689b9b9b10bf54308db654aed6433085db Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89626 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2020-02-27Related: tdf#130725: use strtod also in rtl::math::stringToDoubleMike Kaganski3-132/+105
Size of buffer on stack is 256 characters. Logging function usage in make check, of >1 100 000 invocations, the longest string was 80 characters, average being 4.6 characters. So heap allocation is unlikely in scenarios with intensive function usage. Several existing unit tests had to be fixed. Usually, the change is either minimal or getting closer to what Excel returns (for Calc tests). But in case of AMORDEGRC, I had to change rate value passed to the function from 0.3 to 0.31. It's because the closest double value for 0.3 is 0.29999999999999999, which is a bit less than 0.3; multiplied by 1.5, this gives 0.44999999999999996, and then rounding the result of multiplication of the latter by cost gave the result 1 less than before, when 0.3 was imported as 0.30000000000000004. Now the function returns a value 1 less than Excel for that set of arguments. I don't see how to fix that. Having rate slightly different gives consistent result between Calc and Excel. Change-Id: Icae5ce374fe0c31a1aa10cee815e65ef0014f382 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89422 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2020-02-12clang-analyzer-deadcode.DeadStoresNoel Grandin1-1/+1
Change-Id: Ifa384933569b27d0d08eb479bb95b799163ae386 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88450 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-02-03loplugin:unsignedcompare (clang-cl)Stephan Bergmann1-1/+2
Change-Id: I69cc1b352221ca053ccd0c5b78e926480a8c9ccd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87884 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-02-03Remove unnecessary castStephan Bergmann1-1/+1
Change-Id: I675d9e0a87a54eb08abfca114864369b326fb128 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87882 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-02-01make update_pch also consider files in <module>/src/**/incLuboš Luňák1-1/+2
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-31clang-tidy modernize-concat-nested-namespaceNoel Grandin13-27/+25
Change-Id: Iab35a8b85b3ba1df791c774f40b037f9420a071a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86708 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-01-28loplugin:unsignedcompare (--enable-cipher-openssl-backend)Stephan Bergmann1-4/+5
Change-Id: Iab5ab11059437a595596e8ba3ec7aa45cec15f0d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87617 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-01-28tdf#96505: Get rid of cargo cult long integer literalsOnur Yilmaz2-4/+4
I checked return values. Long variables didn't affect the calculation. Change-Id: Ia3713eedf275de71b1096d1fe7e22da012a7f94e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87493 Reviewed-by: Stephan Bergmann <sbergman@redhat.com> Tested-by: Stephan Bergmann <sbergman@redhat.com>
2020-01-28New loplugin:unsignedcompareStephan Bergmann5-9/+14
"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-27Use Linux gettid as available since glibc 2.30Stephan Bergmann1-3/+14
Change-Id: I793f91a1fe601cff367be7c178f4e712f0f97117 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87488 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-01-26tdf#124176: Use pragma once instead of include guardsBurak Bala1-4/+1
Change-Id: Ib2465f040f12413560b2cec1c742cf3558461309 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87404 Tested-by: Jenkins Reviewed-by: Muhammet Kara <muhammet.kara@collabora.com>
2020-01-26cppcheck: shadowFunction in sal/file_urlJulien Nabet1-6/+6
Change-Id: I7454640278f4af0f71f429b45c9f1e40f7be0545 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87433 Reviewed-by: Julien Nabet <serval2412@yahoo.fr> Tested-by: Julien Nabet <serval2412@yahoo.fr>
2020-01-26cppcheck: shadowFunction in sal/osl_FileJulien Nabet1-4/+4
Change-Id: I7d264faad080428459e499c786f25b3e06a6700b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87434 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-01-25tdf#124176: Use pragma once instead of include guardsiakarsu1-5/+1
Change-Id: Ibf31d5b97017f875e62b609beef0ecdebd559502 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87391 Tested-by: Jenkins Reviewed-by: Muhammet Kara <muhammet.kara@collabora.com>
2020-01-25Change some #define to constexprStephan Bergmann1-7/+7
...plus loplugin:unnecessaryparen fallout in sw/source/uibase/docvw/edtwin.cxx. Each of the files contained at least one #define that would have caused warnings with upcoming loplugin:unsignedcompare. For consistency, I changed all #defines in those files (using a variable of a specific type if the original #define used a cast to that type, otherwise using 'auto'). Change-Id: I66f71b2d83394c9dc6952ae19df774cdd4d0b76a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87374 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-01-18Removed redundant semicolonAndrea Gelmini1-1/+1
Change-Id: Ice0c5f413f176ce6eb832dc8b06010595f214857 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86582 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-01-15Clean up safeRead/WriteStephan Bergmann2-15/+27
...using more appropriate parameter types, replacing cheesy OSL_ASSERT overflow checks with cap_ssize_t, and replacing one remaining good OSL_ASSERT in safeWrite with assert. Change-Id: I6105ba5135216333e68003458be7ca28f1715a51 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86807 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-01-08Grammar fixesAndrea Gelmini1-1/+1
Change-Id: I6ac6f6abb601aa254e94612e6826488393de8e3c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86383 Tested-by: Jenkins Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
2020-01-03android: file-cache to improve performance.Michael Meeks1-33/+120
The transition to java - interestingly to free the passed buffer was showing on profiles. Also cleanup the /assets// handling a little. Change-Id: Id1f4f6e60896c3f42fcbf761e535b68318e0a0a2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86169 Reviewed-by: Michael Meeks <michael.meeks@collabora.com> Tested-by: Michael Meeks <michael.meeks@collabora.com>
2019-12-27Fix typoAndrea Gelmini1-1/+1
Change-Id: Ibd3ece30c6cbb9582904adc5e329f54d41cff33b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/85872 Reviewed-by: Julien Nabet <serval2412@yahoo.fr> Tested-by: Julien Nabet <serval2412@yahoo.fr>
2019-12-27sal_osl_security: Windows: Handle cases with same hostname and usernameMike Kaganski1-1/+13
... as seen in [build CUT] sal_osl_security #Initializing ... # #logonUser function need root/Administrator account to test. #You can test by login with root/Administrator, and execute: #testshl2 -forward "username password" ../../../wntmsci9/bin/Security.dll # where username and password are forwarded account info. #if no text forwarded, this function will be skipped. # #Retrieved system information is below: Computer Name: SOMENAME Current User Name: Somename Current User Home Directory:file:///C:/Users/Somename/Documents Current Config Directory: file:///C:/Users/Somename/AppData/Roaming Current UserID: S-1-5-21-1234567890-123456789-123456789 Current User is: NOT Administrator. # #Initialization Done. osl_Security::ctors::ctors_001 finished in: 0ms osl_Security::UserProfile::loadUserProfile finished in: 0ms osl_Security::UserProfile::unloadUserProfile finished in: 0ms osl_Security::getHandle::getHandle_001 finished in: 0ms osl_Security::loginUserOnFileServer::loginUserOnFileServer_001 finished in: 3ms osl_Security::getConfigDir::getConfigDir_001 finished in: 1ms C:/cygwin/home/Somename/lode/dev/core/sal/qa/osl/security/osl_Security.cxx:139:osl_Security::getUserIdent::getUserIdent_001 equality assertion failed - Expected: S-1-5-21-1234567890-123456789-123456789 - Actual : S-1-5-21-1234567890-123456789-123456789-1001 - strUserID: S-1-5-21-1234567890-123456789-123456789, strID: S-1-5-21-1234567890-123456789-123456789-1001, bRes: true osl_Security::getUserIdent::getUserIdent_001 finished in: 0ms osl_Security::getUserName::getUserName_001 finished in: 1ms osl_Security::isAdministrator::isAdministrator_001 finished in: 0ms C:/cygwin/home/Somename/lode/dev/core/sal/qa/osl/security/osl_Security.cxx(139) : error : Assertion Test name: osl_Security::getUserIdent::getUserIdent_001 equality assertion failed - Expected: S-1-5-21-1234567890-123456789-123456789 - Actual : S-1-5-21-1234567890-123456789-123456789-1001 - strUserID: S-1-5-21-1234567890-123456789-123456789, strID: S-1-5-21-1234567890-123456789-123456789-1001, bRes: true Failures !!! Run: 9 Failure total: 1 Failures: 1 Errors: 0 The problem here is that passing a string equal to hostname (case-insensitive) to LookupAccountNameW without domain qualifier returns data for local system domain, not for user with the same name. So let's try again, this time with fully-qualified user name including local domain part. Change-Id: I15f69c01dddf15782bd11a6ed6678f0a02d79786 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/85859 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2019-12-19sal_Char->char in remotebridges..saxNoel Grandin42-540/+540
Change-Id: I6d32942960a5e997f16eb1301c45495661cd4cea Reviewed-on: https://gerrit.libreoffice.org/85514 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-12-11Fix typoAndrea Gelmini1-1/+1
Change-Id: Idbcf73ea3034b62e283537e052c17a9fb3988a8b Reviewed-on: https://gerrit.libreoffice.org/84918 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2019-12-10use scoped enumStephan Bergmann1-30/+38
Change-Id: I70831ca727dbfca2ea77109e119aac9a110ccf45 Reviewed-on: https://gerrit.libreoffice.org/84858 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-12-10loplugin:unusedmember (clang-cl)Stephan Bergmann1-13/+0
(i.e., all members of the typedef'ed struct oslPipeBuffer are unused because the typedef'ed struct itself is unused ever since at least 9399c662f36c385b0c705eb34e636a9aec450282 "initial import") Change-Id: If14ea3b0a1c0bc02b6949fead17513cda8107601 Reviewed-on: https://gerrit.libreoffice.org/84859 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-12-06Remove spurious #includeStephan Bergmann1-1/+0
...that had been added by accident with 55e596956e56b175ab17b682e7c8ac7daeb9289a "loplugin:external (clang-cl)" Change-Id: Ieff93c825632d68adb621d8f646ff8abb72b5452 Reviewed-on: https://gerrit.libreoffice.org/84599 Reviewed-by: Stephan Bergmann <sbergman@redhat.com> Tested-by: Stephan Bergmann <sbergman@redhat.com>
2019-12-05loplugin:external (clang-cl)Stephan Bergmann11-7/+54
...plus loplugin:consttobool and loplugin:fakebool fallout Change-Id: Ie3d8121815c080b13bea6d9deca1eb138ca56138 Reviewed-on: https://gerrit.libreoffice.org/84515 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-12-05Fix various clang-cl and loplugin warnings in sal/qa/osl/file/osl_File.cxxStephan Bergmann1-39/+30
...after that file got re-enabled for Windows builds recently Change-Id: I67c9e1676344d3754293595ec5a3c6093c0959c1 Reviewed-on: https://gerrit.libreoffice.org/84510 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 Bergmann4-0/+7
<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-03SAL_INFO_IF -> SAL_WARN_IFNoel Grandin1-1/+1
this is a very very useful warning when libraries fail to load Change-Id: I09bf64f6c65f285d6ab41f988b255a4842233428 Reviewed-on: https://gerrit.libreoffice.org/84314 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-12-03use scoped enumStephan Bergmann1-31/+38
Change-Id: Id28d593d94fc176194871db32c1c5a287b98a26a Reviewed-on: https://gerrit.libreoffice.org/84319 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-12-03WIN map ERROR_DIRECTORY to osl_File_E_NOTDIRJan-Marek Glogowski2-3/+1
The open_004 unit test fails on Windows with E_NOENT. I think the assert is correct, and it's better change the ERROR_DIRECTORY mapping, as FindFirstFileW returns ERROR_PATH_NOT_FOUND, if the path doesn't exists at all. The description of that error code in the MS API docs is "The directory name is invalid.". And obviously there is no way to tell, if this is actually a better mapping. Change-Id: Id122ce39e90f3562e70c96a06752e5b32ed55b41 Reviewed-on: https://gerrit.libreoffice.org/84070 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
2019-12-03WIN enable osl_File.cxx part of CppUnitTest_sal_oslJan-Marek Glogowski3-37/+60
This just disables open::open_004 test on Windows, as this returns E_NOENT on Windows, but I think the assert is correct. There is also test-getsystempathfromfileurl.cxx, which seems to overlap? The test now uses osl::FileBase::getTempDirURL to find the system temporary directory, insted of hardcoded defaults. This also includes reverts the following commits: * "remove unused Exist from oslCheckMode enum" commit 4ca9e8fa3a040c18221c947a651469a89029282e. * "CppunitTest_sal_osl_file fails on Windows" commit 4603028bc4e2cdacd32da073a82a42ba1fc549a8 Change-Id: Ib7fc4c13f8159a240d4e20c26f61d84204e4261b Reviewed-on: https://gerrit.libreoffice.org/83901 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
2019-12-02android: Get rid of the 'old' vs. Online-based runtime distinction.Jan Holesovsky1-5/+0
No need for this when we have a compile-time distinction now anyway. Change-Id: Ic86c8cce38a86635ea3efb4229c08f63059c9ee6 Reviewed-on: https://gerrit.libreoffice.org/83719 Reviewed-by: Jan Holesovsky <kendy@collabora.com> Tested-by: Jenkins
2019-12-02android: Hint how to enable fontconfig logging.Jan Holesovsky1-0/+3
Change-Id: I8901780fa29c6d27bb53e44b07d95259b5bd02df Reviewed-on: https://gerrit.libreoffice.org/83920 Reviewed-by: Jan Holesovsky <kendy@collabora.com> Tested-by: Jan Holesovsky <kendy@collabora.com> (cherry picked from commit f3af7708e3535d3171832aa2308d1e7f6193def4) Reviewed-on: https://gerrit.libreoffice.org/84189 Tested-by: Jenkins
2019-11-29WIN enable NoAuthority testJan-Marek Glogowski1-2/+0
Change-Id: I5e8214efbf32a5bc43f002ef244826b9b899c692 Reviewed-on: https://gerrit.libreoffice.org/84071 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
2019-11-27WIN accept single-backslash file URIsJan-Marek Glogowski1-4/+6
From all I could find, a single (back-)slash file URI is fine as a local file path. Change-Id: I75e95c809894cdef88f708d0477cb98eb114a107 Reviewed-on: https://gerrit.libreoffice.org/83837 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
2019-11-27Fix some checkUNXBehaviour_getSystemPathFromFileURL testsStephan Bergmann1-8/+3
Change-Id: I362d277d3ad2b2604107ddb6928c76ebec94efc3 Reviewed-on: https://gerrit.libreoffice.org/83868 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-11-27Hide parts of sal/osl/unx/thread.cxx only used by !NO_PTHREAD_PRIORITYStephan Bergmann1-0/+9
(to silence upcoming loplugin:unusedmember) Change-Id: I86e340e6ade043e020609f0f4da58ba94be6ab1b Reviewed-on: https://gerrit.libreoffice.org/83817 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-11-26loplugin:external (clang-cl)Stephan Bergmann2-0/+8
Change-Id: Iab2231e90e55c7e583a2fafd08469ee01b02ce82 Reviewed-on: https://gerrit.libreoffice.org/83767 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-11-26loplugin:consttobool (clang-cl)Stephan Bergmann3-18/+18
Change-Id: I81fea38cd737a8be74e6ece333ca37cc434a1c33 Reviewed-on: https://gerrit.libreoffice.org/83765 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-11-26cid#706206 Time of check time of useCaolán McNamara1-0/+1
add attribute markup Change-Id: I8d70513ae3e7abf80368016343f69060f197eae0 Reviewed-on: https://gerrit.libreoffice.org/83586 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2019-11-24cppcheck: performing init in init list (oox, package, sal, sax)Julien Nabet3-6/+4
Change-Id: I77e28f02516ab25ff6680970dc13d52cfa90eac1 Reviewed-on: https://gerrit.libreoffice.org/83620 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2019-11-22Extend loplugin:external to warn about classesStephan Bergmann31-11/+207
...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-20ofz#19010 wrong start of rangeCaolán McNamara1-1/+1
Change-Id: Ibf97a830932d3f153b99031abc8c4a00b54cedab Reviewed-on: https://gerrit.libreoffice.org/83265 Reviewed-by: Stephan Bergmann <sbergman@redhat.com> Tested-by: Jenkins
2019-11-19loplugin:fakebool (clang-cl)Stephan Bergmann7-32/+32
...plus follow-up loplugin:implicitboolconversion and loplugin:redundantcast Change-Id: I9fc9c5cb46fbb50da87ff80af64cb0dfda3e5f90 Reviewed-on: https://gerrit.libreoffice.org/83207 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-11-19loplugin:fakebool (clang-cl)Stephan Bergmann1-3/+3
(the use of `BOOL gotACP` in osl_getThreadTextEncoding was already safe in the past, converting from 16-bit HIWORD to 32-bit BOOL and then using operator!) Change-Id: Ic5019093b350b968edfcf0878126671285891502 Reviewed-on: https://gerrit.libreoffice.org/83210 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>