/* -*- 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/.
*/
template<typename T> void f() { int i = sizeof (T) + 1; // expected-error {{var used only once, should be inlined or declared const [loplugin:oncevar]}}
call_value(i); // expected-note {{used here [loplugin:oncevar]}}
} templatevoid f<int>(); // needed for clang-cl
class Foo; void method1(const Foo**);
int main() { /* TODO int i; int x = 2; if ( (i = foo()) == 0 ) { x = 1; }
*/
int i1 = 2; // expected-error {{var used only once, should be inlined or declared const [loplugin:oncevar]}}
call_value(i1); // expected-note {{used here [loplugin:oncevar]}} int i2 = 2; // expected-error {{var used only once, should be inlined or declared const [loplugin:oncevar]}}
call_const_ref(i2); // expected-note {{used here [loplugin:oncevar]}}
// don't expect warnings here int i3;
call_ref(i3); intconst i4 = 2;
call_value(i4);
OUString s1("xxx"); // expected-error {{var used only once, should be inlined or declared const [loplugin:oncevar]}}
call_value(s1); // expected-note {{used here [loplugin:oncevar]}}
OUString s2("xxx"); // expected-error {{var used only once, should be inlined or declared const [loplugin:oncevar]}}
call_const_ref(s2); // expected-note {{used here [loplugin:oncevar]}}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.