summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--avmedia/source/gstreamer/gstplayer.cxx6
-rw-r--r--compilerplugins/clang/stringliteraldefine.cxx172
-rw-r--r--compilerplugins/clang/test/stringliteraldefine.cxx56
-rw-r--r--desktop/source/migration/services/jvmfwk.cxx2
-rw-r--r--i18npool/source/indexentry/indexentrysupplier.cxx2
-rw-r--r--l10ntools/source/xmlparse.cxx2
-rw-r--r--solenv/CompilerTest_compilerplugins_clang.mk1
-rw-r--r--svx/source/form/datanavi.cxx48
-rw-r--r--testtools/source/bridgetest/bridgetest.cxx8
-rw-r--r--testtools/source/bridgetest/cppobj.cxx6
-rw-r--r--ucb/source/ucp/ftp/ftpcontent.cxx4
-rw-r--r--unotools/source/config/cmdoptions.cxx2
-rw-r--r--unotools/source/config/compatibility.cxx2
-rw-r--r--unotools/source/config/fontcfg.cxx16
-rw-r--r--unotools/source/config/moduleoptions.cxx2
15 files changed, 279 insertions, 50 deletions
diff --git a/avmedia/source/gstreamer/gstplayer.cxx b/avmedia/source/gstreamer/gstplayer.cxx
index 2e723ce6efbc..4f12f80f5ded 100644
--- a/avmedia/source/gstreamer/gstplayer.cxx
+++ b/avmedia/source/gstreamer/gstplayer.cxx
@@ -42,12 +42,12 @@
#include "gstwindow.hxx"
#include <gst/video/videooverlay.h>
-#define AVMEDIA_GST_PLAYER_IMPLEMENTATIONNAME "com.sun.star.comp.avmedia.Player_GStreamer"
-#define AVMEDIA_GST_PLAYER_SERVICENAME "com.sun.star.media.Player_GStreamer"
-
#include <gst/pbutils/missing-plugins.h>
#include <gst/pbutils/pbutils.h>
+constexpr OUStringLiteral AVMEDIA_GST_PLAYER_IMPLEMENTATIONNAME = u"com.sun.star.comp.avmedia.Player_GStreamer";
+constexpr OUStringLiteral AVMEDIA_GST_PLAYER_SERVICENAME = u"com.sun.star.media.Player_GStreamer";
+
#define AVVERSION "gst 1.0: "
using namespace ::com::sun::star;
diff --git a/compilerplugins/clang/stringliteraldefine.cxx b/compilerplugins/clang/stringliteraldefine.cxx
new file mode 100644
index 000000000000..0eda65e7bea2
--- /dev/null
+++ b/compilerplugins/clang/stringliteraldefine.cxx
@@ -0,0 +1,172 @@
+/* -*- 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/.
+ */
+
+// Find constant character array variables that are either
+// (a) passed into O[U]String constructors
+// (b) assigned to O[U]String
+// and are declared using macro names
+// and should thus be turned into O[U]StringLiteral variables.
+//
+
+#include <cassert>
+
+#include "check.hxx"
+#include "plugin.hxx"
+
+namespace
+{
+class StringLiteralDefine final : public loplugin::FilteringPlugin<StringLiteralDefine>
+{
+public:
+ explicit StringLiteralDefine(loplugin::InstantiationData const& data)
+ : FilteringPlugin(data)
+ {
+ }
+
+ bool TraverseInitListExpr(InitListExpr* expr, DataRecursionQueue* queue = nullptr)
+ {
+ return WalkUpFromInitListExpr(expr)
+ && TraverseSynOrSemInitListExpr(
+ expr->isSemanticForm() ? expr : expr->getSemanticForm(), queue);
+ }
+
+ bool VisitCXXConstructExpr(CXXConstructExpr const* expr)
+ {
+ if (ignoreLocation(expr))
+ return true;
+ loplugin::TypeCheck const tc(expr->getType());
+ if (!(tc.Class("OString").Namespace("rtl").GlobalNamespace()
+ || tc.Class("OUString").Namespace("rtl").GlobalNamespace()))
+ {
+ return true;
+ }
+ auto const ctor = expr->getConstructor();
+ if (ctor->getNumParams() != 2)
+ return true;
+
+ const Expr* arg0 = expr->getArg(0)->IgnoreParenImpCasts();
+ auto const e1 = dyn_cast<clang::StringLiteral>(arg0);
+ if (!e1)
+ return true;
+ auto argLoc = compat::getBeginLoc(arg0);
+ // check if the arg is a macro
+ auto macroLoc = compiler.getSourceManager().getSpellingLoc(argLoc);
+ if (argLoc == macroLoc)
+ return true;
+ // check if it is the right kind of macro (not particularly reliable checks)
+ if (!macroLoc.isValid() || !compiler.getSourceManager().isInMainFile(macroLoc)
+ || compiler.getSourceManager().isInSystemHeader(macroLoc)
+// not sure when these became available
+#if CLANG_VERSION >= 130000
+ || compiler.getSourceManager().isWrittenInBuiltinFile(macroLoc)
+ || compiler.getSourceManager().isWrittenInScratchSpace(macroLoc)
+ || compiler.getSourceManager().isWrittenInCommandLineFile(macroLoc)
+#endif
+ || isInUnoIncludeFile(macroLoc))
+ return true;
+ StringRef fileName = getFilenameOfLocation(macroLoc);
+ StringRef name{ Lexer::getImmediateMacroName(
+ compat::getBeginLoc(arg0), compiler.getSourceManager(), compiler.getLangOpts()) };
+ if (loplugin::hasPathnamePrefix(fileName, SRCDIR "/config_host/"))
+ return true;
+ // used in both OUString and OString context
+ if (name == "FM_COL_LISTBOX" || name == "HID_RELATIONDIALOG_LEFTFIELDCELL"
+ || name == "OOO_HELP_INDEX" || name == "IMP_PNG" || name.startswith("MNI_ACTION_"))
+ return true;
+ if (loplugin::hasPathnamePrefix(fileName, SRCDIR "/svx/source/stbctrls/pszctrl.cxx"))
+ return true;
+ // used as a prefix and/or concatenated with other strings
+ if (name.startswith("UNO_JAVA_JFW") || name == "SETNODE_BINDINGS" || name == "PATHDELIMITER"
+ || name == "SETNODE_ALLFILEFORMATS" || name == "SETNODE_DISABLED"
+ || name == "XMLNS_DIALOGS_PREFIX" || name == "XMLNS_LIBRARY_PREFIX"
+ || name == "XMLNS_SCRIPT_PREFIX" || name == "XMLNS_TOOLBAR" || name == "XMLNS_XLINK"
+ || name == "XMLNS_XLINK_PREFIX")
+ return true;
+ if (loplugin::hasPathnamePrefix(fileName,
+ SRCDIR "/stoc/source/security/access_controller.cxx")
+ && (name == "SERVICE_NAME" || name == "USER_CREDS"))
+ return true;
+ if (loplugin::hasPathnamePrefix(fileName, SRCDIR "/stoc/source/security/file_policy.cxx")
+ && name == "IMPL_NAME")
+ return true;
+ if (loplugin::hasPathnamePrefix(fileName,
+ SRCDIR "/desktop/source/migration/services/jvmfwk.cxx")
+ && name == "IMPL_NAME")
+ return true;
+ if (loplugin::hasPathnamePrefix(
+ fileName, SRCDIR "/xmlsecurity/source/xmlsec/xmldocumentwrapper_xmlsecimpl.cxx")
+ && name == "STRXMLNS")
+ return true;
+ if (loplugin::hasPathnamePrefix(fileName, SRCDIR "/sw/source/ui/fldui/fldvar.cxx")
+ && name == "USER_DATA_VERSION_1")
+ return true;
+ // not sure how to exclude the case where the whole block is in a macro
+ // (vs. what I am looking for - regular code with a macro name as the argument)
+ if (name == "assert" || name == "SAL_INFO" || name == "DECLIMPL_SERVICEINFO_DERIVED"
+ || name == "OSL_VERIFY" || name == "OSL_ENSURE" || name == "DECL_PROP_2"
+ || name == "DECL_PROP_3" || name == "DECL_PROP_1" || name == "DECL_DEP_PROP_2"
+ || name == "DECL_DEP_PROP_3" || name == "CALL_ELEMENT_HANDLER_AND_CARE_FOR_EXCEPTIONS"
+ || name == "IMPLEMENT_SERVICE_INFO" || name == "SQL_GET_REFERENCES"
+ || name == "SFX_IMPL_OBJECTFACTORY" || name == "IMPLEMENT_SERVICE_INFO1"
+ || name == "IMPLEMENT_SERVICE_INFO2" || name == "IMPLEMENT_SERVICE_INFO3"
+ || name == "IMPLEMENT_SERVICE_INFO_IMPLNAME" || name == "SC_SIMPLE_SERVICE_INFO"
+ || name == "SC_SIMPLE_SERVICE_INFO_COMPAT" || name == "OUT_COMMENT"
+ || name == "LOCALE_EN" || name == "LOCALE" || name == "VBAFONTBASE_PROPNAME"
+ || name == "VBAHELPER_IMPL_XHELPERINTERFACE" || name == "IMPRESS_MAP_ENTRIES"
+ || name == "DRAW_MAP_ENTRIES" || name == "DRAW_PAGE_NOTES_PROPERTIES"
+ || name == "COMMON_FLDTYP_PROPERTIES" || name == "GRAPHIC_PAGE_PROPERTIES"
+ || name == "makeDelay" || name == "makeEvent" || name == "OOO_IMPORTER"
+ || name == "DBG_ASSERT" || name.startswith("CPPUNIT_ASSERT"))
+ return true;
+ if (loplugin::hasPathnamePrefix(fileName, SRCDIR
+ "/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx")
+ && name == "DEFAULT_SIZE")
+ return true;
+ if (loplugin::hasPathnamePrefix(fileName, SRCDIR "/filter/source/t602/t602filter.cxx"))
+ return true;
+ if (loplugin::hasPathnamePrefix(fileName, SRCDIR "/hwpfilter/source/formula.cxx"))
+ return true;
+ if (loplugin::hasPathnamePrefix(fileName, SRCDIR "/hwpfilter/source/hwpreader.cxx"))
+ return true;
+ if (loplugin::hasPathnamePrefix(fileName, SRCDIR "/filter/source/svg/svgexport.cxx")
+ && name == "NSPREFIX")
+ return true;
+
+ if (!reported_.insert(macroLoc).second)
+ return true;
+
+ report(DiagnosticsEngine::Warning,
+ "change macro '%0' to 'constexpr "
+ "%select{OStringLiteral|OUStringLiteral}1'",
+ macroLoc)
+ << name << (tc.Class("OString").Namespace("rtl").GlobalNamespace() ? 0 : 1);
+ report(DiagnosticsEngine::Note, "macro used here", compat::getBeginLoc(arg0))
+ << arg0->getSourceRange();
+ return true;
+ }
+
+ bool preRun() override { return compiler.getLangOpts().CPlusPlus; }
+
+private:
+ void run() override
+ {
+ if (preRun())
+ {
+ TraverseDecl(compiler.getASTContext().getTranslationUnitDecl());
+ }
+ }
+
+ std::set<SourceLocation> reported_;
+};
+
+// Off by default because it needs some hand-holding
+static loplugin::Plugin::Registration<StringLiteralDefine> reg("stringliteraldefine", false);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/compilerplugins/clang/test/stringliteraldefine.cxx b/compilerplugins/clang/test/stringliteraldefine.cxx
new file mode 100644
index 000000000000..ba5f718ed86d
--- /dev/null
+++ b/compilerplugins/clang/test/stringliteraldefine.cxx
@@ -0,0 +1,56 @@
+/* -*- 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 <vector>
+
+#include <rtl/ustring.hxx>
+#include <sal/macros.h>
+
+void f(OUString const&);
+
+void f1()
+{
+// expected-error@+1 {{change macro 'XXX' to 'constexpr OUStringLiteral' [loplugin:stringliteraldefine]}}
+#define XXX "xxx"
+
+ // expected-note@+1 {{macro used here [loplugin:stringliteraldefine]}}
+ f(OUString(XXX));
+
+ // FIXME no warning expected
+ //#define FOO f(OUString("xxx"))
+ // FOO;
+}
+
+void f2()
+{
+ struct DataFlavorRepresentation
+ {
+ OUString pMimeType;
+ };
+
+// expected-error@+1 {{change macro 'MIMETYPE_VND_SUN_XML_WRITER_ASCII' to 'constexpr OUStringLiteral' [loplugin:stringliteraldefine]}}
+#define MIMETYPE_VND_SUN_XML_WRITER_ASCII "xxx"
+ static const DataFlavorRepresentation aInstance[] = {
+ // expected-note@+1 {{macro used here [loplugin:stringliteraldefine]}}
+ { MIMETYPE_VND_SUN_XML_WRITER_ASCII },
+ };
+}
+
+void f3()
+{
+// expected-error@+1 {{change macro 'YYY' to 'constexpr OUStringLiteral' [loplugin:stringliteraldefine]}}
+#define YYY "yyy"
+
+ // expected-note@+1 {{macro used here [loplugin:stringliteraldefine]}}
+ f(YYY);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/desktop/source/migration/services/jvmfwk.cxx b/desktop/source/migration/services/jvmfwk.cxx
index d388692e4be5..65eff6767459 100644
--- a/desktop/source/migration/services/jvmfwk.cxx
+++ b/desktop/source/migration/services/jvmfwk.cxx
@@ -40,7 +40,7 @@
#include <osl/diagnose.h>
-#define SERVICE_NAME "com.sun.star.migration.Java"
+constexpr OUStringLiteral SERVICE_NAME = u"com.sun.star.migration.Java";
#define IMPL_NAME "com.sun.star.comp.desktop.migration.Java"
#define ENABLE_JAVA 1
diff --git a/i18npool/source/indexentry/indexentrysupplier.cxx b/i18npool/source/indexentry/indexentrysupplier.cxx
index bbaa2cc21c37..0b463315e872 100644
--- a/i18npool/source/indexentry/indexentrysupplier.cxx
+++ b/i18npool/source/indexentry/indexentrysupplier.cxx
@@ -171,7 +171,7 @@ OUString SAL_CALL IndexEntrySupplier::getIndexFollowPageWord( sal_Bool bMorePage
aFollowPageWords[0] : OUString());
}
-#define implementationName "com.sun.star.i18n.IndexEntrySupplier"
+constexpr OUStringLiteral implementationName = u"com.sun.star.i18n.IndexEntrySupplier";
OUString SAL_CALL
IndexEntrySupplier::getImplementationName()
diff --git a/l10ntools/source/xmlparse.cxx b/l10ntools/source/xmlparse.cxx
index e7c4fad6eb95..bb37352f71dc 100644
--- a/l10ntools/source/xmlparse.cxx
+++ b/l10ntools/source/xmlparse.cxx
@@ -36,7 +36,7 @@
using namespace osl;
-#define XML_LANG "xml-lang"
+constexpr OStringLiteral XML_LANG = "xml-lang";
diff --git a/solenv/CompilerTest_compilerplugins_clang.mk b/solenv/CompilerTest_compilerplugins_clang.mk
index b2dd397bbf46..53f51e0759ba 100644
--- a/solenv/CompilerTest_compilerplugins_clang.mk
+++ b/solenv/CompilerTest_compilerplugins_clang.mk
@@ -91,6 +91,7 @@ $(eval $(call gb_CompilerTest_add_exception_objects,compilerplugins_clang, \
compilerplugins/clang/test/stringconcatliterals \
compilerplugins/clang/test/stringconstant \
compilerplugins/clang/test/stringliteralvar \
+ compilerplugins/clang/test/stringliteraldefine \
compilerplugins/clang/test/stringloop \
compilerplugins/clang/test/stringstatic \
compilerplugins/clang/test/stringview \
diff --git a/svx/source/form/datanavi.cxx b/svx/source/form/datanavi.cxx
index 4d5ac51af1d3..ea553e28810e 100644
--- a/svx/source/form/datanavi.cxx
+++ b/svx/source/form/datanavi.cxx
@@ -74,36 +74,36 @@ namespace svxform
{
// properties of instance
- #define PN_INSTANCE_MODEL "Instance"
- #define PN_INSTANCE_ID "ID"
- #define PN_INSTANCE_URL "URL"
+ constexpr OUStringLiteral PN_INSTANCE_MODEL = u"Instance";
+ constexpr OUStringLiteral PN_INSTANCE_ID = u"ID";
+ constexpr OUStringLiteral PN_INSTANCE_URL = u"URL";
// properties of binding
- #define PN_BINDING_ID "BindingID"
- #define PN_BINDING_EXPR "BindingExpression"
- #define PN_BINDING_MODEL "Model"
- #define PN_BINDING_NAMESPACES "ModelNamespaces"
- #define PN_READONLY_EXPR "ReadonlyExpression"
- #define PN_RELEVANT_EXPR "RelevantExpression"
- #define PN_REQUIRED_EXPR "RequiredExpression"
- #define PN_CONSTRAINT_EXPR "ConstraintExpression"
- #define PN_CALCULATE_EXPR "CalculateExpression"
- #define PN_BINDING_TYPE "Type"
+ constexpr OUStringLiteral PN_BINDING_ID = u"BindingID";
+ constexpr OUStringLiteral PN_BINDING_EXPR = u"BindingExpression";
+ constexpr OUStringLiteral PN_BINDING_MODEL = u"Model";
+ constexpr OUStringLiteral PN_BINDING_NAMESPACES = u"ModelNamespaces";
+ constexpr OUStringLiteral PN_READONLY_EXPR = u"ReadonlyExpression";
+ constexpr OUStringLiteral PN_RELEVANT_EXPR = u"RelevantExpression";
+ constexpr OUStringLiteral PN_REQUIRED_EXPR = u"RequiredExpression";
+ constexpr OUStringLiteral PN_CONSTRAINT_EXPR = u"ConstraintExpression";
+ constexpr OUStringLiteral PN_CALCULATE_EXPR = u"CalculateExpression";
+ constexpr OUStringLiteral PN_BINDING_TYPE = u"Type";
// properties of submission
- #define PN_SUBMISSION_ID "ID"
- #define PN_SUBMISSION_BIND "Bind"
- #define PN_SUBMISSION_REF "Ref"
- #define PN_SUBMISSION_ACTION "Action"
- #define PN_SUBMISSION_METHOD "Method"
- #define PN_SUBMISSION_REPLACE "Replace"
+ constexpr OUStringLiteral PN_SUBMISSION_ID = u"ID";
+ constexpr OUStringLiteral PN_SUBMISSION_BIND = u"Bind";
+ constexpr OUStringLiteral PN_SUBMISSION_REF = u"Ref";
+ constexpr OUStringLiteral PN_SUBMISSION_ACTION = u"Action";
+ constexpr OUStringLiteral PN_SUBMISSION_METHOD = u"Method";
+ constexpr OUStringLiteral PN_SUBMISSION_REPLACE = u"Replace";
// other const strings
- #define TRUE_VALUE "true()"
- #define NEW_ELEMENT "newElement"
- #define NEW_ATTRIBUTE "newAttribute"
- #define EVENTTYPE_CHARDATA "DOMCharacterDataModified"
- #define EVENTTYPE_ATTR "DOMAttrModified"
+ constexpr OUStringLiteral TRUE_VALUE = u"true()";
+ constexpr OUStringLiteral NEW_ELEMENT = u"newElement";
+ constexpr OUStringLiteral NEW_ATTRIBUTE = u"newAttribute";
+ constexpr OUStringLiteral EVENTTYPE_CHARDATA = u"DOMCharacterDataModified";
+ constexpr OUStringLiteral EVENTTYPE_ATTR = u"DOMAttrModified";
#define MIN_PAGE_COUNT 3 // at least one instance, one submission and one binding page
diff --git a/testtools/source/bridgetest/bridgetest.cxx b/testtools/source/bridgetest/bridgetest.cxx
index bb1c3af497f2..5860708695d2 100644
--- a/testtools/source/bridgetest/bridgetest.cxx
+++ b/testtools/source/bridgetest/bridgetest.cxx
@@ -67,10 +67,10 @@ using namespace com::sun::star::bridge;
using namespace test::testtools::bridgetest;
-#define SERVICENAME "com.sun.star.test.bridge.BridgeTest"
-#define IMPLNAME "com.sun.star.comp.bridge.BridgeTest"
+constexpr OUStringLiteral SERVICENAME = u"com.sun.star.test.bridge.BridgeTest";
+constexpr OUStringLiteral IMPLNAME = u"com.sun.star.comp.bridge.BridgeTest";
-#define STRING_TEST_CONSTANT "\" paco\' chorizo\\\' \"\'"
+constexpr OUStringLiteral STRING_TEST_CONSTANT = u"\" paco\' chorizo\\\' \"\'";
namespace bridge_test
{
@@ -1313,7 +1313,7 @@ SAL_DLLPUBLIC_EXPORT void * component_getFactory(
{
void * pRet = nullptr;
- if (pServiceManager && rtl_str_compare( pImplName, IMPLNAME ) == 0)
+ if (pServiceManager && OUString(IMPLNAME).equalsAscii(pImplName))
{
Reference< XInterface > xFactory(
createSingleComponentFactory(
diff --git a/testtools/source/bridgetest/cppobj.cxx b/testtools/source/bridgetest/cppobj.cxx
index f8cfb521351e..9d5b469d48c7 100644
--- a/testtools/source/bridgetest/cppobj.cxx
+++ b/testtools/source/bridgetest/cppobj.cxx
@@ -61,8 +61,8 @@ using namespace test::testtools::bridgetest;
#pragma warning (disable : 4503) // irrelevant for test code
#endif
-#define SERVICENAME "com.sun.star.test.bridge.CppTestObject"
-#define IMPLNAME "com.sun.star.comp.bridge.CppTestObject"
+constexpr OUStringLiteral SERVICENAME = u"com.sun.star.test.bridge.CppTestObject";
+constexpr OUStringLiteral IMPLNAME = u"com.sun.star.comp.bridge.CppTestObject";
namespace bridge_object
{
@@ -1199,7 +1199,7 @@ SAL_DLLPUBLIC_EXPORT void * component_getFactory(
{
void * pRet = nullptr;
- if (pServiceManager && rtl_str_compare( pImplName, IMPLNAME ) == 0)
+ if (pServiceManager && OUString(IMPLNAME).equalsAscii(pImplName))
{
Reference< XSingleServiceFactory > xFactory( createSingleFactory(
static_cast< XMultiServiceFactory * >( pServiceManager ),
diff --git a/ucb/source/ucp/ftp/ftpcontent.cxx b/ucb/source/ucp/ftp/ftpcontent.cxx
index b10d6469506f..3b035681da95 100644
--- a/ucb/source/ucp/ftp/ftpcontent.cxx
+++ b/ucb/source/ucp/ftp/ftpcontent.cxx
@@ -557,9 +557,9 @@ Any SAL_CALL FTPContent::execute( const Command& aCommand,
}
}
-#define FTP_FILE "application/vnd.sun.staroffice.ftp-file"
+constexpr OUStringLiteral FTP_FILE = u"application/vnd.sun.staroffice.ftp-file";
-#define FTP_FOLDER "application/vnd.sun.staroffice.ftp-folder"
+constexpr OUStringLiteral FTP_FOLDER = u"application/vnd.sun.staroffice.ftp-folder";
Sequence<ContentInfo > SAL_CALL
FTPContent::queryCreatableContentsInfo( )
diff --git a/unotools/source/config/cmdoptions.cxx b/unotools/source/config/cmdoptions.cxx
index 631c3ddbfb1d..b61e49840390 100644
--- a/unotools/source/config/cmdoptions.cxx
+++ b/unotools/source/config/cmdoptions.cxx
@@ -40,7 +40,7 @@ using namespace ::osl;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::beans;
-#define ROOTNODE_CMDOPTIONS "Office.Commands/Execute"
+constexpr OUStringLiteral ROOTNODE_CMDOPTIONS = u"Office.Commands/Execute";
#define PATHDELIMITER "/"
#define SETNODE_DISABLED "Disabled"
diff --git a/unotools/source/config/compatibility.cxx b/unotools/source/config/compatibility.cxx
index 46d50889f6bc..b12cf6174d58 100644
--- a/unotools/source/config/compatibility.cxx
+++ b/unotools/source/config/compatibility.cxx
@@ -39,7 +39,7 @@ using namespace ::osl;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::beans;
-#define ROOTNODE_OPTIONS "Office.Compatibility"
+constexpr OUStringLiteral ROOTNODE_OPTIONS = u"Office.Compatibility";
#define PATHDELIMITER "/"
#define SETNODE_ALLFILEFORMATS "AllFileFormats"
diff --git a/unotools/source/config/fontcfg.cxx b/unotools/source/config/fontcfg.cxx
index 9c26795e2611..cfa6705a41c6 100644
--- a/unotools/source/config/fontcfg.cxx
+++ b/unotools/source/config/fontcfg.cxx
@@ -241,14 +241,14 @@ OUString DefaultFontConfiguration::getUserInterfaceFont( const LanguageTag& rLan
// fallback mechanism (either no configuration or no entry in configuration
- #define FALLBACKFONT_UI_SANS "Andale Sans UI;Albany;Albany AMT;Tahoma;Arial Unicode MS;Arial;Nimbus Sans L;Bitstream Vera Sans;gnu-unifont;Interface User;Geneva;WarpSans;Dialog;Swiss;Lucida;Helvetica;Charcoal;Chicago;MS Sans Serif;Helv;Times;Times New Roman;Interface System"
- #define FALLBACKFONT_UI_SANS_LATIN2 "Andale Sans UI;Albany;Albany AMT;Tahoma;Arial Unicode MS;Arial;Nimbus Sans L;Luxi Sans;Bitstream Vera Sans;Interface User;Geneva;WarpSans;Dialog;Swiss;Lucida;Helvetica;Charcoal;Chicago;MS Sans Serif;Helv;Times;Times New Roman;Interface System"
- #define FALLBACKFONT_UI_SANS_ARABIC "Tahoma;Traditional Arabic;Simplified Arabic;Lucidasans;Lucida Sans;Supplement;Andale Sans UI;clearlyU;Interface User;Arial Unicode MS;Lucida Sans Unicode;WarpSans;Geneva;MS Sans Serif;Helv;Dialog;Albany;Lucida;Helvetica;Charcoal;Chicago;Arial;Helmet;Interface System;Sans Serif"
- #define FALLBACKFONT_UI_SANS_THAI "OONaksit;Tahoma;Lucidasans;Arial Unicode MS"
- #define FALLBACKFONT_UI_SANS_KOREAN "Noto Sans KR;Noto Sans CJK KR;Noto Serif KR;Noto Serif CJK KR;Source Han Sans KR;NanumGothic;NanumBarunGothic;NanumBarunGothic YetHangul;KoPubWorld Dotum;Malgun Gothic;Apple SD Gothic Neo;Dotum;DotumChe;Gulim;GulimChe;Batang;BatangChe;Apple Gothic;UnDotum;Baekmuk Gulim;Arial Unicode MS;Lucida Sans Unicode;gnu-unifont;Andale Sans UI"
- #define FALLBACKFONT_UI_SANS_JAPANESE "Noto Sans CJK JP;Noto Sans JP;Source Han Sans;Source Han Sans JP;Yu Gothic UI;Yu Gothic;YuGothic;Hiragino Sans;Hiragino Kaku Gothic ProN;Hiragino Kaku Gothic Pro;Hiragino Kaku Gothic StdN;Meiryo UI;Meiryo;IPAexGothic;IPAPGothic;IPAGothic;MS UI Gothic;MS PGothic;MS Gothic;Osaka;Unifont;gnu-unifont;Arial Unicode MS;Interface System"
- #define FALLBACKFONT_UI_SANS_CHINSIM "Andale Sans UI;Arial Unicode MS;ZYSong18030;AR PL SungtiL GB;AR PL KaitiM GB;SimSun;Lucida Sans Unicode;Fangsong;Hei;Song;Kai;Ming;gnu-unifont;Interface User;"
- #define FALLBACKFONT_UI_SANS_CHINTRD "Andale Sans UI;Arial Unicode MS;AR PL Mingti2L Big5;AR PL KaitiM Big5;Kai;PMingLiU;MingLiU;Ming;Lucida Sans Unicode;gnu-unifont;Interface User;"
+ static constexpr OUStringLiteral FALLBACKFONT_UI_SANS = u"Andale Sans UI;Albany;Albany AMT;Tahoma;Arial Unicode MS;Arial;Nimbus Sans L;Bitstream Vera Sans;gnu-unifont;Interface User;Geneva;WarpSans;Dialog;Swiss;Lucida;Helvetica;Charcoal;Chicago;MS Sans Serif;Helv;Times;Times New Roman;Interface System";
+ static constexpr OUStringLiteral FALLBACKFONT_UI_SANS_LATIN2 = u"Andale Sans UI;Albany;Albany AMT;Tahoma;Arial Unicode MS;Arial;Nimbus Sans L;Luxi Sans;Bitstream Vera Sans;Interface User;Geneva;WarpSans;Dialog;Swiss;Lucida;Helvetica;Charcoal;Chicago;MS Sans Serif;Helv;Times;Times New Roman;Interface System";
+ static constexpr OUStringLiteral FALLBACKFONT_UI_SANS_ARABIC = u"Tahoma;Traditional Arabic;Simplified Arabic;Lucidasans;Lucida Sans;Supplement;Andale Sans UI;clearlyU;Interface User;Arial Unicode MS;Lucida Sans Unicode;WarpSans;Geneva;MS Sans Serif;Helv;Dialog;Albany;Lucida;Helvetica;Charcoal;Chicago;Arial;Helmet;Interface System;Sans Serif";
+ static constexpr OUStringLiteral FALLBACKFONT_UI_SANS_THAI = u"OONaksit;Tahoma;Lucidasans;Arial Unicode MS";
+ static constexpr OUStringLiteral FALLBACKFONT_UI_SANS_KOREAN = u"Noto Sans KR;Noto Sans CJK KR;Noto Serif KR;Noto Serif CJK KR;Source Han Sans KR;NanumGothic;NanumBarunGothic;NanumBarunGothic YetHangul;KoPubWorld Dotum;Malgun Gothic;Apple SD Gothic Neo;Dotum;DotumChe;Gulim;GulimChe;Batang;BatangChe;Apple Gothic;UnDotum;Baekmuk Gulim;Arial Unicode MS;Lucida Sans Unicode;gnu-unifont;Andale Sans UI";
+ static constexpr OUStringLiteral FALLBACKFONT_UI_SANS_JAPANESE = u"Noto Sans CJK JP;Noto Sans JP;Source Han Sans;Source Han Sans JP;Yu Gothic UI;Yu Gothic;YuGothic;Hiragino Sans;Hiragino Kaku Gothic ProN;Hiragino Kaku Gothic Pro;Hiragino Kaku Gothic StdN;Meiryo UI;Meiryo;IPAexGothic;IPAPGothic;IPAGothic;MS UI Gothic;MS PGothic;MS Gothic;Osaka;Unifont;gnu-unifont;Arial Unicode MS;Interface System";
+ static constexpr OUStringLiteral FALLBACKFONT_UI_SANS_CHINSIM = u"Andale Sans UI;Arial Unicode MS;ZYSong18030;AR PL SungtiL GB;AR PL KaitiM GB;SimSun;Lucida Sans Unicode;Fangsong;Hei;Song;Kai;Ming;gnu-unifont;Interface User;";
+ static constexpr OUStringLiteral FALLBACKFONT_UI_SANS_CHINTRD = u"Andale Sans UI;Arial Unicode MS;AR PL Mingti2L Big5;AR PL KaitiM Big5;Kai;PMingLiU;MingLiU;Ming;Lucida Sans Unicode;gnu-unifont;Interface User;";
const OUString aLanguage( aLanguageTag.getLanguage());
diff --git a/unotools/source/config/moduleoptions.cxx b/unotools/source/config/moduleoptions.cxx
index 44205dd06a59..0af82141d30a 100644
--- a/unotools/source/config/moduleoptions.cxx
+++ b/unotools/source/config/moduleoptions.cxx
@@ -52,7 +52,7 @@
e.g.:
NAMELIST[ PROPERTYHANDLE_xxx ] => VALUELIST[ PROPERTYHANDLE_xxx ]
*//*-*************************************************************************************************************/
-#define ROOTNODE_FACTORIES "Setup/Office/Factories"
+constexpr OUStringLiteral ROOTNODE_FACTORIES = u"Setup/Office/Factories";
#define PATHSEPARATOR "/"
// Attention: The property "ooSetupFactoryEmptyDocumentURL" is read from configuration but not used! There is