2343 Commits

Author SHA1 Message Date
Jan-Marek Glogowski
852a0f9cd8 Rename GlyphCache to FreetypeManager
And while at it remove the unneeded getPlatformGlyphCache
abstraction.

Change-Id: Id5cad751eda9e6bf177dfb4816280d7c5af7066a
Reviewed-on: https://gerrit.libreoffice.org/83125
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
2019-11-19 03:14:45 +01:00
Stephan Bergmann
d7643c6a70 Missing includes
...with recent Clang trunk

Change-Id: I9ea0f1692df8d269356df0d6b20ea2173f632425
Reviewed-on: https://gerrit.libreoffice.org/83086
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-11-18 17:29:17 +01:00
Chris Sherlock
729883cc42 compilerplugins: fix ambiguous type warnings
Errors were:

/home/chris/repos/libreoffice-latest/compilerplugins/clang/sharedvisitor/analyzer.cxx:80:40: error: reference to 'PointerType' is ambiguous
        if (auto const t = type->getAs<PointerType>())

/home/chris/repos/libreoffice-latest/compilerplugins/clang/external.cxx:61:44: error: reference to 'PointerType' is ambiguous
        else if (auto const t3 = t1->getAs<PointerType>())

Change-Id: Ia5b7add8f2b3160fa3198ed127785bdd61c74796
Reviewed-on: https://gerrit.libreoffice.org/83030
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2019-11-18 13:56:08 +01:00
Andrea Gelmini
4e053538db Fix typos
Change-Id: I9251205c47f26be7695496b5887b849fcf1335f1
Reviewed-on: https://gerrit.libreoffice.org/82814
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Julien Nabet <serval2412@yahoo.fr>
2019-11-17 08:32:34 +01:00
Noel Grandin
f10b43f9d1 loplugin:unusedmethods
Change-Id: I04deb5a1dee5b8a9a4508d28552ffe0b67288993
Reviewed-on: https://gerrit.libreoffice.org/82977
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-11-17 07:15:22 +01:00
Stephan Bergmann
314f15bff0 Extend loplugin:external to warn about enums
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-17 00:28:17 +01:00
Noel Grandin
5b374877b5 loplugin:singlevalfields
Change-Id: I31fd6b251dee9d1ee1a9ac59964034d0136e1f3e
Reviewed-on: https://gerrit.libreoffice.org/82978
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-11-16 20:19:54 +01:00
Stephan Bergmann
24b69e95c6 Improve loplugin:redundantpreprocessor performance a bit
...and add a minimal test for it

Change-Id: Ia6c61e41a7e60fd01c639e893c34bd9d215c1513
Reviewed-on: https://gerrit.libreoffice.org/82983
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-11-16 16:55:36 +01:00
Stephan Bergmann
ab8fc2603c Fix loplugin::Entry ODR violation
(caused crashes with CLANGDEBUG=1 in compilerplugins/Makefile-clang.mk)

Change-Id: I43ba276f03c87c97b624a59f2b368422fd5b0a7b
Reviewed-on: https://gerrit.libreoffice.org/82982
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-11-16 16:48:33 +01:00
Noel Grandin
03feda2465 loplugin:unusedfields
Change-Id: I021cd75685a091c1afd3ff3c144def6f9a784bee
Reviewed-on: https://gerrit.libreoffice.org/82972
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-11-16 12:27:59 +01:00
Stephan Bergmann
d04eef8582 loplugin:external: Don't warn for injected friend functions
Change-Id: I35c0930f6ab8ae5d96e433958cf29791c78d5e31
Reviewed-on: https://gerrit.libreoffice.org/82802
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-11-15 23:29:41 +01:00
Stephan Bergmann
565bcfbdcb Fix loplugin:fakebool for Objective C
...ignoring uses of "BOOL" in Objective C for now

Change-Id: I3eb48dc8d2592285f03f75dc7bc1b21e2383644d
Reviewed-on: https://gerrit.libreoffice.org/82803
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-11-15 19:15:47 +01:00
Stephan Bergmann
f213092d5a loplugin:external: Extend comment about the perils of moving a function
...into an unnamed namespace.  (And make it into a "leading comment" that
precedes the code it appeartains to.  It had orignally been meant as a "trailing
comment" that follows the code it appeartains to, and had been idented further
to indicate that, but clang-format unhelpfully breaks such indentation of
trailing comments that need to be preceded by a line break due to line length
limitations.)

