msvc compatibility: /constexpr/const/

This commit is contained in:
Daniel Marjamäki 2019-04-11 21:06:37 +02:00
parent c9172b169a
commit dfe417c369
2 changed files with 78 additions and 86 deletions

View File

@ -25,49 +25,45 @@
#include "projectfile.h" #include "projectfile.h"
#include "common.h" #include "common.h"
#ifdef _MSC_VER static const char ProjectElementName[] = "project";
#define constexpr const // TODO what handling of constexpr is there is MSC static const char ProjectVersionAttrib[] = "version";
#endif static const char ProjectFileVersion[] = "1";
static const char BuildDirElementName[] = "builddir";
static constexpr char ProjectElementName[] = "project"; static const char ImportProjectElementName[] = "importproject";
static constexpr char ProjectVersionAttrib[] = "version"; static const char AnalyzeAllVsConfigsElementName[] = "analyze-all-vs-configs";
static constexpr char ProjectFileVersion[] = "1"; static const char IncludeDirElementName[] = "includedir";
static constexpr char BuildDirElementName[] = "builddir"; static const char DirElementName[] = "dir";
static constexpr char ImportProjectElementName[] = "importproject"; static const char DirNameAttrib[] = "name";
static constexpr char AnalyzeAllVsConfigsElementName[] = "analyze-all-vs-configs"; static const char DefinesElementName[] = "defines";
static constexpr char IncludeDirElementName[] = "includedir"; static const char DefineName[] = "define";
static constexpr char DirElementName[] = "dir"; static const char DefineNameAttrib[] = "name";
static constexpr char DirNameAttrib[] = "name"; static const char UndefinesElementName[] = "undefines";
static constexpr char DefinesElementName[] = "defines"; static const char UndefineName[] = "undefine";
static constexpr char DefineName[] = "define"; static const char PathsElementName[] = "paths";
static constexpr char DefineNameAttrib[] = "name"; static const char PathName[] = "dir";
static constexpr char UndefinesElementName[] = "undefines"; static const char PathNameAttrib[] = "name";
static constexpr char UndefineName[] = "undefine"; static const char RootPathName[] = "root";
static constexpr char PathsElementName[] = "paths"; static const char RootPathNameAttrib[] = "name";
static constexpr char PathName[] = "dir"; static const char IgnoreElementName[] = "ignore";
static constexpr char PathNameAttrib[] = "name"; static const char IgnorePathName[] = "path";
static constexpr char RootPathName[] = "root"; static const char IgnorePathNameAttrib[] = "name";
static constexpr char RootPathNameAttrib[] = "name"; static const char ExcludeElementName[] = "exclude";
static constexpr char IgnoreElementName[] = "ignore"; static const char ExcludePathName[] = "path";
static constexpr char IgnorePathName[] = "path"; static const char ExcludePathNameAttrib[] = "name";
static constexpr char IgnorePathNameAttrib[] = "name"; static const char LibrariesElementName[] = "libraries";
static constexpr char ExcludeElementName[] = "exclude"; static const char LibraryElementName[] = "library";
static constexpr char ExcludePathName[] = "path"; static const char PlatformElementName[] = "platform";
static constexpr char ExcludePathNameAttrib[] = "name"; static const char SuppressionsElementName[] = "suppressions";
static constexpr char LibrariesElementName[] = "libraries"; static const char SuppressionElementName[] = "suppression";
static constexpr char LibraryElementName[] = "library"; static const char AddonElementName[] = "addon";
static constexpr char PlatformElementName[] = "platform"; static const char AddonsElementName[] = "addons";
static constexpr char SuppressionsElementName[] = "suppressions"; static const char ToolElementName[] = "tool";
static constexpr char SuppressionElementName[] = "suppression"; static const char ToolsElementName[] = "tools";
static constexpr char AddonElementName[] = "addon"; static const char TagsElementName[] = "tags";
static constexpr char AddonsElementName[] = "addons"; static const char TagElementName[] = "tag";
static constexpr char ToolElementName[] = "tool"; static const char CheckHeadersElementName[] = "check-headers";
static constexpr char ToolsElementName[] = "tools"; static const char CheckUnusedTemplatesElementName[] = "check-unused-templates";
static constexpr char TagsElementName[] = "tags"; static const char MaxCtuDepthElementName[] = "max-ctu-depth";
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";
ProjectFile::ProjectFile(QObject *parent) : ProjectFile::ProjectFile(QObject *parent) :
QObject(parent) QObject(parent)

