Commit graph

248 commits

Author SHA1 Message Date
Stephan Bergmann
9ad252b2e7 Drop o3tl::optional wrapper
...now that macOS builds are guaranteed to have std::optional since
358146bbbd "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-21 14:50:28 +01:00
Cumali Toprak
4b5ad13fb0 tdf#124176: Use pragma once instead of include guards
Change-Id: I422ff363d3abf6b722d584ded3a1d8466cec35a7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87511
Tested-by: Jenkins
Reviewed-by: Muhammet Kara <muhammet.kara@collabora.com>
2020-01-27 21:28:46 +01:00
Noel Grandin
e73b99b8dd loplugin:finalclasses in i18npool..linguistic
Change-Id: Ib903fb2fdb4c4c25f73053065b828dade8b63785
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86687
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-01-14 07:12:31 +01:00
Noel Grandin
c1a4554c67 sal_Char->char in idlc..linguistic
Change-Id: Ib30fe34123ad7e5d892e8db9c742e08c4ca8fcd2
Reviewed-on: https://gerrit.libreoffice.org/85477
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-12-19 09:56:51 +01:00
Stephan Bergmann
7e403195e5 Introduce o3tl::optional as an alias for std::optional
...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
fed7c3deb3 "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-12-01 14:57:16 +01:00
Noel Grandin
9b5dad13b5 loplugin:stringadd look for unnecessary temporaries
which defeat the *StringConcat optimisation.
Also make StringConcat conversions treat a nullptr as an empty string,
to match the O*String(char*) constructors.

Change-Id: If45f5b4b6a535c97bfeeacd9ec472a7603a52e5b
Reviewed-on: https://gerrit.libreoffice.org/80724
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-10-14 08:26:14 +02:00
Andrea Gelmini
0940229305 Fix '..'
To complete this:
https://gerrit.libreoffice.org/#/c/78312/

This is a massive replace for lines ending with
".." instead of "..."

It passed "make check" on Linux.

Change-Id: I07fa7b2e30ba9ea17a1f9a5e21c57216ba958efe
Reviewed-on: https://gerrit.libreoffice.org/78356
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Jenkins
2019-09-01 11:15:11 +02:00
Andrea Gelmini
645d11d8ef Fix typo
Change-Id: I0efc8f2d50e825878bc41d7eca055095a9308fce
Reviewed-on: https://gerrit.libreoffice.org/74669
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Julien Nabet <serval2412@yahoo.fr>
2019-06-25 07:09:37 +02:00
Andrea Gelmini
626ba95a95 Fix typo
Change-Id: I07f236ce2f90d05d971f8cf208a4cc62062b8a54
Reviewed-on: https://gerrit.libreoffice.org/74670
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Julien Nabet <serval2412@yahoo.fr>
2019-06-25 06:34:57 +02:00
Noel Grandin
48f2d4e580 loplugin:unusedfields in helpcompiler..jvmfwk
Change-Id: Ic10c521de310e0f0ac1f79a1ae169252c20075b2
Reviewed-on: https://gerrit.libreoffice.org/68226
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-02-24 09:48:16 +01:00
Noel Grandin
03fcb4aae6 idlc: no need to store single OString objects on the heap
Change-Id: I26586ed643d34690b56e40691df9b493a34afa16
Reviewed-on: https://gerrit.libreoffice.org/65536
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-12-22 08:16:55 +01:00
Noel Grandin
38a98c2999 loplugin:simplifyconstruct in helpcompiler..io
Change-Id: Ibdc1933b5d8d6be1fe42a7df93bd7e1c903bb39b
Reviewed-on: https://gerrit.libreoffice.org/60202
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-09-09 08:18:01 +02:00
Noel Grandin
cb2c7428f6 use std::vector in AstStack
instead of a hand-coded equivalent. Note that I can't use
std::unique_ptr, because the parsing code appears to just randomly leak
AstScope

Change-Id: Idc56dfe1f084db55c9d5a7558ac44ddab53b98e3
Reviewed-on: https://gerrit.libreoffice.org/59771
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-08-30 08:30:17 +02:00
Noel Grandin
5053b8cd3f loplugin:useuniqueptr in AstStruct
Change-Id: Ib7416235e41192323e74061bfce6c162e87612f2
Reviewed-on: https://gerrit.libreoffice.org/51736
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-03-23 07:25:01 +01:00
Mike Kaganski
e9073eadef idlc: MSVC: pragma warning: make more specific, remove obsolete
Change-Id: I0fbba0c1b12f9ade703ceee477dae4056fe9d31e
Reviewed-on: https://gerrit.libreoffice.org/48994
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2018-02-01 17:57:21 +01:00
Noel Grandin
be8c414567 loplugin:unusedmethods also check for functions returning bool
we were previously excluding them

Change-Id: I48a68799b0de60b4995fae541eb363e043d4dd11
Reviewed-on: https://gerrit.libreoffice.org/48167
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-01-19 13:26:27 +01:00
Noel Grandin
6ae487db5a fix use of std::unique_ptr in Idlc
I removed the deletes in the destructor in

    commit b27fee9e0e
    Date:   Wed Jan 10 11:44:28 2018 +0200
    loplugin:useuniqueptr cppu,idlc,io,ucbhelper

but forgot to do the actual conversion

Change-Id: Icb03070e1d8a2b10ccf892f01e9b44cc6bf0156f
2018-01-17 15:15:28 +02:00
Noel Grandin
37464a0fb7 loplugin:useuniqueptr in idlc
Change-Id: Iccc50462ca115546422824b6814abf16a029f005
Reviewed-on: https://gerrit.libreoffice.org/47793
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-01-13 11:20:05 +01:00
Stephan Bergmann
57bbe564ba More loplugin:cstylecast: idlc
auto-rewrite with <https://gerrit.libreoffice.org/#/c/47798/> "Enable
loplugin:cstylecast for some more cases" plus
solenv/clang-format/reformat-formatted-files

Change-Id: I1cb9e69b8138cb5bb63f18231018f166b67b3072
2018-01-12 20:21:57 +01:00
Noel Grandin
b27fee9e0e loplugin:useuniqueptr cppu,idlc,io,ucbhelper
Change-Id: I6d8c24fabd52b39c66ce0b88b547df7ec85dad76
Reviewed-on: https://gerrit.libreoffice.org/47725
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-01-11 07:37:16 +01:00
Noel Grandin
3af500580b loplugin:salcall fix functions
since cdecl is the default calling convention on Windows for
such functions, the annotation is redundant.

Change-Id: I1a85fa27e5ac65ce0e04a19bde74c90800ffaa2d
Reviewed-on: https://gerrit.libreoffice.org/46164
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-12-11 12:13:46 +01:00
Noel Grandin
455e4011f7 improve constparam loplugin
lots of little fixes to make the logic less pessimistic

Change-Id: If368822984250b11b98c56f5890177a1402e8660
Reviewed-on: https://gerrit.libreoffice.org/44168
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-11-02 10:45:01 +01:00
Stephan Bergmann
f3698af7cc loplugin:includeform: idlc
Change-Id: Ia32beed408de33fbe8ed59ddcab5b01ddc3b8218
2017-10-23 22:46:05 +02:00
Noel Grandin
2559a2a056 loplugin:constmethod in cppu,cppuhelper,idlc
Change-Id: I9138b7e5d53c30488f99e9f9b9fe3f98c8d6858b
Reviewed-on: https://gerrit.libreoffice.org/43583
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-10-23 08:15:50 +02:00
Noel Grandin
87a9979c89 overload std::hash for OUString and OString
no need to explicitly specify it anymore