Change-Id: I6a71a6b8e11ba641acfb542142fe14b4b6445f51
Reviewed-on: https://gerrit.libreoffice.org/82792
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-11-15 18:26:25 +01:00
Stephan Bergmann
ef57b9cd3c loplugin:external: Note all other declarations of the same entity
...not just those that came before

Change-Id: Ib10ca34cb2ee63124999d56bb00d94f000f33ea1
Reviewed-on: https://gerrit.libreoffice.org/82782
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-11-15 17:55:00 +01:00
Stephan Bergmann
82e1697d29 Fix loplugin:consttobool for assert on macOS
...which internally uses __builtin_expect and thus caused

> core/include/com/sun/star/uno/Any.hxx:750:13: error: implicit conversion of constant 1 of type 'long' to 'bool'; use 'true' instead [loplugin:consttobool]
>             assert(false); // this cannot happen
>             ^~~~~~~~~~~~~
> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include/assert.h:93:6: note: expanded from macro 'assert'
>     (__builtin_expect(!(e), 0) ? __assert_rtn(__func__, __FILE__, __LINE__, #e) : (void)0)
>      ^~~~~~~~~~~~~~~~~~~~~~~~~

(See 216bcceee1ba908f617deb3f2404aff8085d5358 "Special handling of
__builtin_expect in boolean expressions" for a similar fix in
loplugin:literaltoboolconversion.)

Change-Id: I4cf4b21006176c908995f5753dd0a38165383d87
Reviewed-on: https://gerrit.libreoffice.org/82773
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-11-15 14:38:27 +01:00
Stephan Bergmann
2a1533b019 Add loplugin:consttobool assert-related tests
...and improve diagnostics a bit

Change-Id: I3233aa1752620ddbe6fbeff93b15565921f0bc2e
Reviewed-on: https://gerrit.libreoffice.org/82767
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-11-15 14:09:03 +01:00
Stephan Bergmann
e21f5796b1 Silence -Werror,-Wsometimes-uninitialized
Change-Id: I491566c9f1fbbaabf9b050150b1567c5354227d0
Reviewed-on: https://gerrit.libreoffice.org/82752
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-11-15 12:49:05 +01:00
Stephan Bergmann
1205a4b774 New loplugin:consttobool
...to: "Find implicit conversions from non-'bool' constants (e.g., 'sal_False')
to 'bool'".

Due to how FALSE is defined as just

  #define FALSE (0)

(i.e., a literal of type 'int') but TRUE is defined as

  #define TRUE (!FALSE)

(i.e., an implicit conversion from 'int' to 'bool') in GLib (see the comment in
ConstToBool::VisitImplicitCastExpr), we get more warnings about uses of 'TRUE'
than of 'FALSE'.  For example, in libreofficekit/source/gtk/lokdocview.cxx there
is a warning about the 'TRUE' in

  g_main_context_iteration(nullptr, TRUE);

but not about the 'FALSE' in

  g_main_context_iteration(nullptr, FALSE);

(where the parameter of 'g_main_context_iteration' is of type 'gboolean').  Lets
live with that asymmetry for now...

(Besides the issues addressed directly in this commit, it also found the two
bogus asserts at 7e09d08807b5ba2fd8b9831557752a415bdad562 "Fix useless
assert(true) (which would never fire)" and
122a0be8ae480473bd1d7f35e197a2529f4621e3 "Fix useless assert(true) (which would
never fire)", plus 5f0d6df7f57ae281fe161e61c7f25d67453fddd2 "Use two-argument
form of static_assert".)

Change-Id: Id77322de9f94b85a7b65608a03e0e9865d14467b
Reviewed-on: https://gerrit.libreoffice.org/82667
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-11-14 19:53:53 +01:00
Stephan Bergmann
281d493fd9 Improve error message
(When temporarily taking a plugin out of the shared plugin by modifying its
leading

> #ifndef LO_CLANG_SHARED_PLUGINS

line I often forget about a trailing

> #endif // LO_CLANG_SHARED_PLUGINS

line, which then caused a hard to understand

> [GEN] compilerplugins/clang/sharedvisitor/sharedvisitor.cxx
> Incorrect version ''

failure.  This way, at least somehow mention the name of the problematic plugin
to give a bit of a clue.)

Change-Id: I9a9178ba0d7a32f448e91076376989f088ea70f8
Reviewed-on: https://gerrit.libreoffice.org/82657
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-11-14 13:29:05 +01:00
Stephan Bergmann
913d34ec6b Extend loplugin:salbool to loplugin:fakebool
...checking for unnecessary uses of more "fake bool" types.

In the past, some of the checks involving the types of variables or data
members, or the return types of functions, issued warnings that required
surrounding code to be changed too (e.g., when changing the signature of a
function whose address was taken).  These checks have been tightened now to not
warn in such cases (which avoids warnings that require changes to additional
code, or changes that might even be impossible to make, at the cost of being
less aggressive about removing all unnecessary uses of those "fake bool" types).

Change-Id: I70eb75039817cda34ed611387ee27dc5f36a3e2e
Reviewed-on: https://gerrit.libreoffice.org/82554
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-11-13 15:06:42 +01:00
Stephan Bergmann
bc6e282bc2 Clarify loplugin:external behavior for const(expr) vars
Change-Id: I4a649f9c9ed2015ed9b32a153060df9770b20403
Reviewed-on: https://gerrit.libreoffice.org/82493
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-11-12 13:04:28 +01:00
Stephan Bergmann
a0c30af2ac Make base of loplugin::FunctionAddress more flexible
(I'm planning to use it for a FilteringRewritePlugin.)

And while at it, base its current uses on FilteringPlugin.

Change-Id: I0acdcc6cb0b3a434b425405c8c438dbf65e4d3cb
Reviewed-on: https://gerrit.libreoffice.org/82451
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-11-11 17:29:06 +01:00
Stephan Bergmann
1b66d0141c Use more efficient NamedDecl::getName
Change-Id: I764b254180809c7ee020d5115e4b9e50e0227c09
Reviewed-on: https://gerrit.libreoffice.org/82321
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-11-08 21:22:29 +01:00
Caolán McNamara
72fad7a18d remove some unused getters
Change-Id: Iaa556491add4a7674f90ecfbf8e44f0b1d6583ee
Reviewed-on: https://gerrit.libreoffice.org/82198
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
2019-11-07 13:58:43 +01:00
Caolán McNamara
2b635e6de8 drop unused TreeView::set_top_entry
Change-Id: I70171b95baf29486c253e7d388ba59385da1d929
Reviewed-on: https://gerrit.libreoffice.org/82196
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
2019-11-07 13:09:57 +01:00
Noel Grandin
162f852836 loplugin:unusedmethods
Change-Id: I65354c7476dfaede1a607441d7c1b0c7ad038df4
Reviewed-on: https://gerrit.libreoffice.org/82186
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-11-07 09:01:00 +01:00
Noel Grandin
ef77870b1c loplugin:unusedfields
Change-Id: Ic1c0a2144f39373f93384bccbfc74356cac65ba0
Reviewed-on: https://gerrit.libreoffice.org/82185
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-11-07 08:06:27 +01:00
Noel Grandin
d81f90dda7 loplugin:unnecessaryvirtual
Change-Id: Ibffbd0f5d30ec14cace3638b2bb47c91a583711c
Reviewed-on: https://gerrit.libreoffice.org/82171
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-11-06 20:03:32 +01:00
Noel Grandin
9e087d4a30 loplugin:unusedvariablecheck tweak to find more stuff
but leave the tweak commented out, since it generates false positives

Change-Id: Iaf3f92414d2618f8780561f98765e33e282afe0c
Reviewed-on: https://gerrit.libreoffice.org/82121
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-11-06 10:47:15 +01:00
Noel Grandin
7b99cdb2d7 loplugin:indentation find broken if statements
so I don't read the "then" block as being a sequential statements

Change-Id: Ib2004acd3518bd4ebd2246f02a26c2c0a8bbab4c
Reviewed-on: https://gerrit.libreoffice.org/82069
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-11-06 06:27:51 +01:00
Stephan Bergmann
75bbbfc6bd loplugin:redundantcast: Don't warn about cast from nullptr_t to function ptr
See comments at <https://gerrit.libreoffice.org/#/c/81958/> "Only initialize
function pointer once" for a case where such a false warning caused trouble (in
a lambda with deduced return type and multiple return statements).

Change-Id: I64b0b8c45bd3d2a6075e336c361ec778fa0da481
Reviewed-on: https://gerrit.libreoffice.org/82034
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-11-04 17:20:28 +01:00
Stephan Bergmann
7f305223fa New loplugin:conditionalstring
Change-Id: I2eab990c15f845b44a3b598571aca361dadf9ff3
Reviewed-on: https://gerrit.libreoffice.org/81946
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-11-02 21:47:38 +01:00
Stephan Bergmann
d526bd7dd5 Fix StringAdd::isCompileTimeConstant
...to find StringLiteral on the RHS of +=.  Which revealed that the
VisitCompoundStmt/checkForCompoundAssign logic needed to be fixed, too, so that

  s += side_effect();
  s += "literal";
  s += side_effect();

only gets combined to

  s += side_effect() + "literal";
  s += side_effect();

and not all the way to

  s += side_effect() + "literal" + side_effect();

Change-Id: I432e3458b933a7d0ad6141c747b675cc8b0f0ba4
Reviewed-on: https://gerrit.libreoffice.org/81804
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-10-31 09:14:39 +01:00
Stephan Bergmann
c9858b725b Clarify current loplugin:stringadd behavior
Change-Id: Ie5fb84e2b9afddcf86c86364811f0c4f5b90c82e
Reviewed-on: https://gerrit.libreoffice.org/81748
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-10-30 20:22:54 +01:00
Stephan Bergmann
1136ed6c51 Fix Plugin::containsPreprocessingConditionalInclusion
...which had been broken since dfc0dc4801707b2d8080af1540625b43bd463e17
"loplugin:casttovoid: fix containsPreprocessingConditionalInclusion()", and,
when range.getEnd() was a macro loc, would typically have wandered off past
the end of the intended range, until it would have encountered some #if etc.
and erroneously returned true.  Fixed the fallout across the code base.

While at it, added a clarifying comment and made the "lexing fails" cases that
should never happen fail with a fatal error in debug mode.

Change-Id: Ieff44548384426d7716b6fc6c836c9069d878729
Reviewed-on: https://gerrit.libreoffice.org/81721
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-10-30 07:14:17 +01:00
Noel Grandin
6e1376dd60 loplugin:finalclasses fix check
need to check after we generate the inherited-from set, not before

Change-Id: Ic66deeb680f4a2505d66f99872ac7a5bc263cda9
Reviewed-on: https://gerrit.libreoffice.org/81636
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-10-29 09:01:02 +01:00
Noel Grandin
4b91b7dfa7 loplugin:finalclasses look for classes with virtual members
where making them final gives the compiler freedom to de-virtualise some
calls

Change-Id: I5755a41c42d9f23af58b873efae37a1d240fbd89
Reviewed-on: https://gerrit.libreoffice.org/81618
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-10-28 20:17:02 +01:00
Stephan Bergmann
6385e04f7e Completely remove lambda capture that is unused
...since 6d6fad522a2cd6a2959ea774969a86288f5a3cb7 "Introduce OStringChar" (and
had needlessly been kept alive with ce3badb157c58941608f878a7de98c7739e30aec
"compilerplugins: fix -Werror,-Wunused-lambda-capture")

Change-Id: Ie34ef1197f97ecab5b8f30741f1e2c4b3a9db594
Reviewed-on: https://gerrit.libreoffice.org/81591
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-10-28 12:33:38 +01:00
Noel Grandin
bc539bd3c0 loplugin:stringadd improve detection
if one side of the expression is a compile-time-constant, we don't need
to worry about side-effects on the other side

Change-Id: Iee71ea51b327ef244bf39f128f921ac325d74e2b
Reviewed-on: https://gerrit.libreoffice.org/81589
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-10-28 12:07:54 +01:00
Miklos Vajna
ce3badb157 compilerplugins: fix -Werror,-Wunused-lambda-capture
Change-Id: I2a1374a1e79401c2107d003102ab797fac9a3d66
2019-10-25 09:09:53 +02:00
Stephan Bergmann
6d6fad522a Introduce OStringChar
...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-24 17:17:46 +02:00
Stephan Bergmann
a246830d3f This is fixed now on Clang trunk
...since <https://github.com/llvm/llvm-project/commit/
dc3957ec215dd17b8d293461f18696566637a6cd> "Include leading attributes in
DeclStmt's SourceRange"

Change-Id: I21859dfdcb454a9dd4444ce299548bf75043b1ab
Reviewed-on: https://gerrit.libreoffice.org/81424
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-10-24 11:50:01 +02:00
Stephan Bergmann
754e2d9be1 Don't use broken StringAdd::getSourceAsString
it caused clang-cl to crash when processing desktop/source/app/opencl.cxx

Change-Id: I0a39697e75242cd00f12b60477d51a1e5bf96a4f
Reviewed-on: https://gerrit.libreoffice.org/81409
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-10-23 22:09:38 +02:00
Stephan Bergmann
6facd4811a Fix call to NamedDecl::getName
...which fails at least with clang-8.0.0-3.fc30.x86_64 with "clang-8:
/usr/include/clang/AST/Decl.h:277: llvm::StringRef clang::NamedDecl::getName()
const: Assertion `Name.isIdentifier() && "Name is not a simple identifier"'
failed."

Change-Id: I6999240e2b518b6818a43d1e5ac92224300b343f
Reviewed-on: https://gerrit.libreoffice.org/81415
Tested-by: Michael Stahl <michael.stahl@cib.de>
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-10-23 22:07:32 +02:00
Noel Grandin
fbb93bc159 loplugin:unusedfields
Change-Id: I1f69ec45e7d44e45a6ece1fe9d9eef8a2be2d6ff
Reviewed-on: https://gerrit.libreoffice.org/81361
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-10-23 10:28:55 +02:00
Noel Grandin
3b65ce7996 loplugin:unusedmethods
Change-Id: I5fd081780d46fd30864830eea2956bad6dc3e222
Reviewed-on: https://gerrit.libreoffice.org/81360
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-10-23 10:12:04 +02:00
Noel Grandin
0dc168dfc3 loplugin:unusedenumconstants
Change-Id: I76aadeefce66df93f21b7e45c0e87ab92df45131
Reviewed-on: https://gerrit.libreoffice.org/81324
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-10-22 18:13:16 +02:00
Stephan Bergmann
54f292d1d1 Avoid C++20 operator overloading ambiguity
...which is reported now by Clang 10 trunk with -std=c++2a:

> cui/source/tabpages/tpline.cxx:481:80: error: use of overloaded operator '==' is ambiguous (with operand types 'const XLineEndItem' and 'XLineStartItem')
>             if( pItem && ( !pOld || !( *static_cast<const XLineEndItem*>(pOld) == *pItem ) ) )
>                                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~~~~
> include/svx/xlnstit.hxx:43:29: note: candidate function (with reversed parameter order)
>     virtual bool            operator==(const SfxPoolItem& rItem) const override;
>                             ^
> include/svx/xlnedit.hxx:43:29: note: candidate function
>     virtual bool            operator==(const SfxPoolItem& rItem) const override;
>                             ^

But the base SfxPoolItem::operator == is virtual anyway, so no need to cast
pOld to a derived type.

And once the expression is changed to

  !( *pOld == *pItem )

loplugin:simplifybool would kick in, but only with old compilers.  So update
loplugin:simplifybool to also kick in on that with latest Clang trunk with
-std=c++2a, and simplify the expression accordingly.

Change-Id: I3de9175b30d8645ed7a52f87cfac320144576cc8
Reviewed-on: https://gerrit.libreoffice.org/81203
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-10-22 16:57:30 +02:00
Noel Grandin
7fb43031b7 loplugin:constantparam
Change-Id: Ibfe70492683ff3ec208cee95d8a11155ec54f690
Reviewed-on: https://gerrit.libreoffice.org/81314
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-10-22 14:14:48 +02:00
Noel Grandin
8d686c1e6a loplugin:singlevalfields
Change-Id: I92c5634b16862abe1c73c20cfe66abe92f58bb88
Reviewed-on: https://gerrit.libreoffice.org/81303
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-10-22 11:16:19 +02:00