View File

@ -937,50 +937,46 @@ static std::string join(const std::list<std::string> &strlist, const char *sep)
return ret; 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 // These constants are copy/pasted from gui/projectfile.cpp
static constexpr char ProjectElementName[] = "project"; static const char ProjectElementName[] = "project";
static constexpr char ProjectVersionAttrib[] = "version"; static const char ProjectVersionAttrib[] = "version";
static constexpr char ProjectFileVersion[] = "1"; static const char ProjectFileVersion[] = "1";
static constexpr char BuildDirElementName[] = "builddir"; static const char BuildDirElementName[] = "builddir";
static constexpr char ImportProjectElementName[] = "importproject"; static const char ImportProjectElementName[] = "importproject";
static constexpr char AnalyzeAllVsConfigsElementName[] = "analyze-all-vs-configs"; static const char AnalyzeAllVsConfigsElementName[] = "analyze-all-vs-configs";
static constexpr char IncludeDirElementName[] = "includedir"; static const char IncludeDirElementName[] = "includedir";
static constexpr char DirElementName[] = "dir"; static const char DirElementName[] = "dir";
static constexpr char DirNameAttrib[] = "name"; static const char DirNameAttrib[] = "name";
static constexpr char DefinesElementName[] = "defines"; static const char DefinesElementName[] = "defines";
static constexpr char DefineName[] = "define"; static const char DefineName[] = "define";
static constexpr char DefineNameAttrib[] = "name"; static const char DefineNameAttrib[] = "name";
static constexpr char UndefinesElementName[] = "undefines"; static const char UndefinesElementName[] = "undefines";
static constexpr char UndefineName[] = "undefine"; static const char UndefineName[] = "undefine";
static constexpr char PathsElementName[] = "paths"; static const char PathsElementName[] = "paths";
static constexpr char PathName[] = "dir"; static const char PathName[] = "dir";
static constexpr char PathNameAttrib[] = "name"; static const char PathNameAttrib[] = "name";
static constexpr char RootPathName[] = "root"; static const char RootPathName[] = "root";
static constexpr char RootPathNameAttrib[] = "name"; static const char RootPathNameAttrib[] = "name";
static constexpr char IgnoreElementName[] = "ignore"; static const char IgnoreElementName[] = "ignore";
static constexpr char IgnorePathName[] = "path"; static const char IgnorePathName[] = "path";
static constexpr char IgnorePathNameAttrib[] = "name"; static const char IgnorePathNameAttrib[] = "name";
static constexpr char ExcludeElementName[] = "exclude"; static const char ExcludeElementName[] = "exclude";
static constexpr char ExcludePathName[] = "path"; static const char ExcludePathName[] = "path";
static constexpr char ExcludePathNameAttrib[] = "name"; static const char ExcludePathNameAttrib[] = "name";
static constexpr char LibrariesElementName[] = "libraries"; static const char LibrariesElementName[] = "libraries";
static constexpr char LibraryElementName[] = "library"; static const char LibraryElementName[] = "library";
static constexpr char PlatformElementName[] = "platform"; static const char PlatformElementName[] = "platform";
static constexpr char SuppressionsElementName[] = "suppressions"; static const char SuppressionsElementName[] = "suppressions";
static constexpr char SuppressionElementName[] = "suppression"; static const char SuppressionElementName[] = "suppression";
static constexpr char AddonElementName[] = "addon"; static const char AddonElementName[] = "addon";
static constexpr char AddonsElementName[] = "addons"; static const char AddonsElementName[] = "addons";
static constexpr char ToolElementName[] = "tool"; static const char ToolElementName[] = "tool";
static constexpr char ToolsElementName[] = "tools"; static const char ToolsElementName[] = "tools";
static constexpr char TagsElementName[] = "tags"; static const char TagsElementName[] = "tags";
static constexpr char TagElementName[] = "tag"; static const char TagElementName[] = "tag";
static constexpr char CheckHeadersElementName[] = "check-headers"; static const char CheckHeadersElementName[] = "check-headers";
static constexpr char CheckUnusedTemplatesElementName[] = "check-unused-templates"; static const char CheckUnusedTemplatesElementName[] = "check-unused-templates";
static constexpr char MaxCtuDepthElementName[] = "max-ctu-depth"; static const char MaxCtuDepthElementName[] = "max-ctu-depth";
static std::string istream_to_string(std::istream &istr) static std::string istream_to_string(std::istream &istr)
{ {