Change-Id: I6ad9259cce77201fdd75152533f5151aae83e9ec
Reviewed-on: https://gerrit.libreoffice.org/43567
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-10-23 08:15:35 +02:00
Noel Grandin
8ef6be7332 loplugin:constparams in sw part6
Change-Id: Ic82946cf9be50d9d9c43338b86dfb700ce5b354c
Reviewed-on: https://gerrit.libreoffice.org/40786
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-08-06 20:13:53 +02:00
Noel Grandin
41dc56df37 loplugin:constparams codemaker,idl,idlc
Change-Id: Ic72b7525cfbfbd3c5afb12fe9ea814176e6c8c9d
Reviewed-on: https://gerrit.libreoffice.org/40126
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-07-18 13:27:45 +02:00
Noel Grandin
db3860062e extend loplugin useuniqueptr to OUString pointers
Change-Id: Ieb5bab3895e1edaff497c4a1a88303ccac097edc
Reviewed-on: https://gerrit.libreoffice.org/39948
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-07-17 07:23:22 +02:00
Stephan Bergmann
c52cd532b6 Fix lifecycle issue
...as shown by ASan/UBSan build use-after-free report at
<https://ci.libreoffice.org/job/lo_ubsan/602/> after
8e39ef6692 "extend loplugin useuniqueptr to POD
types"

Change-Id: Ic42e408c2c4b2901cdf5d681b332543ec8f445ef
2017-07-16 21:22:13 +02:00
Noel Grandin
8e39ef6692 extend loplugin useuniqueptr to POD types
Change-Id: I6ff24f048bd8f75bf87a78b718f37b57855d4781
Reviewed-on: https://gerrit.libreoffice.org/39932
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-07-14 10:13:46 +02:00
Noel Grandin
6bbda13286 loplugin:unusedfields in forms..idlc
Change-Id: If250ff47c1f375fe24c61b5bf271da9a9c330822
Reviewed-on: https://gerrit.libreoffice.org/39133
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-06-23 08:59:56 +02:00
Stephan Bergmann
6cb9e6dad7 Remove redundant 'inline' keyword
...from function definitions occurring within class definitions.  Done with
a rewriting Clang plugin (to be pushed later).

Change-Id: I9c6f2818a57ccdb361548895a7743107cbacdff8
Reviewed-on: https://gerrit.libreoffice.org/34874
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-03-03 20:55:50 +00:00
Stephan Bergmann
e972d6bb36 Idlc::m_pErrorHandler is unused
Change-Id: I41fea5e08381e21dff12f61142a4d54f07a502f4
2017-02-21 07:37:08 +01:00
Noel Grandin
a6a46aad51 convert ExprComb to scoped enum
and drop unused EC_bit_neg enumerator

Change-Id: I8a93310cd849cee56fcf628424d96005f89ba799
2017-02-16 12:42:04 +02:00
Noel Grandin
d00431fd36 convert ErrorCode to scoped enum
and drop unused enumerators

Change-Id: I7330ebf8feead7b67e67f73ba942979e4756269d
2017-02-16 12:42:04 +02:00
Noel Grandin
9651424f73 convert WarningCode to scoped enum
and drop unused enumerators

Change-Id: I212cf132c2406e85b44b1af552b0989cecbec162
2017-02-16 12:42:04 +02:00
Noel Grandin
63e0ffab01 remove unused PS_OpCompleted from ParseState enum
Change-Id: I3a738e464051d0b810553bc62c8465d37505bc3c
2017-02-16 12:42:04 +02:00
Stephan Bergmann
e57ca02849 Remove dynamic exception specifications
...(for now, from LIBO_INTERNAL_CODE only).  See the mail thread starting at
<https://lists.freedesktop.org/archives/libreoffice/2017-January/076665.html>
"Dynamic Exception Specifications" for details.

Most changes have been done automatically by the rewriting loplugin:dynexcspec
(after enabling the rewriting mode, to be committed shortly).  The way it only
removes exception specs from declarations if it also sees a definition, it
identified some dead declarations-w/o-definitions (that have been removed
manually) and some cases where a definition appeared in multiple include files
(which have also been cleaned up manually).  There's also been cases of macro
paramters (that were used to abstract over exception specs) that have become
unused now (and been removed).

Furthermore, some code needed to be cleaned up manually
(avmedia/source/quicktime/ and connectivity/source/drivers/kab/), as I had no
configurations available that would actually build that code.  Missing @throws
documentation has not been applied in such manual clean-up.

Change-Id: I3408691256c9b0c12bc5332de976743626e13960
Reviewed-on: https://gerrit.libreoffice.org/33574
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-01-26 12:54:43 +00:00
Stephan Bergmann
700470577f Remove junk
left over from 232c0fb700 "#115784# idlc: fixed
commandline option processing."

Change-Id: I41f81b1223cf72c0fcf8e84cdc7016e3aebf0c9d
2017-01-25 17:59:34 +01:00
Noel Grandin
b4adb0c533 loplugin: unnecessary destructor forms..idlc
Change-Id: I765e0fa61f8134a60e5ea24452c6bbcb3fa8b054
Reviewed-on: https://gerrit.libreoffice.org/33492
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-01-25 05:20:06 +00:00
Stephan Bergmann
2131bf4ebd New loplugin:dynexcspec: Add @throws documentation, idlc
Change-Id: I3c269d84906cc49d79d5f32f0dd3f15afd2f588e
2017-01-19 18:03:19 +01:00
Noel Grandin
1a743fd8a2 loplugin:expandablemethods in hwpfilter..linguistic
Change-Id: I62ae20ab4a47b3b7e2b0d503cedcad3319cc9c85
Reviewed-on: https://gerrit.libreoffice.org/30683
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2016-11-08 08:41:38 +00:00
Noel Grandin
990102be61 loplugin:unnecessaryvirtual in hwpfilter..rsc
Change-Id: I2e9df8223d503b813b4c458747e8c44bb8ef8868
Reviewed-on: https://gerrit.libreoffice.org/30661
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2016-11-08 06:10:25 +00:00
Noel Grandin
877774c057 loplugin:expandablemethodds in hwpfilter..linguistic
Change-Id: If20fd4a6cf8a8e005804dbb7caf41cce73d587a5
Reviewed-on: https://gerrit.libreoffice.org/30016
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2016-10-19 08:07:18 +00:00
Asela Dasanayaka
4f0f1b6b55 tdf#96099 Reduce no of typedefs used for trivial containers
Removed various pinter typedefs in idlc module

Change-Id: Id850558a4550085d47a5e1122b1ce871f15956f2
Reviewed-on: https://gerrit.libreoffice.org/29754
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2016-10-13 10:15:52 +00:00
Stephan Bergmann
f8ecdb7619 Simplify AstExpression::compare
...to only work with LONG values, as it is only used to compare enumerator
values.  (But keep its general defensive-programming air that's so prevalent
across the idlc code base; not sure whether it could rightfully be tightened, or
whether this might be needed in parser's error recovery.)

Change-Id: I15f1700834f9397f3c2e0ffdb00e2abeecb734f9
2016-10-06 16:36:26 +02:00
Caolán McNamara
dd691312a3 we shouldn't need explicit lt_rtl_OUString, etc things anymore
Change-Id: Ibeec3fcc353e07e61fb2c838b318e0a04081ce2c
2016-09-24 12:15:13 +01:00
Noel Grandin
1658bd231b loplugin:unusedenumvalues
Change-Id: I9dcc9f73af6db5b4f7cc946bc28931e5c230b34c
Reviewed-on: https://gerrit.libreoffice.org/29012
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2016-09-19 10:44:05 +00:00
Stephan Bergmann
91dd2db17b loplugin:override: No more need for the "MSVC dtor override" workaround
The issue of 362d4f0cd4 "Explicitly mark
overriding destructors as 'virtual'" appears to no longer be a problem with
MSVC 2013.

(The little change in the rewriting code of compilerplugins/clang/override.cxx
was necessary to prevent an endless loop when adding "override" to

  OOO_DLLPUBLIC_CHARTTOOLS    virtual ~CloseableLifeTimeManager();

in chart2/source/inc/LifeTime.hxx, getting stuck in the leading
OOO_DLLPUBLIC_CHARTTOOLS macro.  Can't remember what that
isAtEndOfImmediateMacroExpansion thing was originally necessary for, anyway.)

Change-Id: I534c634504d7216b9bb632c2775c04eaf27e927e
2016-09-13 13:19:22 +02:00
Noel Grandin
8806a86c9d loplugin:unusedenumconstants in forms..sot
Change-Id: Ic445e1bdd012c32ef7d84aec9df908467c3296a7
Reviewed-on: https://gerrit.libreoffice.org/28055
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
2016-08-12 06:53:29 +00:00