diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2018-06-01 16:22:53 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2018-06-01 20:52:41 +0200 |
commit | e1ab04440195092aa0bfbf445e97530082843569 (patch) | |
tree | 2f4b8014439fb97b2e37683bf1b260dd9191da2d /compilerplugins/clang/test/unreffun.cxx | |
parent | 29dbb864097cc3136b036fbeb0bfa7d24b1147d7 (diff) |
Improve loplugin:unreffun
...to avoid a false positive in --enable-qt5
> [build CXX] vcl/qt5/Qt5Widget.cxx
> /home/sbergman/lo/core/vcl/qt5/Qt5Widget.cxx:466:21: error: Unreferenced function declaration [loplugin:unreffun]
> friend QWidget* createQt5Widget(Qt5Frame& rFrame, QWidget* parent, Qt::WindowFlags f);
> ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 1 error generated.
Change-Id: I01e47bc5f5147916737d62fe18ce5312a0221a3f
Reviewed-on: https://gerrit.libreoffice.org/55189
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'compilerplugins/clang/test/unreffun.cxx')
-rw-r--r-- | compilerplugins/clang/test/unreffun.cxx | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/compilerplugins/clang/test/unreffun.cxx b/compilerplugins/clang/test/unreffun.cxx new file mode 100644 index 000000000000..d9d56afe3c35 --- /dev/null +++ b/compilerplugins/clang/test/unreffun.cxx @@ -0,0 +1,25 @@ +/* -*- 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/. + */ + +#include "unreffun.hxx" + +template <typename> struct S +{ + friend void f(); +}; + +void f() {} + +void g(); // expected-error {{Unreferenced function declaration [loplugin:unreffun]}} + +void h() // expected-error {{Unreferenced externally visible function definition [loplugin:unreffun]}} +{ +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ |