From dfe417c369dc6e1a943e030e736a47a00306f3ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Thu, 11 Apr 2019 21:06:37 +0200 Subject: [PATCH] msvc compatibility: /constexpr/const/ --- gui/projectfile.cpp | 82 ++++++++++++++++++++----------------------- lib/importproject.cpp | 82 ++++++++++++++++++++----------------------- 2 files changed, 78 insertions(+), 86 deletions(-) diff --git a/gui/projectfile.cpp b/gui/projectfile.cpp index f276e00a0..22796f633 100644 --- a/gui/projectfile.cpp +++ b/gui/projectfile.cpp @@ -25,49 +25,45 @@ #include "projectfile.h" #include "common.h" -#ifdef _MSC_VER -#define constexpr const // TODO what handling of constexpr is there is MSC -#endif - -static constexpr char ProjectElementName[] = "project"; -static constexpr char ProjectVersionAttrib[] = "version"; -static constexpr char ProjectFileVersion[] = "1"; -static constexpr char BuildDirElementName[] = "builddir"; -static constexpr char ImportProjectElementName[] = "importproject"; -static constexpr char AnalyzeAllVsConfigsElementName[] = "analyze-all-vs-configs"; -static constexpr char IncludeDirElementName[] = "includedir"; -static constexpr char DirElementName[] = "dir"; -static constexpr char DirNameAttrib[] = "name"; -static constexpr char DefinesElementName[] = "defines"; -static constexpr char DefineName[] = "define"; -static constexpr char DefineNameAttrib[] = "name"; -static constexpr char UndefinesElementName[] = "undefines"; -static constexpr char UndefineName[] = "undefine"; -static constexpr char PathsElementName[] = "paths"; -static constexpr char PathName[] = "dir"; -static constexpr char PathNameAttrib[] = "name"; -static constexpr char RootPathName[] = "root"; -static constexpr char RootPathNameAttrib[] = "name"; -static constexpr char IgnoreElementName[] = "ignore"; -static constexpr char IgnorePathName[] = "path"; -static constexpr char IgnorePathNameAttrib[] = "name"; -static constexpr char ExcludeElementName[] = "exclude"; -static constexpr char ExcludePathName[] = "path"; -static constexpr char ExcludePathNameAttrib[] = "name"; -static constexpr char LibrariesElementName[] = "libraries"; -static constexpr char LibraryElementName[] = "library"; -static constexpr char PlatformElementName[] = "platform"; -static constexpr char SuppressionsElementName[] = "suppressions"; -static constexpr char SuppressionElementName[] = "suppression"; -static constexpr char AddonElementName[] = "addon"; -static constexpr char AddonsElementName[] = "addons"; -static constexpr char ToolElementName[] = "tool"; -static constexpr char ToolsElementName[] = "tools"; -static constexpr char TagsElementName[] = "tags"; -static constexpr char TagElementName[] = "tag"; -static constexpr char CheckHeadersElementName[] = "check-headers"; -static constexpr char CheckUnusedTemplatesElementName[] = "check-unused-templates"; -static constexpr char MaxCtuDepthElementName[] = "max-ctu-depth"; +static const char ProjectElementName[] = "project"; +static const char ProjectVersionAttrib[] = "version"; +static const char ProjectFileVersion[] = "1"; +static const char BuildDirElementName[] = "builddir"; +static const char ImportProjectElementName[] = "importproject"; +static const char AnalyzeAllVsConfigsElementName[] = "analyze-all-vs-configs"; +static const char IncludeDirElementName[] = "includedir"; +static const char DirElementName[] = "dir"; +static const char DirNameAttrib[] = "name"; +static const char DefinesElementName[] = "defines"; +static const char DefineName[] = "define"; +static const char DefineNameAttrib[] = "name"; +static const char UndefinesElementName[] = "undefines"; +static const char UndefineName[] = "undefine"; +static const char PathsElementName[] = "paths"; +static const char PathName[] = "dir"; +static const char PathNameAttrib[] = "name"; +static const char RootPathName[] = "root"; +static const char RootPathNameAttrib[] = "name"; +static const char IgnoreElementName[] = "ignore"; +static const char IgnorePathName[] = "path"; +static const char IgnorePathNameAttrib[] = "name"; +static const char ExcludeElementName[] = "exclude"; +static const char ExcludePathName[] = "path"; +static const char ExcludePathNameAttrib[] = "name"; +static const char LibrariesElementName[] = "libraries"; +static const char LibraryElementName[] = "library"; +static const char PlatformElementName[] = "platform"; +static const char SuppressionsElementName[] = "suppressions"; +static const char SuppressionElementName[] = "suppression"; +static const char AddonElementName[] = "addon"; +static const char AddonsElementName[] = "addons"; +static const char ToolElementName[] = "tool"; +static const char ToolsElementName[] = "tools"; +static const char TagsElementName[] = "tags"; +static const char TagElementName[] = "tag"; +static const char CheckHeadersElementName[] = "check-headers"; +static const char CheckUnusedTemplatesElementName[] = "check-unused-templates"; +static const char MaxCtuDepthElementName[] = "max-ctu-depth"; ProjectFile::ProjectFile(QObject *parent) : QObject(parent) diff --git a/lib/importproject.cpp b/lib/importproject.cpp index f3d206a3f..5db57c2dc 100644 --- a/lib/importproject.cpp +++ b/lib/importproject.cpp @@ -937,50 +937,46 @@ static std::string join(const std::list &strlist, const char *sep) return ret; } -#ifdef _MSC_VER -#define constexpr const // TODO what handling of constexpr is there is MSC -#endif - // These constants are copy/pasted from gui/projectfile.cpp -static constexpr char ProjectElementName[] = "project"; -static constexpr char ProjectVersionAttrib[] = "version"; -static constexpr char ProjectFileVersion[] = "1"; -static constexpr char BuildDirElementName[] = "builddir"; -static constexpr char ImportProjectElementName[] = "importproject"; -static constexpr char AnalyzeAllVsConfigsElementName[] = "analyze-all-vs-configs"; -static constexpr char IncludeDirElementName[] = "includedir"; -static constexpr char DirElementName[] = "dir"; -static constexpr char DirNameAttrib[] = "name"; -static constexpr char DefinesElementName[] = "defines"; -static constexpr char DefineName[] = "define"; -static constexpr char DefineNameAttrib[] = "name"; -static constexpr char UndefinesElementName[] = "undefines"; -static constexpr char UndefineName[] = "undefine"; -static constexpr char PathsElementName[] = "paths"; -static constexpr char PathName[] = "dir"; -static constexpr char PathNameAttrib[] = "name"; -static constexpr char RootPathName[] = "root"; -static constexpr char RootPathNameAttrib[] = "name"; -static constexpr char IgnoreElementName[] = "ignore"; -static constexpr char IgnorePathName[] = "path"; -static constexpr char IgnorePathNameAttrib[] = "name"; -static constexpr char ExcludeElementName[] = "exclude"; -static constexpr char ExcludePathName[] = "path"; -static constexpr char ExcludePathNameAttrib[] = "name"; -static constexpr char LibrariesElementName[] = "libraries"; -static constexpr char LibraryElementName[] = "library"; -static constexpr char PlatformElementName[] = "platform"; -static constexpr char SuppressionsElementName[] = "suppressions"; -static constexpr char SuppressionElementName[] = "suppression"; -static constexpr char AddonElementName[] = "addon"; -static constexpr char AddonsElementName[] = "addons"; -static constexpr char ToolElementName[] = "tool"; -static constexpr char ToolsElementName[] = "tools"; -static constexpr char TagsElementName[] = "tags"; -static constexpr char TagElementName[] = "tag"; -static constexpr char CheckHeadersElementName[] = "check-headers"; -static constexpr char CheckUnusedTemplatesElementName[] = "check-unused-templates"; -static constexpr char MaxCtuDepthElementName[] = "max-ctu-depth"; +static const char ProjectElementName[] = "project"; +static const char ProjectVersionAttrib[] = "version"; +static const char ProjectFileVersion[] = "1"; +static const char BuildDirElementName[] = "builddir"; +static const char ImportProjectElementName[] = "importproject"; +static const char AnalyzeAllVsConfigsElementName[] = "analyze-all-vs-configs"; +static const char IncludeDirElementName[] = "includedir"; +static const char DirElementName[] = "dir"; +static const char DirNameAttrib[] = "name"; +static const char DefinesElementName[] = "defines"; +static const char DefineName[] = "define"; +static const char DefineNameAttrib[] = "name"; +static const char UndefinesElementName[] = "undefines"; +static const char UndefineName[] = "undefine"; +static const char PathsElementName[] = "paths"; +static const char PathName[] = "dir"; +static const char PathNameAttrib[] = "name"; +static const char RootPathName[] = "root"; +static const char RootPathNameAttrib[] = "name"; +static const char IgnoreElementName[] = "ignore"; +static const char IgnorePathName[] = "path"; +static const char IgnorePathNameAttrib[] = "name"; +static const char ExcludeElementName[] = "exclude"; +static const char ExcludePathName[] = "path"; +static const char ExcludePathNameAttrib[] = "name"; +static const char LibrariesElementName[] = "libraries"; +static const char LibraryElementName[] = "library"; +static const char PlatformElementName[] = "platform"; +static const char SuppressionsElementName[] = "suppressions"; +static const char SuppressionElementName[] = "suppression"; +static const char AddonElementName[] = "addon"; +static const char AddonsElementName[] = "addons"; +static const char ToolElementName[] = "tool"; +static const char ToolsElementName[] = "tools"; +static const char TagsElementName[] = "tags"; +static const char TagElementName[] = "tag"; +static const char CheckHeadersElementName[] = "check-headers"; +static const char CheckUnusedTemplatesElementName[] = "check-unused-templates"; +static const char MaxCtuDepthElementName[] = "max-ctu-depth"; static std::string istream_to_string(std::istream &istr) {