Files
core/compilerplugins/clang/test/commaoperator.cxx
Stephan Bergmann e4fac1ebbd Enable -Wdeprecated-copy-dtor where available
We already get -Wdeprecated-copy (warning about implicitly defined copy
functions that will in the future be deleted because other user-provided copy
functions exist) automatically through -Wextra, where available.
-Wdeprecated-copy-dtor (warning about implicitly defined copy functions that
will in the future be deleted because of a user-provided dtor) is split off
into its own warning excluded from -Wextra for somewhat unclear reasons, see the
discussion at <https://gcc.gnu.org/bugzilla/buglist.cgi?quicksearch=88136>
"-Wdeprecated-copy is draconian and shouldn't be in -Wall".

But -Wdeprecated-copy-dtor has been useful in finding issues (esp. the Clang 10
trunk version, which, unlike the GCC 9 version, also finds copy functions that
are implicitly defined because they are used from template instantiations), see
3e59716375 "Prevent
BroadcastRecalcOnRefMoveHandler copies" and
4f98cd0f9c "ScShapeChild has broken copy
functions".

We need to disable -Wdeprecated-copy-dtor in files included from external/boost,
and in two compilerplugin/clang/test/ files.

Change-Id: I74b159c3a046e23661473ddbfe53c92c4136a9db
Reviewed-on: https://gerrit.libreoffice.org/85073
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-12-12 22:00:31 +01:00

29 lines
948 B
C++

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
bool f();
struct S { S(); };
int main() {
f(), f(), f(); // expected-error {{comma operator hides code [loplugin:commaoperator]}}
(f(), f());
for (
f(), f();
f(), f(); // expected-error {{comma operator hides code [loplugin:commaoperator]}}
f(), f())
f(), f(); // expected-error {{comma operator hides code [loplugin:commaoperator]}}
S s;
(s = S(), s = S(), s = S());
for (s = S(), f(); f(); s = S(), f()) {}
while (s = S(), f()) {}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */