summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2024-10-21 12:41:53 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2024-11-04 08:51:00 +0100
commit5de73f04f3db9c8fb488bf75b1860bf8378a5b45 (patch)
tree162ce145c1bec1ac5b41b5caa5bac1591c54c11a
parentdce64cc7cfd5f696ef0c030524558306687ae3c7 (diff)
new loplugin:staticconstexpr
Change-Id: Ida1996dfffa106bf95fd064e8191b8033b4002f3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175336 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--basic/qa/cppunit/test_scanner.cxx28
-rw-r--r--compilerplugins/clang/staticconstexpr.cxx91
-rw-r--r--compilerplugins/clang/test/staticconstexpr.cxx28
-rw-r--r--connectivity/source/parse/sqlnode.cxx2
-rw-r--r--cui/source/options/optgdlg.cxx2
-rw-r--r--dbaccess/source/core/api/KeySet.cxx4
-rw-r--r--dbaccess/source/filter/hsqldb/createparser.cxx2
-rw-r--r--dbaccess/source/ui/browser/unodatbr.cxx4
-rw-r--r--dbaccess/source/ui/dlg/tablespage.cxx2
-rw-r--r--desktop/source/app/app.cxx4
-rw-r--r--drawinglayer/source/processor2d/cairopixelprocessor2d.cxx8
-rw-r--r--editeng/qa/unit/core-test.cxx16
-rw-r--r--editeng/source/items/numitem.cxx4
-rw-r--r--i18npool/qa/cppunit/test_breakiterator.cxx8
-rw-r--r--i18npool/source/collator/collator_unicode.cxx2
-rw-r--r--sal/qa/osl/socket.cxx2
-rw-r--r--sal/qa/rtl/strings/test_oustring_stringliterals.cxx2
-rw-r--r--sal/qa/rtl/strings/test_strings_defaultstringview.cxx3
-rw-r--r--sal/qa/rtl/textenc/rtl_textcvt.cxx2
-rw-r--r--sal/rtl/strtmpl.hxx2
-rw-r--r--sc/qa/unit/subsequent_export_test.cxx15
-rw-r--r--sc/qa/unit/subsequent_export_test2.cxx6
-rw-r--r--sc/qa/unit/subsequent_export_test4.cxx2
-rw-r--r--sc/qa/unit/subsequent_filters_test3.cxx4
-rw-r--r--sc/qa/unit/subsequent_filters_test5.cxx4
-rw-r--r--sc/qa/unit/tiledrendering/tiledrendering.cxx2
-rw-r--r--sc/qa/unit/ucalc_copypaste.cxx4
-rw-r--r--sc/qa/unit/ucalc_formula.cxx2
-rw-r--r--sc/qa/unit/ucalc_formula2.cxx10
-rw-r--r--sc/qa/unit/ucalc_parallelism.cxx2
-rw-r--r--sc/qa/unit/uicalc/uicalc2.cxx2
-rw-r--r--sc/source/core/tool/compiler.cxx2
-rw-r--r--sc/source/ui/dbgui/scuiasciiopt.cxx2
-rw-r--r--sc/source/ui/docshell/impex.cxx2
-rw-r--r--sd/qa/unit/export-tests-ooxml1.cxx2
-rw-r--r--sd/qa/unit/export-tests.cxx3
-rw-r--r--sd/qa/unit/layout-tests.cxx2
-rw-r--r--sdext/source/pdfimport/wrapper/wrapper.cxx2
-rw-r--r--sfx2/source/control/dispatch.cxx2
-rw-r--r--sfx2/source/dialog/StyleList.cxx6
-rw-r--r--solenv/CompilerTest_compilerplugins_clang.mk1
-rw-r--r--svl/qa/unit/svl.cxx2
-rw-r--r--svl/qa/unit/test_lngmisc.cxx2
-rw-r--r--svx/qa/unit/gallery/test_gallery.cxx6
-rw-r--r--svx/source/tbxctrls/tbcontrl.cxx2
-rw-r--r--sw/qa/core/test_ToxWhitespaceStripper.cxx2
-rw-r--r--sw/qa/extras/htmlexport/htmlexport.cxx6
-rw-r--r--sw/qa/extras/odfexport/odfexport.cxx2
-rw-r--r--sw/qa/extras/odfexport/odfexport2.cxx2
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport20.cxx3
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport9.cxx2
-rw-r--r--sw/qa/extras/ooxmlimport/ooxmlimport2.cxx2
-rw-r--r--sw/qa/extras/uiwriter/uiwriter3.cxx6
-rw-r--r--sw/qa/extras/uiwriter/uiwriter4.cxx10
-rw-r--r--sw/qa/extras/uiwriter/uiwriter6.cxx2
-rw-r--r--sw/qa/extras/uiwriter/uiwriter7.cxx4
-rw-r--r--sw/source/core/doc/DocumentContentOperationsManager.cxx2
-rw-r--r--sw/source/core/doc/DocumentRedlineManager.cxx2
-rw-r--r--sw/source/filter/html/css1atr.cxx2
-rw-r--r--sw/source/filter/ww8/docxexport.cxx2
-rw-r--r--sw/source/filter/ww8/rtfexport.cxx2
-rw-r--r--sw/source/filter/ww8/ww8par2.cxx4
-rw-r--r--sw/source/filter/ww8/ww8par3.cxx2
-rw-r--r--sw/source/uibase/dbui/dbui.cxx4
-rw-r--r--sw/source/uibase/shells/textsh1.cxx2
-rw-r--r--sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx4
-rw-r--r--tools/qa/cppunit/test_rectangle.cxx24
-rw-r--r--tools/qa/cppunit/test_stream.cxx2
-rw-r--r--tools/source/generic/bigint.cxx4
-rw-r--r--vcl/qa/cppunit/pdfexport/pdfexport2.cxx12
-rw-r--r--vcl/skia/gdiimpl.cxx2
-rw-r--r--vcl/skia/salbmp.cxx24
-rw-r--r--vcl/source/app/svmain.cxx2
-rw-r--r--writerperfect/qa/unit/EPUBExportTest.cxx2
-rw-r--r--xmloff/qa/unit/draw.cxx2
-rw-r--r--xmlsecurity/qa/unit/signing/signing.cxx4
-rw-r--r--xmlsecurity/source/xmlsec/nss/sanextension_nssimpl.cxx2
-rw-r--r--xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx2
78 files changed, 291 insertions, 163 deletions
diff --git a/basic/qa/cppunit/test_scanner.cxx b/basic/qa/cppunit/test_scanner.cxx
index 1591ca891c85..2b7d194d5438 100644
--- a/basic/qa/cppunit/test_scanner.cxx
+++ b/basic/qa/cppunit/test_scanner.cxx
@@ -160,14 +160,14 @@ void ScannerTest::testBlankLines()
void ScannerTest::testOperators()
{
- constexpr OUString sourceE(u"="_ustr);
- constexpr OUString sourceLT(u"<"_ustr);
- constexpr OUString sourceGT(u">"_ustr);
- constexpr OUString sourceLTE(u"<="_ustr);
- constexpr OUString sourceGTE(u">="_ustr);
- constexpr OUString sourceNE(u"<>"_ustr);
- constexpr OUString sourceA(u":="_ustr);
- constexpr OUString sourceNot(u"Not"_ustr);
+ static constexpr OUString sourceE(u"="_ustr);
+ static constexpr OUString sourceLT(u"<"_ustr);
+ static constexpr OUString sourceGT(u">"_ustr);
+ static constexpr OUString sourceLTE(u"<="_ustr);
+ static constexpr OUString sourceGTE(u">="_ustr);
+ static constexpr OUString sourceNE(u"<>"_ustr);
+ static constexpr OUString sourceA(u":="_ustr);
+ static constexpr OUString sourceNot(u"Not"_ustr);
std::vector<Symbol> symbols;
@@ -239,12 +239,12 @@ void ScannerTest::testOperators()
void ScannerTest::testAlphanum()
{
- constexpr OUString source1(u"asdfghefg"_ustr);
- constexpr OUString source3(u"AdfsaAUdsl10987"_ustr);
- constexpr OUString source4(u"asdfa_mnvcnm"_ustr);
- constexpr OUString source5(u"_asdf1"_ustr);
- constexpr OUString source6(u"_6"_ustr);
- constexpr OUString source7(u"joxclk_"_ustr);
+ static constexpr OUString source1(u"asdfghefg"_ustr);
+ static constexpr OUString source3(u"AdfsaAUdsl10987"_ustr);
+ static constexpr OUString source4(u"asdfa_mnvcnm"_ustr);
+ static constexpr OUString source5(u"_asdf1"_ustr);
+ static constexpr OUString source6(u"_6"_ustr);
+ static constexpr OUString source7(u"joxclk_"_ustr);
std::vector<Symbol> symbols;
diff --git a/compilerplugins/clang/staticconstexpr.cxx b/compilerplugins/clang/staticconstexpr.cxx
new file mode 100644
index 000000000000..4985c6115e3f
--- /dev/null
+++ b/compilerplugins/clang/staticconstexpr.cxx
@@ -0,0 +1,91 @@
+/* -*- 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/.
+ */
+
+#ifndef LO_CLANG_SHARED_PLUGINS
+
+#include <cassert>
+#include <stack>
+
+#include "check.hxx"
+#include "plugin.hxx"
+#include "config_clang.h"
+
+/**
+In MSVC, non-static constexpr objects are initialized at run-time
+
+So make sure that function-local vars are declared static.
+
+*/
+namespace
+{
+class StaticConstexpr final : public loplugin::FilteringPlugin<StaticConstexpr>
+{
+public:
+ explicit StaticConstexpr(loplugin::InstantiationData const& data)
+ : FilteringPlugin(data)
+ {
+ }
+
+ bool VisitVarDecl(const VarDecl* varDecl)
+ {
+ if (ignoreLocation(varDecl))
+ return true;
+ if (!varDecl->isConstexpr())
+ return true;
+ if (!varDecl->isLocalVarDecl())
+ return true;
+ if (varDecl->isStaticLocal())
+ return true;
+ if (auto const functionDecl = dyn_cast_or_null<FunctionDecl>(varDecl->getDeclContext()))
+ {
+ // cannot convert these, definition of a static variable in a constexpr function is a C++23 extension
+ if (functionDecl->isConstexpr())
+ return true;
+ }
+ if (varDecl->getType()->isBuiltinType() || varDecl->getType()->isEnumeralType())
+ return true;
+ // ignore the o3tl::getConversionMulDiv stuff
+ loplugin::TypeCheck tc(varDecl->getType());
+ if (tc.ClassOrStruct("pair").StdNamespace())
+ return true;
+ if (tc.Struct("m_and_d").Namespace("detail").Namespace("o3tl"))
+ return true;
+ if (tc.ClassOrStruct("TypedWhichId"))
+ return true;
+ if (tc.ClassOrStruct("Color"))
+ return true;
+ report(DiagnosticsEngine::Warning,
+ "function-local constexpr vars should be declared static", varDecl->getBeginLoc())
+ << varDecl->getSourceRange();
+ return true;
+ }
+
+ bool preRun() override
+ {
+ if (!compiler.getLangOpts().CPlusPlus)
+ return false;
+ return true;
+ }
+
+private:
+ void run() override
+ {
+ if (preRun())
+ {
+ TraverseDecl(compiler.getASTContext().getTranslationUnitDecl());
+ }
+ }
+};
+
+loplugin::Plugin::Registration<StaticConstexpr> staticconstexpr("staticconstexpr");
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/compilerplugins/clang/test/staticconstexpr.cxx b/compilerplugins/clang/test/staticconstexpr.cxx
new file mode 100644
index 000000000000..f4b388ad176b
--- /dev/null
+++ b/compilerplugins/clang/test/staticconstexpr.cxx
@@ -0,0 +1,28 @@
+/* -*- 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 <sal/config.h>
+#include <rtl/string.hxx>
+#include <rtl/ustring.hxx>
+
+namespace test1
+{
+void f()
+{
+ // expected-error@+1 {{function-local constexpr vars should be declared static [loplugin:staticconstexpr]}}
+ constexpr sal_Int64 powers[] = { 1, 10, 100 };
+ (void)powers;
+
+ // no warning expected, simple type
+ constexpr sal_Int64 powers2 = 1.0;
+ (void)powers2;
+}
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/connectivity/source/parse/sqlnode.cxx b/connectivity/source/parse/sqlnode.cxx
index bccdb37a947b..edef27ab6975 100644
--- a/connectivity/source/parse/sqlnode.cxx
+++ b/connectivity/source/parse/sqlnode.cxx
@@ -360,7 +360,7 @@ bool OSQLParseNode::parseNodeToExecutableStatement( OUString& _out_rString, cons
if(sLimitValue.getLength() > 0)
{
- constexpr char SELECT_KEYWORD[] = "SELECT";
+ static constexpr char SELECT_KEYWORD[] = "SELECT";
sBuffer.insert(sBuffer.indexOf(SELECT_KEYWORD) + strlen(SELECT_KEYWORD),
Concat2View(" FIRST " + sLimitValue));
}
diff --git a/cui/source/options/optgdlg.cxx b/cui/source/options/optgdlg.cxx
index fcf93ef00d8b..c80449a62602 100644
--- a/cui/source/options/optgdlg.cxx
+++ b/cui/source/options/optgdlg.cxx
@@ -1855,7 +1855,7 @@ IMPL_LINK_NOARG(OfaLanguagesTabPage, LocaleSettingHdl, weld::ComboBox&, void)
const NfCurrencyEntry& rCurr = SvNumberFormatter::GetCurrencyEntry(
(eLang == LANGUAGE_USER_SYSTEM_CONFIG) ? MsLangId::getConfiguredSystemLanguage() : eLang);
- constexpr OUString aDefaultID = u"default"_ustr;
+ static constexpr OUString aDefaultID = u"default"_ustr;
// Update the "Default ..." currency.
m_xCurrencyLB->remove_id(aDefaultID);
OUString aDefaultCurr = m_sSystemDefaultString + " - " + rCurr.GetBankSymbol();
diff --git a/dbaccess/source/core/api/KeySet.cxx b/dbaccess/source/core/api/KeySet.cxx
index 324daa6e6662..90775495b96d 100644
--- a/dbaccess/source/core/api/KeySet.cxx
+++ b/dbaccess/source/core/api/KeySet.cxx
@@ -437,9 +437,9 @@ void OKeySet::updateRow(const ORowSetRow& _rInsertRow ,const ORowSetRow& _rOrigi
OUStringBuffer aSql = "UPDATE " + m_aComposedTableName + " SET ";
// list all columns that should be set
- constexpr OUStringLiteral aPara(u" = ?,");
+ static constexpr OUStringLiteral aPara(u" = ?,");
OUString aQuote = getIdentifierQuoteString();
- constexpr OUString aAnd(u" AND "_ustr);
+ static constexpr OUString aAnd(u" AND "_ustr);
OUString sIsNull(u" IS NULL"_ustr);
OUString sParam(u" = ?"_ustr);
diff --git a/dbaccess/source/filter/hsqldb/createparser.cxx b/dbaccess/source/filter/hsqldb/createparser.cxx
index 360741ce0b28..9fe720095ac3 100644
--- a/dbaccess/source/filter/hsqldb/createparser.cxx
+++ b/dbaccess/source/filter/hsqldb/createparser.cxx
@@ -83,7 +83,7 @@ sal_Int32 lcl_getAutoIncrementDefault(std::u16string_view sColumnDef)
std::u16string_view lcl_getDefaultValue(std::u16string_view sColumnDef)
{
- constexpr std::u16string_view DEFAULT_KW = u"DEFAULT";
+ static constexpr std::u16string_view DEFAULT_KW = u"DEFAULT";
size_t nDefPos = sColumnDef.find(DEFAULT_KW);
if (nDefPos > 0 && nDefPos != std::u16string_view::npos
&& lcl_getAutoIncrementDefault(sColumnDef) < 0)
diff --git a/dbaccess/source/ui/browser/unodatbr.cxx b/dbaccess/source/ui/browser/unodatbr.cxx
index b6d18610011c..283f3680afd6 100644
--- a/dbaccess/source/ui/browser/unodatbr.cxx
+++ b/dbaccess/source/ui/browser/unodatbr.cxx
@@ -1226,13 +1226,13 @@ void SbaTableQueryBrowser::connectExternalDispatches()
if ( m_aExternalFeatures.empty() )
{
- constexpr OUString aURLs[] {
+ static constexpr OUString aURLs[] {
u".uno:DataSourceBrowser/DocumentDataSource"_ustr,
u".uno:DataSourceBrowser/FormLetter"_ustr,
u".uno:DataSourceBrowser/InsertColumns"_ustr,
u".uno:DataSourceBrowser/InsertContent"_ustr,
};
- constexpr sal_uInt16 nIds[] = {
+ static constexpr sal_uInt16 nIds[] = {
ID_BROWSER_DOCUMENT_DATASOURCE,
ID_BROWSER_FORMLETTER,
ID_BROWSER_INSERTCOLUMNS,
diff --git a/dbaccess/source/ui/dlg/tablespage.cxx b/dbaccess/source/ui/dlg/tablespage.cxx
index 75e6d657771b..06ff0c0e4373 100644
--- a/dbaccess/source/ui/dlg/tablespage.cxx
+++ b/dbaccess/source/ui/dlg/tablespage.cxx
@@ -332,7 +332,7 @@ namespace dbaui
Sequence< OUString > OTableSubscriptionPage::collectDetailedSelection() const
{
Sequence< OUString > aTableFilter;
- constexpr OUString sWildcard = u"%"_ustr;
+ static constexpr OUString sWildcard = u"%"_ustr;
std::unique_ptr<weld::TreeIter> xAllObjectsEntry(m_xTablesList->getAllObjectsEntry());
if (!xAllObjectsEntry)
diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx
index 901e8ae67fe0..e6a2feca09ff 100644
--- a/desktop/source/app/app.cxx
+++ b/desktop/source/app/app.cxx
@@ -1030,8 +1030,8 @@ struct RefClearGuard
bool impl_callRecoveryUI(bool bEmergencySave ,
bool bExistsRecoveryData)
{
- constexpr OUStringLiteral COMMAND_EMERGENCYSAVE = u"vnd.sun.star.autorecovery:/doEmergencySave";
- constexpr OUStringLiteral COMMAND_RECOVERY = u"vnd.sun.star.autorecovery:/doAutoRecovery";
+ static constexpr OUStringLiteral COMMAND_EMERGENCYSAVE = u"vnd.sun.star.autorecovery:/doEmergencySave";
+ static constexpr OUStringLiteral COMMAND_RECOVERY = u"vnd.sun.star.autorecovery:/doAutoRecovery";
css::uno::Reference< css::uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext();
diff --git a/drawinglayer/source/processor2d/cairopixelprocessor2d.cxx b/drawinglayer/source/processor2d/cairopixelprocessor2d.cxx
index 365d62a19fc6..ff9fd83455ef 100644
--- a/drawinglayer/source/processor2d/cairopixelprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/cairopixelprocessor2d.cxx
@@ -770,7 +770,7 @@ void LuminanceToAlpha(cairo_surface_t* pMask)
// and the short loop (for nR, nG and nB resp.) like:
// for(unsigned short a(0); a < 256; a++)
// std::cout << ((a * nR) / 255) << ", ";
- constexpr std::array<sal_uInt8, 256> nRArray
+ static constexpr std::array<sal_uInt8, 256> nRArray
= { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4,
4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 8, 9,
9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 13, 13, 13, 13,
@@ -783,7 +783,7 @@ void LuminanceToAlpha(cairo_surface_t* pMask)
41, 42, 42, 42, 42, 42, 43, 43, 43, 43, 44, 44, 44, 44, 44, 45, 45, 45, 45, 45, 46, 46,
46, 46, 47, 47, 47, 47, 47, 48, 48, 48, 48, 48, 49, 49, 49, 49, 49, 50, 50, 50, 50, 51,
51, 51, 51, 51, 52, 52, 52, 52, 52, 53, 53, 53, 53, 54 };
- constexpr std::array<sal_uInt8, 256> nGArray
+ static constexpr std::array<sal_uInt8, 256> nGArray
= { 0, 0, 1, 2, 2, 3, 4, 5, 5, 6, 7, 7, 8, 9, 10, 10,
11, 12, 12, 13, 14, 15, 15, 16, 17, 17, 18, 19, 20, 20, 21, 22,
22, 23, 24, 25, 25, 26, 27, 27, 28, 29, 30, 30, 31, 32, 33, 33,
@@ -800,7 +800,7 @@ void LuminanceToAlpha(cairo_surface_t* pMask)
149, 149, 150, 151, 152, 152, 153, 154, 155, 155, 156, 157, 157, 158, 159, 160,
160, 161, 162, 162, 163, 164, 165, 165, 166, 167, 167, 168, 169, 170, 170, 171,
172, 172, 173, 174, 175, 175, 176, 177, 177, 178, 179, 180, 180, 181, 182, 183 };
- constexpr std::array<sal_uInt8, 256> nBArray
+ static constexpr std::array<sal_uInt8, 256> nBArray
= { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4,
@@ -3388,7 +3388,7 @@ void CairoPixelProcessor2D::renderTextSimpleOrDecoratedPortionPrimitive2D(
constexpr double fPlus(1.0);
constexpr double fMinus(-1.0);
- constexpr std::array<std::pair<double, double>, 8> offsets{
+ static constexpr std::array<std::pair<double, double>, 8> offsets{
std::pair<double, double>{ fMinus, fMinus }, std::pair<double, double>{ fZero, fMinus },
std::pair<double, double>{ fPlus, fMinus }, std::pair<double, double>{ fMinus, fZero },
std::pair<double, double>{ fPlus, fZero }, std::pair<double, double>{ fMinus, fPlus },
diff --git a/editeng/qa/unit/core-test.cxx b/editeng/qa/unit/core-test.cxx
index 4918ffb3aeb8..ac3c683c9204 100644
--- a/editeng/qa/unit/core-test.cxx
+++ b/editeng/qa/unit/core-test.cxx
@@ -1815,7 +1815,7 @@ void Test::testTransliterate()
CPPUNIT_ASSERT_EQUAL(u"One (Two) Three"_ustr, editEng.GetText());
using TF = TransliterationFlags;
- constexpr OUString sText2 = u"Mary Jones met joe Smith. Time Passed."_ustr;
+ static constexpr OUString sText2 = u"Mary Jones met joe Smith. Time Passed."_ustr;
int selStart = 12;
int selEnd = 12;
ESelection esel(0, selStart, 0, selEnd);
@@ -1912,7 +1912,7 @@ void Test::testTransliterate()
selStart = 0;
selEnd = 19;
esel = ESelection(0, selStart, 0, selEnd);
- constexpr OUString sText3(u"CURRENT IS EQUAL TO 10 A"_ustr);
+ static constexpr OUString sText3(u"CURRENT IS EQUAL TO 10 A"_ustr);
editEng.SetText(sText3);
CPPUNIT_ASSERT_EQUAL(u"CURRENT IS EQUAL TO"_ustr, editEng.GetText(esel));
@@ -1940,7 +1940,7 @@ void Test::testTdf148148()
int selStart = 0;
int selEnd = 3;
ESelection esel(0, selStart, 0, selEnd);
- constexpr OUString sText1(u" text"_ustr);
+ static constexpr OUString sText1(u" text"_ustr);
editEng.SetText(sText1);
CPPUNIT_ASSERT_EQUAL(u" "_ustr, editEng.GetText(esel));
@@ -1952,7 +1952,7 @@ void Test::testTdf148148()
selStart = 4;
selEnd = 8;
esel = ESelection(0, selStart, 0, selEnd);
- constexpr OUString sText2(u"text "_ustr);
+ static constexpr OUString sText2(u"text "_ustr);
editEng.SetText(sText2);
CPPUNIT_ASSERT_EQUAL(u" "_ustr, editEng.GetText(esel));
@@ -1965,7 +1965,7 @@ void Test::testTdf148148()
selStart = 0;
selEnd = 3;
esel = ESelection(0, selStart, 0, selEnd);
- constexpr OUString sText3(u" -1"_ustr);
+ static constexpr OUString sText3(u" -1"_ustr);
editEng.SetText(sText3);
CPPUNIT_ASSERT_EQUAL(u" "_ustr, editEng.GetText(esel));
@@ -1977,7 +1977,7 @@ void Test::testTdf148148()
selStart = 2;
selEnd = 6;
esel = ESelection(0, selStart, 0, selEnd);
- constexpr OUString sText4(u"-1 "_ustr);
+ static constexpr OUString sText4(u"-1 "_ustr);
editEng.SetText(sText4);
CPPUNIT_ASSERT_EQUAL(u" "_ustr, editEng.GetText(esel));
@@ -1990,7 +1990,7 @@ void Test::testTdf148148()
selStart = 0;
selEnd = 5;
esel = ESelection(0, selStart, 0, selEnd);
- constexpr OUString sText5(u" -1"_ustr);
+ static constexpr OUString sText5(u" -1"_ustr);
editEng.SetText(sText3);
CPPUNIT_ASSERT_EQUAL(u" -1"_ustr, editEng.GetText(esel));
@@ -2002,7 +2002,7 @@ void Test::testTdf148148()
selStart = 0;
selEnd = 5;
esel = ESelection(0, selStart, 0, selEnd);
- constexpr OUString sText6(u"-1 "_ustr);
+ static constexpr OUString sText6(u"-1 "_ustr);
editEng.SetText(sText4);
CPPUNIT_ASSERT_EQUAL(u"-1 "_ustr, editEng.GetText(esel));
diff --git a/editeng/source/items/numitem.cxx b/editeng/source/items/numitem.cxx
index c5e4240343b2..cd4a2e93146d 100644
--- a/editeng/source/items/numitem.cxx
+++ b/editeng/source/items/numitem.cxx
@@ -552,8 +552,8 @@ OUString SvxNumberFormat::CreateRomanString( sal_Int32 nNo, bool bUpper )
{
OUStringBuffer sRet;
- constexpr char romans[][13] = {"M", "CM", "D", "CD", "C", "XC", "L", "XL", "X", "IX", "V", "IV", "I"};
- constexpr sal_Int32 values[] = {1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1};
+ static constexpr char romans[][13] = {"M", "CM", "D", "CD", "C", "XC", "L", "XL", "X", "IX", "V", "IV", "I"};
+ static constexpr sal_Int32 values[] = {1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1};
for (size_t i = 0; i < std::size(romans); ++i)
{
diff --git a/i18npool/qa/cppunit/test_breakiterator.cxx b/i18npool/qa/cppunit/test_breakiterator.cxx
index 84ae6d5fe72b..e56089ad0c28 100644
--- a/i18npool/qa/cppunit/test_breakiterator.cxx
+++ b/i18npool/qa/cppunit/test_breakiterator.cxx
@@ -293,7 +293,7 @@ void TestBreakIterator::testLineBreaking()
aHyphOptions, aUserOptions);
CPPUNIT_ASSERT_EQUAL(sal_Int32{9}, aResult.breakIndex);
- constexpr OUString str = u"range of \u2212100.000 to 100.000"_ustr;
+ static constexpr OUString str = u"range of \u2212100.000 to 100.000"_ustr;
aResult = m_xBreak->getLineBreak(
str, strlen("range of -"), aLocale, 0, aHyphOptions, aUserOptions);
CPPUNIT_ASSERT_EQUAL(sal_Int32{9}, aResult.breakIndex);
@@ -311,7 +311,7 @@ void TestBreakIterator::testLineBreaking()
// Also the mathematical minus sign:
- constexpr OUString str = u"EURO is \u221210,50"_ustr;
+ static constexpr OUString str = u"EURO is \u221210,50"_ustr;
aResult = m_xBreak->getLineBreak(
str, strlen("EURO is -"), aLocale, 0, aHyphOptions, aUserOptions);
CPPUNIT_ASSERT_EQUAL(sal_Int32{8}, aResult.breakIndex);
@@ -327,7 +327,7 @@ void TestBreakIterator::testLineBreaking()
// But not the non-breaking hyphen:
- constexpr OUString str = u"und \u2011"_ustr;
+ static constexpr OUString str = u"und \u2011"_ustr;
aResult = m_xBreak->getLineBreak(
str, strlen("und -ko"), aLocale, 0, aHyphOptions, aUserOptions);
CPPUNIT_ASSERT_EQUAL(sal_Int32{5}, aResult.breakIndex);
@@ -672,7 +672,7 @@ void TestBreakIterator::testWordBoundaries()
//See https://bz.apache.org/ooo/show_bug.cgi?id=13494
{
- constexpr OUString aBase(u"xxAAxxBBxxCCxx"_ustr);
+ static constexpr OUString aBase(u"xxAAxxBBxxCCxx"_ustr);
const sal_Unicode aTests[] =
{
'\'', ';', ',', '.', '!', '@', '#', '%', '&', '*',
diff --git a/i18npool/source/collator/collator_unicode.cxx b/i18npool/source/collator/collator_unicode.cxx
index 0ecdae3e8569..4e19eed9de23 100644
--- a/i18npool/source/collator/collator_unicode.cxx
+++ b/i18npool/source/collator/collator_unicode.cxx
@@ -156,7 +156,7 @@ Collator_Unicode::loadCollatorAlgorithm(const OUString& rAlgorithm, const lang::
size_t (*funclen)() = nullptr;
#ifndef DISABLE_DYNLOADING
- constexpr OUString sModuleName( u"" SAL_MODULENAME( "i18npool" ) ""_ustr );
+ static constexpr OUString sModuleName( u"" SAL_MODULENAME( "i18npool" ) ""_ustr );
hModule = osl_loadModuleRelative( &thisModule, sModuleName.pData, SAL_LOADMODULE_DEFAULT );
if (hModule) {
OUStringBuffer aBuf("get_collator_data_" + rLocale.Language + "_");
diff --git a/sal/qa/osl/socket.cxx b/sal/qa/osl/socket.cxx
index 16b1366ba884..2a02e409a5a7 100644
--- a/sal/qa/osl/socket.cxx
+++ b/sal/qa/osl/socket.cxx
@@ -25,7 +25,7 @@ class SocketTest : public CppUnit::TestFixture
void test_createInetSocketAddr()
{
- OUString constexpr in(u"123.4.56.78"_ustr);
+ static constexpr OUString in(u"123.4.56.78"_ustr);
auto const addr = osl_createInetSocketAddr(in.pData, 100);
CPPUNIT_ASSERT(addr != nullptr);
CPPUNIT_ASSERT_EQUAL(osl_Socket_FamilyInet, osl_getFamilyOfSocketAddr(addr));
diff --git a/sal/qa/rtl/strings/test_oustring_stringliterals.cxx b/sal/qa/rtl/strings/test_oustring_stringliterals.cxx
index 25bc346fb495..1937029a1fdf 100644
--- a/sal/qa/rtl/strings/test_oustring_stringliterals.cxx
+++ b/sal/qa/rtl/strings/test_oustring_stringliterals.cxx
@@ -409,7 +409,7 @@ void test::oustring::StringLiterals::checkUtf16() {
void test::oustring::StringLiterals::checkEmbeddedNul() {
using namespace std::literals;
rtl::OUString const s("foobar");
- constexpr char16_t const a[] = u"foo\0hidden";
+ static constexpr char16_t const a[] = u"foo\0hidden";
char16_t const * const p = a;
CPPUNIT_ASSERT(s.startsWith(a));
CPPUNIT_ASSERT(s.startsWith(p));
diff --git a/sal/qa/rtl/strings/test_strings_defaultstringview.cxx b/sal/qa/rtl/strings/test_strings_defaultstringview.cxx
index cbedc3a8e461..87b1d79ed331 100644
--- a/sal/qa/rtl/strings/test_strings_defaultstringview.cxx
+++ b/sal/qa/rtl/strings/test_strings_defaultstringview.cxx
@@ -50,7 +50,8 @@ class Test : public CppUnit::TestFixture
CPPUNIT_ASSERT_EQUAL(true, u"foo"_ustr.startsWithIgnoreAsciiCase(std::u16string_view()));
CPPUNIT_ASSERT_EQUAL(true, u"foo"_ustr.endsWith(std::u16string_view()));
CPPUNIT_ASSERT_EQUAL(true, u"foo"_ustr.endsWithIgnoreAsciiCase(std::u16string_view()));
- OUString constexpr foo(u"foo"_ustr); // avoid loplugin:stringconstant, loplugin:stringview
+ static constexpr OUString foo(
+ u"foo"_ustr); // avoid loplugin:stringconstant, loplugin:stringview
CPPUNIT_ASSERT_EQUAL(false, foo == std::u16string_view());
CPPUNIT_ASSERT_EQUAL(true, foo != std::u16string_view());
CPPUNIT_ASSERT_EQUAL(false, foo < std::u16string_view());
diff --git a/sal/qa/rtl/textenc/rtl_textcvt.cxx b/sal/qa/rtl/textenc/rtl_textcvt.cxx
index 6780b37f55fe..fe6c8251d88d 100644
--- a/sal/qa/rtl/textenc/rtl_textcvt.cxx
+++ b/sal/qa/rtl/textenc/rtl_textcvt.cxx
@@ -3027,7 +3027,7 @@ void Test::testInvalidUtf8() {
auto const converter = rtl_createTextToUnicodeConverter(
RTL_TEXTENCODING_JAVA_UTF8);
CPPUNIT_ASSERT(converter != nullptr);
- constexpr OString input(u8"\U00010000"_ostr);
+ static constexpr OString input(u8"\U00010000"_ostr);
sal_Unicode buf[TEST_STRING_SIZE];
sal_uInt32 info;
sal_Size converted;
diff --git a/sal/rtl/strtmpl.hxx b/sal/rtl/strtmpl.hxx
index d13e5f73acd5..c5e2ff5810fd 100644
--- a/sal/rtl/strtmpl.hxx
+++ b/sal/rtl/strtmpl.hxx
@@ -1420,7 +1420,7 @@ void doubleToString(rtl_tString** pResult, sal_Int32* pResultCapacity, sal_Int32
if (std::isnan(fValue))
{
// #i112652# XMLSchema-2
- constexpr std::string_view nan{ "NaN" };
+ static constexpr std::string_view nan{ "NaN" };
return append(pResult, pResultCapacity, nResultOffset, nan);
}
diff --git a/sc/qa/unit/subsequent_export_test.cxx b/sc/qa/unit/subsequent_export_test.cxx
index f3a7399a78a0..ad8745ee1659 100644
--- a/sc/qa/unit/subsequent_export_test.cxx
+++ b/sc/qa/unit/subsequent_export_test.cxx
@@ -344,7 +344,8 @@ CPPUNIT_TEST_FIXTURE(ScExportTest, testTdf99856_dataValidationTest)
CPPUNIT_TEST_FIXTURE(ScExportTest, testProtectionKeyODS_UTF16LErtlSHA1)
{
- OUString constexpr password(u"1012345678901234567890123456789012345678901234567890"_ustr);
+ static OUString constexpr password(
+ u"1012345678901234567890123456789012345678901234567890"_ustr);
createScDoc("fods/protection-key1.fods");
@@ -370,7 +371,8 @@ CPPUNIT_TEST_FIXTURE(ScExportTest, testProtectionKeyODS_UTF16LErtlSHA1)
CPPUNIT_TEST_FIXTURE(ScExportTest, testProtectionKeyODS_UTF8SHA1)
{
- OUString constexpr password(u"1012345678901234567890123456789012345678901234567890"_ustr);
+ static OUString constexpr password(
+ u"1012345678901234567890123456789012345678901234567890"_ustr);
createScDoc("fods/protection-key2.fods");
@@ -396,7 +398,8 @@ CPPUNIT_TEST_FIXTURE(ScExportTest, testProtectionKeyODS_UTF8SHA1)
CPPUNIT_TEST_FIXTURE(ScExportTest, testProtectionKeyODS_UTF8SHA256ODF12)
{
- OUString constexpr password(u"1012345678901234567890123456789012345678901234567890"_ustr);
+ static OUString constexpr password(
+ u"1012345678901234567890123456789012345678901234567890"_ustr);
createScDoc("fods/protection-key3.fods");
@@ -424,7 +427,8 @@ CPPUNIT_TEST_FIXTURE(ScExportTest, testProtectionKeyODS_UTF8SHA256ODF12)
CPPUNIT_TEST_FIXTURE(ScExportTest, testProtectionKeyODS_UTF8SHA256W3C)
{
- OUString constexpr password(u"1012345678901234567890123456789012345678901234567890"_ustr);
+ static OUString constexpr password(
+ u"1012345678901234567890123456789012345678901234567890"_ustr);
createScDoc("fods/protection-key4.fods");
@@ -452,7 +456,8 @@ CPPUNIT_TEST_FIXTURE(ScExportTest, testProtectionKeyODS_UTF8SHA256W3C)
CPPUNIT_TEST_FIXTURE(ScExportTest, testProtectionKeyODS_XL_SHA1)
{
- OUString constexpr password(u"1012345678901234567890123456789012345678901234567890"_ustr);
+ static OUString constexpr password(
+ u"1012345678901234567890123456789012345678901234567890"_ustr);
createScDoc("fods/protection-key5.fods");
diff --git a/sc/qa/unit/subsequent_export_test2.cxx b/sc/qa/unit/subsequent_export_test2.cxx
index 514e88129214..91ef0a47a287 100644
--- a/sc/qa/unit/subsequent_export_test2.cxx
+++ b/sc/qa/unit/subsequent_export_test2.cxx
@@ -1040,7 +1040,7 @@ CPPUNIT_TEST_FIXTURE(ScExportTest2, testTdf112567)
CPPUNIT_TEST_FIXTURE(ScExportTest2, testTdf75702)
{
// The problem was that line breaks were not imported.
- constexpr OUString sA1(u"line1\nline2"_ustr);
+ static constexpr OUString sA1(u"line1\nline2"_ustr);
createScDoc("ods/tdf75702_textLineBreak.ods");
ScDocument* pDoc = getScDoc();
@@ -1059,8 +1059,8 @@ CPPUNIT_TEST_FIXTURE(ScExportTest2, testTdf103829)
{
// The problem was that tabspaces were not imported or exported at all.
// These strings match the current implementations of CELLTYPE_EDIT and CELLTYPE_STRING.
- constexpr OUString sA1(u"\x001Leading tab\nTHREE tabs inside: [\x001\x001\x001]"_ustr);
- constexpr OUString sA2(u"\tLeading tab. THREE tabs inside: [\t\t\t]"_ustr);
+ static constexpr OUString sA1(u"\x001Leading tab\nTHREE tabs inside: [\x001\x001\x001]"_ustr);
+ static constexpr OUString sA2(u"\tLeading tab. THREE tabs inside: [\t\t\t]"_ustr);
createScDoc("ods/tdf103829_textTab.ods");
ScDocument* pDoc = getScDoc();
diff --git a/sc/qa/unit/subsequent_export_test4.cxx b/sc/qa/unit/subsequent_export_test4.cxx
index fdb3b6f9a876..f545e2bae160 100644
--- a/sc/qa/unit/subsequent_export_test4.cxx
+++ b/sc/qa/unit/subsequent_export_test4.cxx
@@ -567,7 +567,7 @@ CPPUNIT_TEST_FIXTURE(ScExportTest4, testTdf154445_unused_pagestyles)
createScDoc("ods/tdf108188_pagestyle.ods");
// Check if the user defined page style is present
- constexpr OUString aTestPageStyle = u"TestPageStyle"_ustr;
+ static constexpr OUString aTestPageStyle = u"TestPageStyle"_ustr;
ScDocument* pDoc = getScDoc();
CPPUNIT_ASSERT_EQUAL(aTestPageStyle, pDoc->GetPageStyle(0));
diff --git a/sc/qa/unit/subsequent_filters_test3.cxx b/sc/qa/unit/subsequent_filters_test3.cxx
index 6358d0acd770..afdd54ef2ffc 100644
--- a/sc/qa/unit/subsequent_filters_test3.cxx
+++ b/sc/qa/unit/subsequent_filters_test3.cxx
@@ -258,7 +258,7 @@ CPPUNIT_TEST_FIXTURE(ScFiltersTest3, testWrapAndShrinkXLSXML)
bool bShrinkToFit;
};
- constexpr Check aChecks[] = {
+ static constexpr Check aChecks[] = {
{ 1, 0, false, false },
{ 1, 1, true, false },
{ 1, 2, false, true },
@@ -1775,7 +1775,7 @@ CPPUNIT_TEST_FIXTURE(ScFiltersTest3, testTdf108188_pagestyle)
createScDoc("ods/tdf108188_pagestyle.ods");
// Check if the user defined page style is present
- constexpr OUString aTestPageStyle = u"TestPageStyle"_ustr;
+ static constexpr OUString aTestPageStyle = u"TestPageStyle"_ustr;
ScDocument* pDoc = getScDoc();
CPPUNIT_ASSERT_EQUAL(aTestPageStyle, pDoc->GetPageStyle(0));
diff --git a/sc/qa/unit/subsequent_filters_test5.cxx b/sc/qa/unit/subsequent_filters_test5.cxx
index 6cc2351cffc0..a4ff94307c6b 100644
--- a/sc/qa/unit/subsequent_filters_test5.cxx
+++ b/sc/qa/unit/subsequent_filters_test5.cxx
@@ -38,8 +38,8 @@ CPPUNIT_TEST_FIXTURE(ScFiltersTest5, testTdf162963)
//tests xlsx -> ods -> ods of property "TotalsRow"
createScDoc("xlsx/tdf162963_TableWithTotalsEnabled.xlsx");
- constexpr OUString sDBName(u"myData"_ustr);
- constexpr OUString sPropName(u"TotalsRow"_ustr);
+ static constexpr OUString sDBName(u"myData"_ustr);
+ static constexpr OUString sPropName(u"TotalsRow"_ustr);
// Make sure the database range "myData" has TotalsRow TRUE after import from xlsx.
{
diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx
index 43569fa4fa47..8c63f99d82df 100644
--- a/sc/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx
@@ -1611,7 +1611,7 @@ CPPUNIT_TEST_FIXTURE(ScTiledRenderingTest, testLanguageStatus)
const SfxStringItem* pItem2 = dynamic_cast<const SfxStringItem*>(xItem2.get());
CPPUNIT_ASSERT(pItem1);
CPPUNIT_ASSERT(pItem2);
- constexpr OUString aLangBolivia(u"Spanish (Bolivia);es-BO"_ustr);
+ static constexpr OUString aLangBolivia(u"Spanish (Bolivia);es-BO"_ustr);
CPPUNIT_ASSERT_EQUAL(aLangBolivia, pItem1->GetValue());
CPPUNIT_ASSERT_EQUAL(aLangBolivia, pItem2->GetValue());
}
diff --git a/sc/qa/unit/ucalc_copypaste.cxx b/sc/qa/unit/ucalc_copypaste.cxx
index a58698f1e18e..056d439d6691 100644
--- a/sc/qa/unit/ucalc_copypaste.cxx
+++ b/sc/qa/unit/ucalc_copypaste.cxx
@@ -257,7 +257,7 @@ CPPUNIT_TEST_FIXTURE(TestCopyPaste, testCopyPaste)
ScRangeData* pLocal5 = new ScRangeData(*m_pDoc, u"local5"_ustr,
u"$A$1"_ustr); // implicit relative sheet reference
ScRangeData* pGlobal = new ScRangeData(*m_pDoc, u"global"_ustr, aAdr);
- constexpr OUString aGlobal2Symbol(u"$Sheet1.$A$1:$A$23"_ustr);
+ static constexpr OUString aGlobal2Symbol(u"$Sheet1.$A$1:$A$23"_ustr);
ScRangeData* pGlobal2 = new ScRangeData(*m_pDoc, u"global2"_ustr, aGlobal2Symbol);
std::unique_ptr<ScRangeName> pGlobalRangeName(new ScRangeName());
pGlobalRangeName->insert(pGlobal);
@@ -9983,7 +9983,7 @@ CPPUNIT_TEST_FIXTURE(TestCopyPaste, testCopyPasteFormulasExternalDoc)
m_xDocShell->DoLoad(pMedium);
ScDocShellRef xExtDocSh = new ScDocShell;
- OUString constexpr aExtDocName(u"file:///extdata.fake"_ustr);
+ static OUString constexpr aExtDocName(u"file:///extdata.fake"_ustr);
SfxMedium* pMed = new SfxMedium(aExtDocName, StreamMode::STD_READWRITE);
xExtDocSh->DoLoad(pMed);
CPPUNIT_ASSERT_MESSAGE("external document instance not loaded.",
diff --git a/sc/qa/unit/ucalc_formula.cxx b/sc/qa/unit/ucalc_formula.cxx
index 1660ce5daba4..23af64ecafea 100644
--- a/sc/qa/unit/ucalc_formula.cxx
+++ b/sc/qa/unit/ucalc_formula.cxx
@@ -1404,7 +1404,7 @@ CPPUNIT_TEST_FIXTURE(TestFormula, testFormulaAnnotateTrimOnDoubleRefs)
constexpr sal_Int32 nRows = 5;
// Values in A1:B5
- constexpr sal_Int32 aMat[nRows][nCols] = {
+ static constexpr sal_Int32 aMat[nRows][nCols] = {
{4, 50},
{5, 30},
{4, 40},
diff --git a/sc/qa/unit/ucalc_formula2.cxx b/sc/qa/unit/ucalc_formula2.cxx
index 4c4200cfac45..b59536b9a4f8 100644
--- a/sc/qa/unit/ucalc_formula2.cxx
+++ b/sc/qa/unit/ucalc_formula2.cxx
@@ -1558,8 +1558,8 @@ CPPUNIT_TEST_FIXTURE(TestFormula2, testExternalRef)
rExtDoc.InsertTab(1, aExtSh2Name);
rExtDoc.InsertTab(2, aExtSh3Name);
- OUString constexpr name(u"Name"_ustr);
- OUString constexpr value(u"Value"_ustr);
+ static OUString constexpr name(u"Name"_ustr);
+ static OUString constexpr value(u"Value"_ustr);
// Sheet 1
rExtDoc.SetString(0, 0, 0, name);
@@ -1717,7 +1717,7 @@ CPPUNIT_TEST_FIXTURE(TestFormula2, testExternalRef)
CPPUNIT_TEST_FIXTURE(TestFormula2, testExternalRangeName)
{
ScDocShellRef xExtDocSh = new ScDocShell;
- OUString constexpr aExtDocName(u"file:///extdata.fake"_ustr);
+ static OUString constexpr aExtDocName(u"file:///extdata.fake"_ustr);
SfxMedium* pMed = new SfxMedium(aExtDocName, StreamMode::STD_READWRITE);
xExtDocSh->DoLoad(pMed);
CPPUNIT_ASSERT_MESSAGE("external document instance not loaded.",
@@ -3515,8 +3515,8 @@ CPPUNIT_TEST_FIXTURE(TestFormula2, testFormulaErrorPropagation)
ScMarkData aMark(m_pDoc->GetSheetLimits());
aMark.SelectOneTable(0);
ScAddress aPos, aPos2;
- constexpr OUString aTRUE(u"TRUE"_ustr);
- constexpr OUString aFALSE(u"FALSE"_ustr);
+ static constexpr OUString aTRUE(u"TRUE"_ustr);
+ static constexpr OUString aFALSE(u"FALSE"_ustr);
aPos.Set(0, 0, 0); // A1
m_pDoc->SetValue(aPos, 1.0);
diff --git a/sc/qa/unit/ucalc_parallelism.cxx b/sc/qa/unit/ucalc_parallelism.cxx
index 12e25024931c..376e3a5e896c 100644
--- a/sc/qa/unit/ucalc_parallelism.cxx
+++ b/sc/qa/unit/ucalc_parallelism.cxx
@@ -604,7 +604,7 @@ CPPUNIT_TEST_FIXTURE(ScParallelismTest, testFormulaGroupSpanEvalNonGroup)
m_xDocShell->DoHardRecalc();
constexpr size_t nNumChanges = 12;
- constexpr size_t nChangeRows[nNumChanges] = {10, 11, 12, 101, 102, 103, 251, 252, 253, 503, 671, 1029};
+ static constexpr size_t nChangeRows[nNumChanges] = {10, 11, 12, 101, 102, 103, 251, 252, 253, 503, 671, 1029};
for (size_t nIdx = 0; nIdx < nNumChanges; ++nIdx)
{
size_t nRow = nChangeRows[nIdx];
diff --git a/sc/qa/unit/uicalc/uicalc2.cxx b/sc/qa/unit/uicalc/uicalc2.cxx
index b1ee2a0c9856..8a23aa88dd2e 100644
--- a/sc/qa/unit/uicalc/uicalc2.cxx
+++ b/sc/qa/unit/uicalc/uicalc2.cxx
@@ -340,7 +340,7 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest2, testTdf124816)
// The actual result is completely unrelated to this test and behaviour of
// OFFSET() was changed as of tdf#85551 and here result of that test
// document is now Err:502 instead of 0.
- constexpr OUString aExpectedResult(u"Err:502"_ustr);
+ static constexpr OUString aExpectedResult(u"Err:502"_ustr);
lcl_AssertCurrentCursorPosition(*pDocSh, u"D10");
CPPUNIT_ASSERT_EQUAL(aExpectedResult, pDoc->GetString(ScAddress(3, 9, 0)));
diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index 6400e082a567..b7b6e1e239aa 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -3268,7 +3268,7 @@ bool ScCompiler::ParsePredetectedReference( const OUString& rName )
// It could also be a broken invalidated reference that contains #REF!
// (but is not equal to), which we wrote prior to ODFF and also to ODFF
// between 2013 and 2016 until 5.1.4
- constexpr OUString aErrRef(u"#REF!"_ustr); // not localized in ODFF
+ static constexpr OUString aErrRef(u"#REF!"_ustr); // not localized in ODFF
sal_Int32 nPos = rName.indexOf( aErrRef);
if (nPos != -1)
{
diff --git a/sc/source/ui/dbgui/scuiasciiopt.cxx b/sc/source/ui/dbgui/scuiasciiopt.cxx
index 2789d33096c8..37a81c077053 100644
--- a/sc/source/ui/dbgui/scuiasciiopt.cxx
+++ b/sc/source/ui/dbgui/scuiasciiopt.cxx
@@ -698,7 +698,7 @@ void ScImportAsciiDlg::SetSeparators( sal_Unicode cSep )
{
// Exclusively set a separator, maFieldSeparators needs not be
// modified, it's obtained by GetSeparators() after this call.
- constexpr sal_Unicode aSeps[] = { '\t', ';', ',', ' ' };
+ static constexpr sal_Unicode aSeps[] = { '\t', ';', ',', ' ' };
for (const sal_Unicode c : aSeps)
{
const bool bSet = (c == cSep);
diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx
index cd6926739594..5bb6fb343ca4 100644
--- a/sc/source/ui/docshell/impex.cxx
+++ b/sc/source/ui/docshell/impex.cxx
@@ -580,7 +580,7 @@ static QuoteType lcl_isFieldEndQuote( const sal_Unicode* p, const sal_Unicode* p
// to be checked.
if (!rcDetectSep)
{
- constexpr sal_Unicode vSep[] = { ',', '\t', ';' };
+ static constexpr sal_Unicode vSep[] = { ',', '\t', ';' };
for (const sal_Unicode c : vSep)
{
if (p[1] == c)
diff --git a/sd/qa/unit/export-tests-ooxml1.cxx b/sd/qa/unit/export-tests-ooxml1.cxx
index d497887dafa0..46a26a2134d5 100644
--- a/sd/qa/unit/export-tests-ooxml1.cxx
+++ b/sd/qa/unit/export-tests-ooxml1.cxx
@@ -1610,7 +1610,7 @@ CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest1, testTdf140865Wordart3D)
xmlDocUniquePtr pXmlDoc = parseExport(u"ppt/slides/slide1.xml"_ustr);
// without the fix in place a:sp3d was lost on round trip, and so extrusion was lost.
- constexpr OString sPathStart("//p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:bodyPr"_ostr);
+ static constexpr OString sPathStart("//p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:bodyPr"_ostr);
assertXPath(pXmlDoc, sPathStart + "/a:sp3d", "extrusionH", u"342900");
assertXPath(pXmlDoc, sPathStart + "/a:sp3d", "contourW", u"12700");
assertXPath(pXmlDoc, sPathStart + "/a:sp3d/a:bevelT", "w", u"114300");
diff --git a/sd/qa/unit/export-tests.cxx b/sd/qa/unit/export-tests.cxx
index 01605bcedc88..b20064eb1006 100644
--- a/sd/qa/unit/export-tests.cxx
+++ b/sd/qa/unit/export-tests.cxx
@@ -784,7 +784,8 @@ CPPUNIT_TEST_FIXTURE(SdExportTest, testLinkedGraphicRT)
// Check if the graphic has been imported correctly (before doing the export/import run)
{
- constexpr OString sFailedImportMessage = "Failed to correctly import the document"_ostr;
+ static constexpr OString sFailedImportMessage
+ = "Failed to correctly import the document"_ostr;
SdXImpressDocument* pXImpressDocument
= dynamic_cast<SdXImpressDocument*>(mxComponent.get());
CPPUNIT_ASSERT(pXImpressDocument);
diff --git a/sd/qa/unit/layout-tests.cxx b/sd/qa/unit/layout-tests.cxx
index 8e3e19cdb3a2..9461068480e2 100644
--- a/sd/qa/unit/layout-tests.cxx
+++ b/sd/qa/unit/layout-tests.cxx
@@ -382,7 +382,7 @@ CPPUNIT_TEST_FIXTURE(SdLayoutTest, testTdf152906_AdjustToContour)
{
// Test that the text adjusts to contour properly
- constexpr OUString sText
+ static constexpr OUString sText
= u"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum consequat mi quis "
"pretium semper. Proin luctus orci ac neque venenatis, quis commodo dolor posuere. "
"Curabitur dignissim sapien quis cursus egestas. Donec blandit auctor arcu, nec "
diff --git a/sdext/source/pdfimport/wrapper/wrapper.cxx b/sdext/source/pdfimport/wrapper/wrapper.cxx
index ae9c9b3bf307..547ab148f954 100644
--- a/sdext/source/pdfimport/wrapper/wrapper.cxx
+++ b/sdext/source/pdfimport/wrapper/wrapper.cxx
@@ -1085,7 +1085,7 @@ bool xpdf_ImportFromFile(const OUString& rURL,
// spawn separate process to keep LGPL/GPL code apart.
- constexpr OUString aOptFlag(u"-o"_ustr);
+ static constexpr OUString aOptFlag(u"-o"_ustr);
std::vector<rtl_uString*> args({ aSysUPath.pData });
if (!rFilterOptions.isEmpty())
{
diff --git a/sfx2/source/control/dispatch.cxx b/sfx2/source/control/dispatch.cxx
index ec73bf047279..4d8008abf9c4 100644
--- a/sfx2/source/control/dispatch.cxx
+++ b/sfx2/source/control/dispatch.cxx
@@ -1524,7 +1524,7 @@ SfxSlotFilterState SfxDispatcher::IsSlotEnabledByFilter_Impl( sal_uInt16 nSID )
}
bool SfxDispatcher::IsCommandAllowedInLokReadOnlyViewMode (OUString commandName) {
- constexpr OUString allowedList[] = {
+ static constexpr OUString allowedList[] = {
u".uno:InsertAnnotation"_ustr,
u".uno:ReplyComment"_ustr,
u".uno:ResolveComment"_ustr,
diff --git a/sfx2/source/dialog/StyleList.cxx b/sfx2/source/dialog/StyleList.cxx
index b5970461bd6a..f534379e53dd 100644
--- a/sfx2/source/dialog/StyleList.cxx
+++ b/sfx2/source/dialog/StyleList.cxx
@@ -99,9 +99,9 @@ namespace
{
Color ColorHash(std::u16string_view rString)
{
- constexpr auto aSaturationArray = std::to_array<sal_uInt16>({ 90, 75, 60 });
- constexpr auto aBrightnessArray = std::to_array<sal_uInt16>({ 100, 80, 60 });
- constexpr auto aTintOrShadeArray
+ static constexpr auto aSaturationArray = std::to_array<sal_uInt16>({ 90, 75, 60 });
+ static constexpr auto aBrightnessArray = std::to_array<sal_uInt16>({ 100, 80, 60 });
+ static constexpr auto aTintOrShadeArray
= std::to_array<sal_Int16>({ 1'500, 3'000, 4'500, 6'500, 7'500 });
sal_uInt32 nStringHash = rtl_ustr_hashCode_WithLength(rString.data(), rString.length());
diff --git a/solenv/CompilerTest_compilerplugins_clang.mk b/solenv/CompilerTest_compilerplugins_clang.mk
index 95044e47758c..f365f0050154 100644
--- a/solenv/CompilerTest_compilerplugins_clang.mk
+++ b/solenv/CompilerTest_compilerplugins_clang.mk
@@ -80,6 +80,7 @@ $(eval $(call gb_CompilerTest_add_exception_objects,compilerplugins_clang, \
compilerplugins/clang/test/simplifydynamiccast \
compilerplugins/clang/test/simplifypointertobool \
compilerplugins/clang/test/singlevalfields \
+ compilerplugins/clang/test/staticconstexpr \
compilerplugins/clang/test/staticconstfield \
compilerplugins/clang/test/staticdynamic \
compilerplugins/clang/test/staticmethods \
diff --git a/svl/qa/unit/svl.cxx b/svl/qa/unit/svl.cxx
index a27651c808e0..1b90ee5c8b88 100644
--- a/svl/qa/unit/svl.cxx
+++ b/svl/qa/unit/svl.cxx
@@ -1379,7 +1379,7 @@ void Test::testUserDefinedNumberFormats()
OUString sCode, sExpected;
SvNumberFormatter aFormatter(m_xContext, eLang);
// tdf#158890 replace '?' with figure blank (0x2007)
- constexpr OUString sBlankDigit = u" "_ustr;
+ static constexpr OUString sBlankDigit = u" "_ustr;
{ // tdf#97835: suppress decimal separator
sCode = "0.##\" m\"";
sExpected = "12 m";
diff --git a/svl/qa/unit/test_lngmisc.cxx b/svl/qa/unit/test_lngmisc.cxx
index 7330db00b5ef..5af4d3b6ac84 100644
--- a/svl/qa/unit/test_lngmisc.cxx
+++ b/svl/qa/unit/test_lngmisc.cxx
@@ -134,7 +134,7 @@ void LngMiscTest::testReplaceControlChars()
void LngMiscTest::testGetThesaurusReplaceText()
{
- constexpr OUString str2(u"asdf"_ustr);
+ static constexpr OUString str2(u"asdf"_ustr);
OUString r = linguistic::GetThesaurusReplaceText(u""_ustr);
CPPUNIT_ASSERT(r.isEmpty());
diff --git a/svx/qa/unit/gallery/test_gallery.cxx b/svx/qa/unit/gallery/test_gallery.cxx
index 79f0d85c08e8..a8309778a8f8 100644
--- a/svx/qa/unit/gallery/test_gallery.cxx
+++ b/svx/qa/unit/gallery/test_gallery.cxx
@@ -166,7 +166,7 @@ void GalleryObjTest::TestThemeURLCase()
CPPUNIT_ASSERT_MESSAGE("Could not create gallery instance", (pGallery != nullptr));
// Mixed Case Theme Name
- constexpr OUString myThemeName = u"AddyTestTheme"_ustr;
+ static constexpr OUString myThemeName = u"AddyTestTheme"_ustr;
CPPUNIT_ASSERT_MESSAGE("Could not create theme", pGallery->CreateTheme(myThemeName));
CPPUNIT_ASSERT_MESSAGE("Could not find theme", pGallery->HasTheme(myThemeName));
@@ -243,7 +243,7 @@ void GalleryObjTest::TestGalleryThemeEntry()
std::unique_ptr<Gallery> pGallery(new Gallery(aGalleryURL));
CPPUNIT_ASSERT_MESSAGE("Could not create gallery instance", (pGallery != nullptr));
- constexpr OUString myThemeName = u"addytesttheme"_ustr;
+ static constexpr OUString myThemeName = u"addytesttheme"_ustr;
CPPUNIT_ASSERT_MESSAGE("Could not create theme", pGallery->CreateTheme(myThemeName));
CPPUNIT_ASSERT_MESSAGE("Could not find theme", pGallery->HasTheme(myThemeName));
@@ -463,7 +463,7 @@ void GalleryObjTest::TestGetThemeNameFromGalleryTheme()
std::unique_ptr<Gallery> pGallery(new Gallery(aGalleryURL));
CPPUNIT_ASSERT_MESSAGE("Could not create gallery instance", (pGallery != nullptr));
- constexpr OUString myThemeName = u"addytesttheme"_ustr;
+ static constexpr OUString myThemeName = u"addytesttheme"_ustr;
CPPUNIT_ASSERT_MESSAGE("Could not create theme", pGallery->CreateTheme(myThemeName));
CPPUNIT_ASSERT_MESSAGE("Could not find theme", pGallery->HasTheme(myThemeName));
diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx
index 4380fbc2fe6c..a11ab9a9d041 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -4138,7 +4138,7 @@ void SvxCurrencyToolBoxControl::GetCurrencySymbols(std::vector<OUString>& rList,
{
rCurrencyList.clear();
- constexpr OUString aTwoSpace = u" "_ustr;
+ static constexpr OUString aTwoSpace = u" "_ustr;
const NfCurrencyTable& rCurrencyTable = SvNumberFormatter::GetTheCurrencyTable();
sal_uInt16 nCount = rCurrencyTable.size();
diff --git a/sw/qa/core/test_ToxWhitespaceStripper.cxx b/sw/qa/core/test_ToxWhitespaceStripper.cxx
index 9edef692cc9c..4d9881f25bf2 100644
--- a/sw/qa/core/test_ToxWhitespaceStripper.cxx
+++ b/sw/qa/core/test_ToxWhitespaceStripper.cxx
@@ -113,7 +113,7 @@ void ToxWhitespaceStripperTest::StrippingWhitespacesFromVariousStringsWorks()
void ToxWhitespaceStripperTest::PositionAfterStringCanBeRequested()
{
- OUString constexpr test(u"abc"_ustr);
+ static OUString constexpr test(u"abc"_ustr);
ToxWhitespaceStripper sut(test);
sal_Int32 expected = test.getLength();
CPPUNIT_ASSERT_EQUAL(expected, sut.GetPositionInStrippedString(test.getLength()));
diff --git a/sw/qa/extras/htmlexport/htmlexport.cxx b/sw/qa/extras/htmlexport/htmlexport.cxx
index b1f11a2c4bca..7a6b4b15542c 100644
--- a/sw/qa/extras/htmlexport/htmlexport.cxx
+++ b/sw/qa/extras/htmlexport/htmlexport.cxx
@@ -1135,7 +1135,7 @@ CPPUNIT_TEST_FIXTURE(HtmlExportTest, testTdf126879)
{
createSwDoc("tdf126879.odt");
save(mpFilter);
- constexpr OString aExpected("<!DOCTYPE html>"_ostr);
+ static constexpr OString aExpected("<!DOCTYPE html>"_ostr);
SvStream* pStream = maTempFile.GetStream(StreamMode::READ);
CPPUNIT_ASSERT(pStream);
const OString aActual(read_uInt8s_ToOString(*pStream, aExpected.getLength()));
@@ -2749,7 +2749,7 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testHTML_PreserveSpaces)
// Given a document with leading, trailing, and repeating intermediate spaces:
createSwDoc();
SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
- constexpr OUString paraText = u"\t test \t more text \t"_ustr;
+ static constexpr OUString paraText = u"\t test \t more text \t"_ustr;
pWrtShell->Insert(paraText);
// When exporting to plain HTML, using PreserveSpaces:
@@ -2778,7 +2778,7 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqIF_PreserveSpaces)
// Given a document with leading, trailing, and repeating intermediate spaces:
createSwDoc();
SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
- constexpr OUString paraText = u"\t test \t more text \t"_ustr;
+ static constexpr OUString paraText = u"\t test \t more text \t"_ustr;
pWrtShell->Insert(paraText);
// When exporting to ReqIF, using PreserveSpaces:
diff --git a/sw/qa/extras/odfexport/odfexport.cxx b/sw/qa/extras/odfexport/odfexport.cxx
index 09d4707a68ba..d6e4c323ba58 100644
--- a/sw/qa/extras/odfexport/odfexport.cxx
+++ b/sw/qa/extras/odfexport/odfexport.cxx
@@ -1198,7 +1198,7 @@ DECLARE_ODFEXPORT_TEST(testCharacterBorder, "charborder.odt")
CPPUNIT_TEST_FIXTURE(Test, testProtectionKey)
{
auto verify = [this]() {
- OUString constexpr password(u"1012345678901234567890123456789012345678901234567890"_ustr);
+ static OUString constexpr password(u"1012345678901234567890123456789012345678901234567890"_ustr);
// check 1 invalid OOo legacy password and 3 valid ODF 1.2 passwords
uno::Reference<text::XTextSectionsSupplier> xTextSectionsSupplier(mxComponent, uno::UNO_QUERY);
diff --git a/sw/qa/extras/odfexport/odfexport2.cxx b/sw/qa/extras/odfexport/odfexport2.cxx
index d0353009a224..a8cea9a6bbfb 100644
--- a/sw/qa/extras/odfexport/odfexport2.cxx
+++ b/sw/qa/extras/odfexport/odfexport2.cxx
@@ -1676,7 +1676,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTableInFrameAnchoredToPage)
const OUString styleName = getXPath(pXmlDoc, path, attr);
return "//office:automatic-styles/style:style[@style:name='" + styleName.toUtf8() + "']";
};
- constexpr OString xPathTextBox = "//office:body/office:text/draw:frame/draw:text-box"_ostr;
+ static constexpr OString xPathTextBox = "//office:body/office:text/draw:frame/draw:text-box"_ostr;
// Check also, that autostyles defined inside that frame are stored correctly. If not, then
// these paragraphs would refer to styles in <office::styles>, not in <office:automatic-styles>,
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport20.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport20.cxx
index bfb777448fc3..c418c1904197 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport20.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport20.cxx
@@ -1133,7 +1133,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf159110)
// Given a text with an URL with multiple spaces
loadAndReload("multi_space_url.fodt");
- constexpr OUString sExpectedURL = u"http://www.example.org/path%20%20with%20%20spaces"_ustr;
+ static constexpr OUString sExpectedURL
+ = u"http://www.example.org/path%20%20with%20%20spaces"_ustr;
// Without the fix, this would have failed with
// - Expected: http://www.example.org/path%20%20with%20%20spaces
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
index 4af3730aa9a2..bf12d0178b62 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
@@ -1387,7 +1387,7 @@ DECLARE_OOXMLEXPORT_TEST(testActiveXOptionButtonGroup, "activex_option_button_gr
{
// Optionbutton groups were not handled
// The two optionbutton should have the same group name
- constexpr OUString sGroupName = u"GroupX"_ustr;
+ static constexpr OUString sGroupName = u"GroupX"_ustr;
uno::Reference<drawing::XControlShape> xControlShape(getShape(1), uno::UNO_QUERY);
CPPUNIT_ASSERT(xControlShape.is());
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
index a8329de27e82..9e5daa6dab96 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
@@ -1121,7 +1121,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf154319)
// tdf#154360: check tab stops between the number and the entry text
// The last (10th) level does not correspond to any MS level (only 9 levels there)
- constexpr sal_Int32 levelTabStops[]
+ static constexpr sal_Int32 levelTabStops[]
= { 776, 1552, 2328, 3104, 3881, 4657, 5433, 6209, 6985, -1 };
//start with level 1, 0 is the header level
diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx b/sw/qa/extras/uiwriter/uiwriter3.cxx
index b43030a41d71..a030ad9c10f8 100644
--- a/sw/qa/extras/uiwriter/uiwriter3.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter3.cxx
@@ -1651,7 +1651,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testToxmarkLinks)
// click on the links...
{
- OUString constexpr tmp(u"Table of Contents"_ustr);
+ static OUString constexpr tmp(u"Table of Contents"_ustr);
pWrtShell->GotoNextTOXBase(&tmp);
}
@@ -1686,7 +1686,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testToxmarkLinks)
}
{
- OUString constexpr tmp(u"User-Defined1"_ustr);
+ static OUString constexpr tmp(u"User-Defined1"_ustr);
pWrtShell->GotoNextTOXBase(&tmp);
}
@@ -1738,7 +1738,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testToxmarkLinks)
}
{
- OUString constexpr tmp(u"NewUD!|1"_ustr);
+ static OUString constexpr tmp(u"NewUD!|1"_ustr);
pWrtShell->GotoNextTOXBase(&tmp);
}
diff --git a/sw/qa/extras/uiwriter/uiwriter4.cxx b/sw/qa/extras/uiwriter/uiwriter4.cxx
index a59491bf7491..7df258900c9f 100644
--- a/sw/qa/extras/uiwriter/uiwriter4.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter4.cxx
@@ -653,7 +653,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testBookmarkCollapsed)
// load only content.xml from the resaved document
xmlDocUniquePtr pXmlDoc = parseExport(u"content.xml"_ustr);
- constexpr const char* aPath("/office:document-content/office:body/office:text/text:p");
+ const char* const aPath("/office:document-content/office:body/office:text/text:p");
const int pos1 = getXPathPosition(pXmlDoc, aPath, "bookmark");
CPPUNIT_ASSERT_EQUAL(0, pos1); // found, and it is first
@@ -824,7 +824,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testRemoveBookmarkTextAndAddNew)
// load only content.xml from the resaved document
xmlDocUniquePtr pXmlDoc = parseExport(u"content.xml"_ustr);
- constexpr const char* aPath("/office:document-content/office:body/office:text/text:p");
+ const char* const aPath("/office:document-content/office:body/office:text/text:p");
CPPUNIT_ASSERT_ASSERTION_FAIL(getXPathPosition(pXmlDoc, aPath, "bookmark")); // not found
const int pos2 = getXPathPosition(pXmlDoc, aPath, "bookmark-start");
@@ -887,7 +887,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testRemoveBookmarkTextAndAddNewAfterReload
// load only content.xml from the resaved document
xmlDocUniquePtr pXmlDoc = parseExport(u"content.xml"_ustr);
- constexpr const char* aPath("/office:document-content/office:body/office:text/text:p");
+ const char* const aPath("/office:document-content/office:body/office:text/text:p");
const int pos1 = getXPathPosition(pXmlDoc, aPath, "bookmark");
const int pos2 = getXPathPosition(pXmlDoc, aPath, "text");
@@ -1300,7 +1300,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testRedlineViewAuthor)
SwWrtShell* pWrtShell = pDocShell->GetWrtShell();
pWrtShell->Insert(u"middle"_ustr);
SwView* pView = pDocShell->GetView();
- constexpr OUString aAuthor(u"A U. Thor"_ustr);
+ static constexpr OUString aAuthor(u"A U. Thor"_ustr);
pView->SetRedlineAuthor(aAuthor);
pDocShell->SetView(pView);
@@ -2203,7 +2203,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testCreateDocxAnnotation)
createSwDoc();
// insert an annotation with a text
- constexpr OUString aSomeText(u"some text"_ustr);
+ static constexpr OUString aSomeText(u"some text"_ustr);
uno::Sequence<beans::PropertyValue> aPropertyValues = comphelper::InitPropertySequence({
{ "Text", uno::Any(aSomeText) },
{ "Author", uno::Any(u"me"_ustr) },
diff --git a/sw/qa/extras/uiwriter/uiwriter6.cxx b/sw/qa/extras/uiwriter/uiwriter6.cxx
index fd09758324d7..7d5bc22b8fa6 100644
--- a/sw/qa/extras/uiwriter/uiwriter6.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter6.cxx
@@ -900,7 +900,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf113481)
CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf115013)
{
- constexpr OUString sColumnName(u"Name with spaces, \"quotes\" and \\backslashes"_ustr);
+ static constexpr OUString sColumnName(u"Name with spaces, \"quotes\" and \\backslashes"_ustr);
utl::TempFileNamed aTempDir(nullptr, true);
aTempDir.EnableKillingFile();
diff --git a/sw/qa/extras/uiwriter/uiwriter7.cxx b/sw/qa/extras/uiwriter/uiwriter7.cxx
index 964ccc0b4482..fdd09d358fa1 100644
--- a/sw/qa/extras/uiwriter/uiwriter7.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter7.cxx
@@ -2392,8 +2392,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testUnicodeNotationToggle)
sDocString = pWrtShell->GetCursor()->GetPointNode().GetTextNode()->GetText();
CPPUNIT_ASSERT_EQUAL(sOriginalDocString, sDocString);
- constexpr OUString sWithCombiningSMPName = u"xyzU+4faeU+e0101"_ustr;
- constexpr OUString sWithCombiningSMP = u"xyz\U00004fae\U000e0101"_ustr;
+ static constexpr OUString sWithCombiningSMPName = u"xyzU+4faeU+e0101"_ustr;
+ static constexpr OUString sWithCombiningSMP = u"xyz\U00004fae\U000e0101"_ustr;
pWrtShell->SplitNode();
pWrtShell->Insert2(sWithCombiningSMPName);
dispatchCommand(mxComponent, u".uno:UnicodeNotationToggle"_ustr, aPropertyValues);
diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx
index 91e2fb05bc91..aae03e30cec9 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -4245,7 +4245,7 @@ std::shared_ptr<SfxItemSet> DocumentContentOperationsManager::lcl_createDelSet(S
RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END - 1>(rDoc.GetAttrPool()));
o3tl::sorted_vector<sal_uInt16> aAttribs;
- constexpr std::pair<sal_uInt16, sal_uInt16> aResetableSetRange[] = {
+ static constexpr std::pair<sal_uInt16, sal_uInt16> aResetableSetRange[] = {
// tdf#40496: we don't want to change writing direction, so exclude RES_FRAMEDIR:
{ RES_TXTATR_CHARFMT,RES_TXTATR_CHARFMT },
{ RES_FRMATR_BEGIN, RES_FRAMEDIR - 1 },
diff --git a/sw/source/core/doc/DocumentRedlineManager.cxx b/sw/source/core/doc/DocumentRedlineManager.cxx
index 34d9067a7201..642bf2c5a25b 100644
--- a/sw/source/core/doc/DocumentRedlineManager.cxx
+++ b/sw/source/core/doc/DocumentRedlineManager.cxx
@@ -969,7 +969,7 @@ namespace
SwPaM aPam( *pTNd, pTNd->GetText().getLength() );
o3tl::sorted_vector<sal_uInt16> aResetAttrsArray;
- constexpr std::pair<sal_uInt16, sal_uInt16> aResetableSetRange[] = {
+ static constexpr std::pair<sal_uInt16, sal_uInt16> aResetableSetRange[] = {
{ RES_PARATR_BEGIN, RES_PARATR_END - 1 },
{ RES_PARATR_LIST_BEGIN, RES_FRMATR_END - 1 },
};
diff --git a/sw/source/filter/html/css1atr.cxx b/sw/source/filter/html/css1atr.cxx
index 447e63351bd3..20a47b5a842c 100644
--- a/sw/source/filter/html/css1atr.cxx
+++ b/sw/source/filter/html/css1atr.cxx
@@ -3298,7 +3298,7 @@ SwHTMLWriter& OutCSS1_SvxBox( SwHTMLWriter& rWrt, const SfxPoolItem& rHt )
if( rHt.Which() == RES_CHRATR_BOX )
{
- constexpr std::string_view inline_block("inline-block");
+ static constexpr std::string_view inline_block("inline-block");
if( rWrt.m_bTagOn )
{
// Inline-block to make the line height changing correspond to the character border
diff --git a/sw/source/filter/ww8/docxexport.cxx b/sw/source/filter/ww8/docxexport.cxx
index f14bc8b603d6..438743ab0b0f 100644
--- a/sw/source/filter/ww8/docxexport.cxx
+++ b/sw/source/filter/ww8/docxexport.cxx
@@ -971,7 +971,7 @@ void DocxExport::WriteDocVars(const sax_fastparser::FSHelperPtr& pFS)
// Only write docVars if there will be at least a single docVar.
bool bStarted = false;
- constexpr OUString aPrefix(u"com.sun.star.text.fieldmaster.User."_ustr);
+ static constexpr OUString aPrefix(u"com.sun.star.text.fieldmaster.User."_ustr);
for (const auto& rMasterName : aMasterNames)
{
if (!rMasterName.startsWith(aPrefix))
diff --git a/sw/source/filter/ww8/rtfexport.cxx b/sw/source/filter/ww8/rtfexport.cxx
index ffd36410f4b6..b8c78f828375 100644
--- a/sw/source/filter/ww8/rtfexport.cxx
+++ b/sw/source/filter/ww8/rtfexport.cxx
@@ -706,7 +706,7 @@ void RtfExport::WriteDocVars()
}
// Only write docVars if there will be at least a single docVar.
- constexpr OUString aPrefix(u"com.sun.star.text.fieldmaster.User."_ustr);
+ static constexpr OUString aPrefix(u"com.sun.star.text.fieldmaster.User."_ustr);
for (const auto& rMasterName : aMasterNames)
{
if (!rMasterName.startsWith(aPrefix))
diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx
index 5317eb775023..845a2e7da5ab 100644
--- a/sw/source/filter/ww8/ww8par2.cxx
+++ b/sw/source/filter/ww8/ww8par2.cxx
@@ -729,7 +729,7 @@ SwNumRule* SwWW8ImplReader::GetStyRule()
if( m_xStyles->mpStyRule ) // Bullet-Style already present
return m_xStyles->mpStyRule;
- constexpr OUString aBaseName(u"WW8StyleNum"_ustr);
+ static constexpr OUString aBaseName(u"WW8StyleNum"_ustr);
const OUString aName( m_rDoc.GetUniqueNumRuleName( &aBaseName, false) );
// #i86652#
@@ -811,7 +811,7 @@ void SwWW8ImplReader::Read_ANLevelDesc( sal_uInt16, const sal_uInt8* pData, shor
// If NumRuleItems were set, either directly or through inheritance, disable them now
m_pCurrentColl->SetFormatAttr( SwNumRuleItem() );
- constexpr OUString aName(u"Outline"_ustr);
+ static constexpr OUString aName(u"Outline"_ustr);
SwNumRule aNR( m_rDoc.GetUniqueNumRuleName( &aName ),
SvxNumberFormat::LABEL_WIDTH_AND_POSITION,
OUTLINE_RULE );
diff --git a/sw/source/filter/ww8/ww8par3.cxx b/sw/source/filter/ww8/ww8par3.cxx
index 41604594f92e..f5ee3a1dc5fa 100644
--- a/sw/source/filter/ww8/ww8par3.cxx
+++ b/sw/source/filter/ww8/ww8par3.cxx
@@ -2272,7 +2272,7 @@ awt::Size SwWW8ImplReader::MiserableDropDownFormHack(const OUString &rString,
sal_uInt16 nWhichId;
OUString pPropNm;
};
- constexpr CtrlFontMapEntry aMapTable[] =
+ static constexpr CtrlFontMapEntry aMapTable[] =
{
{ RES_CHRATR_COLOR, u"TextColor"_ustr },
{ RES_CHRATR_FONT, u"FontName"_ustr },
diff --git a/sw/source/uibase/dbui/dbui.cxx b/sw/source/uibase/dbui/dbui.cxx
index fcac31282acb..0045a55dee65 100644
--- a/sw/source/uibase/dbui/dbui.cxx
+++ b/sw/source/uibase/dbui/dbui.cxx
@@ -62,8 +62,8 @@ CreateMonitor::~CreateMonitor()
void CreateMonitor::UpdateCountingText()
{
- constexpr OUStringLiteral sVariable_Total(u"%Y");
- constexpr OUStringLiteral sVariable_Position(u"%X");
+ static constexpr OUStringLiteral sVariable_Total(u"%Y");
+ static constexpr OUStringLiteral sVariable_Position(u"%X");
OUString sText(m_sCountingPattern);
sText = sText.replaceAll( sVariable_Total, OUString::number( m_nTotalCount ) );
diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx
index 1cb57d0a59cf..c770415f4a28 100644
--- a/sw/source/uibase/shells/textsh1.cxx
+++ b/sw/source/uibase/shells/textsh1.cxx
@@ -1155,7 +1155,7 @@ void SwTextShell::Execute(SfxRequest &rReq)
// remove the languages from that)
o3tl::sorted_vector<sal_uInt16> aAttribs;
- constexpr std::pair<sal_uInt16, sal_uInt16> aResetableSetRange[] = {
+ static constexpr std::pair<sal_uInt16, sal_uInt16> aResetableSetRange[] = {
// tdf#40496: we don't want to change writing direction, so exclude RES_FRAMEDIR:
{ RES_FRMATR_BEGIN, RES_FRAMEDIR - 1 },
{ RES_FRAMEDIR + 1, RES_FRMATR_END - 1 },
diff --git a/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx b/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx
index 4503f6ef5273..e1b225ed92dc 100644
--- a/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx
+++ b/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx
@@ -3512,7 +3512,7 @@ void DomainMapper_Impl::appendOLE( const OUString& rStreamName, const std::share
xOLE->setPropertyValue(u"LeftBorder"_ustr, uno::Any(aBorderProps));
xOLE->setPropertyValue(u"BottomBorder"_ustr, uno::Any(aBorderProps));
}
- constexpr OUString pProperties[] = {
+ static constexpr OUString pProperties[] = {
u"AnchorType"_ustr,
u"Surround"_ustr,
u"SurroundContour"_ustr,
@@ -5351,7 +5351,7 @@ static sal_Int16 lcl_ParseNumberingType( std::u16string_view rCommand )
// The command looks like: " PAGE \* Arabic "
// tdf#132185: but may as well be "PAGE \* Arabic"
OUString sNumber;
- constexpr OUString rSeparator(u"\\* "_ustr);
+ static constexpr OUString rSeparator(u"\\* "_ustr);
if (size_t nStartIndex = rCommand.find(rSeparator); nStartIndex != std::u16string_view::npos)
{
sal_Int32 nStartIndex2 = nStartIndex + rSeparator.getLength();
diff --git a/tools/qa/cppunit/test_rectangle.cxx b/tools/qa/cppunit/test_rectangle.cxx
index 12e46910bc2f..1d19774460c8 100644
--- a/tools/qa/cppunit/test_rectangle.cxx
+++ b/tools/qa/cppunit/test_rectangle.cxx
@@ -60,7 +60,7 @@ void RectangleTest::testConstruction()
CPPUNIT_ASSERT_EQUAL(tools::Long(0), aRect3.getOpenWidth());
}
{
- constexpr tools::Rectangle aRect(Point(), Size(-1, -2));
+ static constexpr tools::Rectangle aRect(Point(), Size(-1, -2));
static_assert(!aRect.IsEmpty());
static_assert(aRect.Right() == 0);
static_assert(aRect.Bottom() == -1);
@@ -69,17 +69,17 @@ void RectangleTest::testConstruction()
aRect2.SetSize(Size(-1, -2));
CPPUNIT_ASSERT_EQUAL(aRect, aRect2);
- constexpr tools::Rectangle aRect3(Point(), Size(0, 0));
+ static constexpr tools::Rectangle aRect3(Point(), Size(0, 0));
static_assert(aRect3.IsEmpty());
static_assert(aRect3.Right() == 0);
static_assert(aRect3.Bottom() == 0);
- constexpr tools::Rectangle aRect4(Point(), Size(1, 1));
+ static constexpr tools::Rectangle aRect4(Point(), Size(1, 1));
static_assert(!aRect4.IsEmpty());
static_assert(aRect4.Right() == 0);
static_assert(aRect4.Bottom() == 0);
- constexpr tools::Rectangle aRect5(Point(), Size(-1, -1));
+ static constexpr tools::Rectangle aRect5(Point(), Size(-1, -1));
static_assert(!aRect5.IsEmpty());
static_assert(aRect5.Right() == 0);
static_assert(aRect5.Bottom() == 0);
@@ -124,8 +124,8 @@ void RectangleTest::testOpenClosedSize()
void RectangleTest::testUnitConvesion()
{
{
- constexpr tools::Rectangle aRectTwip(100, 100, 100, 100);
- constexpr tools::Rectangle aRectMm100(
+ static constexpr tools::Rectangle aRectTwip(100, 100, 100, 100);
+ static constexpr tools::Rectangle aRectMm100(
o3tl::convert(aRectTwip, o3tl::Length::twip, o3tl::Length::mm100));
static_assert(!aRectMm100.IsEmpty());
// Make sure that we use coordinates for conversion, not width/height:
@@ -136,8 +136,8 @@ void RectangleTest::testUnitConvesion()
}
{
- constexpr tools::Rectangle aRectTwip(1, 1);
- constexpr tools::Rectangle aRectMm100(
+ static constexpr tools::Rectangle aRectTwip(1, 1);
+ static constexpr tools::Rectangle aRectMm100(
o3tl::convert(aRectTwip, o3tl::Length::twip, o3tl::Length::mm100));
// Make sure that result keeps the empty flag
static_assert(aRectMm100.IsEmpty());
@@ -150,10 +150,10 @@ void RectangleTest::testUnitConvesion()
void RectangleTest::testSetOperators()
{
- constexpr tools::Rectangle rect(Point(0, 0), Size(20, 20));
- constexpr tools::Rectangle inside(Point(10, 10), Size(10, 10));
- constexpr tools::Rectangle overlap(Point(10, 10), Size(20, 20));
- constexpr tools::Rectangle outside(Point(20, 20), Size(10, 10));
+ static constexpr tools::Rectangle rect(Point(0, 0), Size(20, 20));
+ static constexpr tools::Rectangle inside(Point(10, 10), Size(10, 10));
+ static constexpr tools::Rectangle overlap(Point(10, 10), Size(20, 20));
+ static constexpr tools::Rectangle outside(Point(20, 20), Size(10, 10));
CPPUNIT_ASSERT(rect.Contains(inside));
CPPUNIT_ASSERT(rect.Contains(rect));
CPPUNIT_ASSERT(!rect.Contains(overlap));
diff --git a/tools/qa/cppunit/test_stream.cxx b/tools/qa/cppunit/test_stream.cxx
index edec9c0fb7b3..0125259d5bc7 100644
--- a/tools/qa/cppunit/test_stream.cxx
+++ b/tools/qa/cppunit/test_stream.cxx
@@ -313,7 +313,7 @@ namespace
void Test::test_write_unicode()
{
- constexpr OUString write(u"abc"_ustr);
+ static constexpr OUString write(u"abc"_ustr);
utl::TempFileNamed aTempFile(u"test_write_unicode");
aTempFile.EnableKillingFile();
{
diff --git a/tools/source/generic/bigint.cxx b/tools/source/generic/bigint.cxx
index 80b86af6013c..2c705e30c755 100644
--- a/tools/source/generic/bigint.cxx
+++ b/tools/source/generic/bigint.cxx
@@ -74,8 +74,8 @@ void BigInt::Normalize()
if (nLen < 2)
{
- constexpr sal_uInt32 maxForPosInt32 = std::numeric_limits<sal_Int32>::max();
- constexpr sal_uInt32 maxForNegInt32 = -sal_Int64(std::numeric_limits<sal_Int32>::min());
+ static constexpr sal_uInt32 maxForPosInt32 = std::numeric_limits<sal_Int32>::max();
+ static constexpr sal_uInt32 maxForNegInt32 = -sal_Int64(std::numeric_limits<sal_Int32>::min());
sal_uInt32 nNum0 = nNum[0];
if (bIsNeg && nNum0 <= maxForNegInt32)
{
diff --git a/vcl/qa/cppunit/pdfexport/pdfexport2.cxx b/vcl/qa/cppunit/pdfexport/pdfexport2.cxx
index 72b2038b7d73..4bd91576bfec 100644
--- a/vcl/qa/cppunit/pdfexport/pdfexport2.cxx
+++ b/vcl/qa/cppunit/pdfexport/pdfexport2.cxx
@@ -4592,7 +4592,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testRexportMediaBoxOrigin)
auto pInnerIm = aDocument.LookupObject(12);
CPPUNIT_ASSERT(pInnerIm);
- constexpr sal_Int32 aOrigin[2] = { -800, -600 };
+ static constexpr sal_Int32 aOrigin[2] = { -800, -600 };
sal_Int32 aSize[2] = { 0, 0 };
auto pBBox = dynamic_cast<vcl::filter::PDFArrayElement*>(pInnerIm->Lookup("BBox"_ostr));
@@ -4692,11 +4692,11 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf152246)
CPPUNIT_ASSERT_EQUAL(size_t(1), aPages.size());
// Position array
- constexpr double aPos[5][4] = { { 55.699, 706.701, 132.401, 722.499 },
- { 197.499, 706.701, 274.201, 722.499 },
- { 302.349, 679.101, 379.051, 694.899 },
- { 479.599, 679.101, 556.301, 694.899 },
- { 55.699, 651.501, 132.401, 667.299 } };
+ static constexpr double aPos[5][4] = { { 55.699, 706.701, 132.401, 722.499 },
+ { 197.499, 706.701, 274.201, 722.499 },
+ { 302.349, 679.101, 379.051, 694.899 },
+ { 479.599, 679.101, 556.301, 694.899 },
+ { 55.699, 651.501, 132.401, 667.299 } };
// Get page annotations.
auto pAnnots = dynamic_cast<vcl::filter::PDFArrayElement*>(aPages[0]->Lookup("Annots"_ostr));
diff --git a/vcl/skia/gdiimpl.cxx b/vcl/skia/gdiimpl.cxx
index f6c7d21374bf..c97a1bebca5e 100644
--- a/vcl/skia/gdiimpl.cxx
+++ b/vcl/skia/gdiimpl.cxx
@@ -1521,7 +1521,7 @@ void SkiaSalGraphicsImpl::invert(basegfx::B2DPolygon const& rPoly, SalInvert eFl
// by clipping.
getDrawCanvas()->clipRect(aPath.getBounds(), SkClipOp::kIntersect, false);
aPaint.setStrokeWidth(2);
- constexpr float intervals[] = { 4.0f, 4.0f };
+ static constexpr float intervals[] = { 4.0f, 4.0f };
aPaint.setStyle(SkPaint::kStroke_Style);
aPaint.setPathEffect(SkDashPathEffect::Make(intervals, std::size(intervals), 0));
}
diff --git a/vcl/skia/salbmp.cxx b/vcl/skia/salbmp.cxx
index bba67fcbc439..d517d425eaf1 100644
--- a/vcl/skia/salbmp.cxx
+++ b/vcl/skia/salbmp.cxx
@@ -529,10 +529,10 @@ bool SkiaSalBitmap::ConvertToGreyscale()
// values from Bitmap::ImplMakeGreyscales(). Do not use kGray_8_SkColorType,
// Skia would use its gray conversion formula.
// NOTE: The matrix is 4x5 organized as columns (i.e. each line is a column, not a row).
- constexpr SkColorMatrix toGray(77 / 256.0, 151 / 256.0, 28 / 256.0, 0, 0, // R column
- 77 / 256.0, 151 / 256.0, 28 / 256.0, 0, 0, // G column
- 77 / 256.0, 151 / 256.0, 28 / 256.0, 0, 0, // B column
- 0, 0, 0, 1, 0); // don't modify alpha
+ static constexpr SkColorMatrix toGray(77 / 256.0, 151 / 256.0, 28 / 256.0, 0, 0, // R column
+ 77 / 256.0, 151 / 256.0, 28 / 256.0, 0, 0, // G column
+ 77 / 256.0, 151 / 256.0, 28 / 256.0, 0, 0, // B column
+ 0, 0, 0, 1, 0); // don't modify alpha
paint.setColorFilter(SkColorFilters::Matrix(toGray));
surface->getCanvas()->drawImage(mImage, 0, 0, SkSamplingOptions(), &paint);
mBitCount = 8;
@@ -987,10 +987,10 @@ const sk_sp<SkImage>& SkiaSalBitmap::GetAlphaSkImage(DirectImage direct) const
// Move the R channel value to the alpha channel. This seems to be the only
// way to reinterpret data in SkImage as an alpha SkImage without accessing the pixels.
// NOTE: The matrix is 4x5 organized as columns (i.e. each line is a column, not a row).
- constexpr SkColorMatrix redToAlpha(0, 0, 0, 0, 0, // R column
- 0, 0, 0, 0, 0, // G column
- 0, 0, 0, 0, 0, // B column
- 1, 0, 0, 0, 0); // A column
+ static constexpr SkColorMatrix redToAlpha(0, 0, 0, 0, 0, // R column
+ 0, 0, 0, 0, 0, // G column
+ 0, 0, 0, 0, 0, // B column
+ 1, 0, 0, 0, 0); // A column
SkPaint paint;
paint.setColorFilter(SkColorFilters::Matrix(redToAlpha));
if (scaling)
@@ -1046,10 +1046,10 @@ const sk_sp<SkImage>& SkiaSalBitmap::GetAlphaSkImage(DirectImage direct) const
// Move the R channel value to the alpha channel. This seems to be the only
// way to reinterpret data in SkImage as an alpha SkImage without accessing the pixels.
// NOTE: The matrix is 4x5 organized as columns (i.e. each line is a column, not a row).
- constexpr SkColorMatrix redToAlpha(0, 0, 0, 0, 0, // R column
- 0, 0, 0, 0, 0, // G column
- 0, 0, 0, 0, 0, // B column
- 1, 0, 0, 0, 0); // A column
+ static constexpr SkColorMatrix redToAlpha(0, 0, 0, 0, 0, // R column
+ 0, 0, 0, 0, 0, // G column
+ 0, 0, 0, 0, 0, // B column
+ 1, 0, 0, 0, 0); // A column
paint.setColorFilter(SkColorFilters::Matrix(redToAlpha));
surface->getCanvas()->drawImage(GetAsSkBitmap().asImage(), 0, 0, SkSamplingOptions(),
&paint);
diff --git a/vcl/source/app/svmain.cxx b/vcl/source/app/svmain.cxx
index a8a2412aa810..9ef22da996e6 100644
--- a/vcl/source/app/svmain.cxx
+++ b/vcl/source/app/svmain.cxx
@@ -197,7 +197,7 @@ int ImplSVMain()
#if !defined(_WIN32) && !defined(SYSTEM_OPENSSL)
if (!bWasInitVCL)
{
- OUString constexpr name(u"SSL_CERT_FILE"_ustr);
+ static constexpr OUString name(u"SSL_CERT_FILE"_ustr);
OUString temp;
if (osl_getEnvironment(name.pData, &temp.pData) == osl_Process_E_NotFound)
{
diff --git a/writerperfect/qa/unit/EPUBExportTest.cxx b/writerperfect/qa/unit/EPUBExportTest.cxx
index 8f85ce4a29bd..a9e08bdbed9a 100644
--- a/writerperfect/qa/unit/EPUBExportTest.cxx
+++ b/writerperfect/qa/unit/EPUBExportTest.cxx
@@ -166,7 +166,7 @@ CPPUNIT_TEST_FIXTURE(EPUBExportTest, testMimetype)
uno::Reference<lang::XMultiServiceFactory> xMSF(m_xContext->getServiceManager(),
uno::UNO_QUERY);
- constexpr OUString aServiceName(u"com.sun.star.comp.Writer.EPUBExportFilter"_ustr);
+ static constexpr OUString aServiceName(u"com.sun.star.comp.Writer.EPUBExportFilter"_ustr);
uno::Reference<document::XFilter> xFilter(xMSF->createInstance(aServiceName), uno::UNO_QUERY);
// Should result in no errors.
xFilter->cancel();
diff --git a/xmloff/qa/unit/draw.cxx b/xmloff/qa/unit/draw.cxx
index 0d0db156b86b..198173350d73 100644
--- a/xmloff/qa/unit/draw.cxx
+++ b/xmloff/qa/unit/draw.cxx
@@ -836,7 +836,7 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testTdf161327_LatheEndAngle)
// get scene object
uno::Reference<drawing::XShape> xSceneShape(getShape(0));
- constexpr OUString sExpected(u"com.sun.star.drawing.Shape3DSceneObject"_ustr);
+ static constexpr OUString sExpected(u"com.sun.star.drawing.Shape3DSceneObject"_ustr);
CPPUNIT_ASSERT_EQUAL(sExpected, xSceneShape->getShapeType());
// Examine child objects
diff --git a/xmlsecurity/qa/unit/signing/signing.cxx b/xmlsecurity/qa/unit/signing/signing.cxx
index 11197a9bf6fa..8408ca421666 100644
--- a/xmlsecurity/qa/unit/signing/signing.cxx
+++ b/xmlsecurity/qa/unit/signing/signing.cxx
@@ -591,8 +591,8 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testODFDoubleX509Certificate)
CPPUNIT_TEST_FIXTURE(SigningTest, testDNCompatibility)
{
- OUString constexpr msDN(u"CN=\"\"\"ABC\"\".\", O=\"Enterprise \"\"ABC\"\"\""_ustr);
- OUString constexpr nssDN(u"CN=\\\"ABC\\\".,O=Enterprise \\\"ABC\\\""_ustr);
+ static constexpr OUString msDN(u"CN=\"\"\"ABC\"\".\", O=\"Enterprise \"\"ABC\"\"\""_ustr);
+ static constexpr OUString nssDN(u"CN=\\\"ABC\\\".,O=Enterprise \\\"ABC\\\""_ustr);
// this is just the status quo, possibly either NSS or CryptoAPI might change
CPPUNIT_ASSERT(!xmlsecurity::EqualDistinguishedNames(msDN, nssDN, xmlsecurity::NOCOMPAT));
CPPUNIT_ASSERT(!xmlsecurity::EqualDistinguishedNames(nssDN, msDN, xmlsecurity::NOCOMPAT));
diff --git a/xmlsecurity/source/xmlsec/nss/sanextension_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/sanextension_nssimpl.cxx
index 1395cb2e8acb..b01f021ba261 100644
--- a/xmlsecurity/source/xmlsec/nss/sanextension_nssimpl.cxx
+++ b/xmlsecurity/source/xmlsec/nss/sanextension_nssimpl.cxx
@@ -152,7 +152,7 @@ css::uno::Sequence< css::security::CertAltNameEntry > SAL_CALL SanExtensionImpl:
OString SanExtensionImpl::removeOIDFromString( const OString &oidString)
{
OString objID;
- constexpr std::string_view oid("OID.");
+ static constexpr std::string_view oid("OID.");
if (oidString.match(oid))
objID = oidString.copy(oid.size());
else
diff --git a/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx
index c0fc6a4fc7c4..bed7772c5791 100644
--- a/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx
+++ b/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx
@@ -184,7 +184,7 @@ css::uno::Sequence< css::uno::Reference< css::security::XCertificateExtension >
// remove "OID." prefix if existing
OString objID;
- constexpr std::string_view oid("OID.");
+ static constexpr std::string_view oid("OID.");
if (oidString.match(oid))
objID = oidString.copy(oid.size());
else