Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / compilerplugins / clang / test / stringliteraldefine.cxx
blobba5f718ed86d0f790dc94f698a6961c352a6b22e
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
10 #include <sal/config.h>
12 #include <vector>
14 #include <rtl/ustring.hxx>
15 #include <sal/macros.h>
17 void f(OUString const&);
19 void f1()
21 // expected-error@+1 {{change macro 'XXX' to 'constexpr OUStringLiteral' [loplugin:stringliteraldefine]}}
22 #define XXX "xxx"
24 // expected-note@+1 {{macro used here [loplugin:stringliteraldefine]}}
25 f(OUString(XXX));
27 // FIXME no warning expected
28 //#define FOO f(OUString("xxx"))
29 // FOO;
32 void f2()
34 struct DataFlavorRepresentation
36 OUString pMimeType;
39 // expected-error@+1 {{change macro 'MIMETYPE_VND_SUN_XML_WRITER_ASCII' to 'constexpr OUStringLiteral' [loplugin:stringliteraldefine]}}
40 #define MIMETYPE_VND_SUN_XML_WRITER_ASCII "xxx"
41 static const DataFlavorRepresentation aInstance[] = {
42 // expected-note@+1 {{macro used here [loplugin:stringliteraldefine]}}
43 { MIMETYPE_VND_SUN_XML_WRITER_ASCII },
47 void f3()
49 // expected-error@+1 {{change macro 'YYY' to 'constexpr OUStringLiteral' [loplugin:stringliteraldefine]}}
50 #define YYY "yyy"
52 // expected-note@+1 {{macro used here [loplugin:stringliteraldefine]}}
53 f(YYY);
56 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */