libreoffice/compilerplugins/clang/test/unusedvarsglobal.cxx
Stephan Bergmann ccd073e044 Adapt compilerplugins/clang/test/unusedvarsglobal.cxx
...to e6dfaf9f44f9939abc338c83b3024108431d0f69 "Turn OUStringLiteral into a
consteval'ed, static-refcound rtl_uString".  (The original code would have
started to fail with

> error: 'error' diagnostics seen but not expected:
>   File compilerplugins/clang/test/unusedvarsglobal.cxx Line 22: declaration of variable 'literal1' with deduced type 'const OUStringLiteral' requires an initializer

when built with Clang >= 11.)

Change-Id: If51a39c8fb42200f064d62f472e8cddcc6e4c434
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102898
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Tested-by: Jenkins
2020-09-17 15:15:32 +02:00

28 lines
943 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/.
*/
#include "config_clang.h"
// CLANG_VERSION = older versions of clang need something different in getParentFunctionDecl
// WIN32 = TODO, see corresponding TODO in compilerplugins/clang/unusedfields.cxx
#if CLANG_VERSION < 110000 || defined _WIN32
// expected-no-diagnostics
#else
#include <string_view>
namespace something
{
// expected-error@+1 {{write [loplugin:unusedvarsglobal]}}
extern const std::u16string_view literal1;
}
const std::u16string_view something::literal1(u"xxx");
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */