Convert cmIDEFlagTable to use owned strings

Convert from char* to std::string in flag tables.
Change termination condition from nullptr to empty string in command flag.
Update tables to store empty strings.
This commit is contained in:
Stephan Szabo
2018-11-20 10:09:57 -08:00
parent 139b39985f
commit 8279302110
35 changed files with 48 additions and 46 deletions

View File

@@ -37,7 +37,7 @@ static cmVS7FlagTable cmVS7ExtraFlagTable[] = {
// and have EHa passed on the command line by leaving out the table
// entry.
{ 0, 0, 0, 0, 0 }
{ "", "", "", "", 0 }
};
cmGlobalVisualStudio7Generator::cmGlobalVisualStudio7Generator(

View File

@@ -362,7 +362,7 @@ static cmVS7FlagTable cmVS8ExtraFlagTable[] = {
{ "TreatWChar_tAsBuiltInType", "Zc:wchar_t-",
"wchar_t is not a built-in type", "false", 0 },
{ 0, 0, 0, 0, 0 }
{ "", "", "", "", 0 }
};
cmIDEFlagTable const* cmGlobalVisualStudio8Generator::GetExtraFlagTableVS8()
{

View File

@@ -3,13 +3,15 @@
#ifndef cmIDEFlagTable_h
#define cmIDEFlagTable_h
#include <string>
// This is a table mapping XML tag IDE names to command line options
struct cmIDEFlagTable
{
const char* IDEName; // name used in the IDE xml file
const char* commandFlag; // command line flag
const char* comment; // comment
const char* value; // string value
std::string IDEName; // name used in the IDE xml file
std::string commandFlag; // command line flag
std::string comment; // comment
std::string value; // string value
unsigned int special; // flags for special handling requests
enum
{

View File

@@ -97,24 +97,24 @@ bool cmIDEOptions::CheckFlagTable(cmIDEFlagTable const* table,
{
const char* pf = flag.c_str() + 1;
// Look for an entry in the flag table matching this flag.
for (cmIDEFlagTable const* entry = table; entry->IDEName; ++entry) {
for (cmIDEFlagTable const* entry = table; !entry->IDEName.empty(); ++entry) {
bool entry_found = false;
if (entry->special & cmIDEFlagTable::UserValue) {
// This flag table entry accepts a user-specified value. If
// the entry specifies UserRequired we must match only if a
// non-empty value is given.
int n = static_cast<int>(strlen(entry->commandFlag));
if ((strncmp(pf, entry->commandFlag, n) == 0 ||
int n = static_cast<int>(entry->commandFlag.length());
if ((strncmp(pf, entry->commandFlag.c_str(), n) == 0 ||
(entry->special & cmIDEFlagTable::CaseInsensitive &&
cmsysString_strncasecmp(pf, entry->commandFlag, n))) &&
cmsysString_strncasecmp(pf, entry->commandFlag.c_str(), n))) &&
(!(entry->special & cmIDEFlagTable::UserRequired) ||
static_cast<int>(strlen(pf)) > n)) {
this->FlagMapUpdate(entry, std::string(pf + n));
entry_found = true;
}
} else if (strcmp(pf, entry->commandFlag) == 0 ||
} else if (strcmp(pf, entry->commandFlag.c_str()) == 0 ||
(entry->special & cmIDEFlagTable::CaseInsensitive &&
cmsysString_strcasecmp(pf, entry->commandFlag) == 0)) {
cmsysString_strcasecmp(pf, entry->commandFlag.c_str()) == 0)) {
if (entry->special & cmIDEFlagTable::UserFollowing) {
// This flag expects a value in the following argument.
this->DoingFollowing = entry;

View File

@@ -362,7 +362,7 @@ cmVS7FlagTable cmLocalVisualStudio7GeneratorFortranFlagTable[] = {
{ "EnableRecursion", "recursive", "", "true", 0 },
{ "ReentrantCode", "reentrancy", "", "true", 0 },
// done up to Language
{ 0, 0, 0, 0, 0 }
{ "", "", "", "", 0 }
};
// fill the table here currently the comment field is not used for
// anything other than documentation NOTE: Make sure the longer
@@ -472,7 +472,7 @@ cmVS7FlagTable cmLocalVisualStudio7GeneratorFlagTable[] = {
{ "WarnAsError", "WX", "Treat warnings as errors", "true", 0 },
{ "BrowseInformation", "FR", "Generate browse information", "1", 0 },
{ "StringPooling", "GF", "Enable StringPooling", "true", 0 },
{ 0, 0, 0, 0, 0 }
{ "", "", "", "", 0 }
};
cmVS7FlagTable cmLocalVisualStudio7GeneratorLinkFlagTable[] = {
@@ -537,7 +537,7 @@ cmVS7FlagTable cmLocalVisualStudio7GeneratorLinkFlagTable[] = {
{ "ModuleDefinitionFile", "DEF:", "add an export def file", "",
cmVS7FlagTable::UserValue },
{ "GenerateMapFile", "MAP", "enable generation of map file", "true", 0 },
{ 0, 0, 0, 0, 0 }
{ "", "", "", "", 0 }
};
cmVS7FlagTable cmLocalVisualStudio7GeneratorFortranLinkFlagTable[] = {
@@ -545,7 +545,7 @@ cmVS7FlagTable cmLocalVisualStudio7GeneratorFortranLinkFlagTable[] = {
"linkIncrementalNo", 0 },
{ "LinkIncremental", "INCREMENTAL:YES", "link incremental",
"linkIncrementalYes", 0 },
{ 0, 0, 0, 0, 0 }
{ "", "", "", "", 0 }
};
// Helper class to write build event <Tool .../> elements.

View File

@@ -201,5 +201,5 @@ static cmVS7FlagTable cmVS10CLFlagTable[] = {
// Skip [XMLDocumentationFileName] - no command line Switch.
// Skip [BrowseInformationFile] - no command line Switch.
// Skip [AdditionalOptions] - no command line Switch.
{ 0, 0, 0, 0, 0 }
{ "", "", "", "", 0 }
};

View File

@@ -117,5 +117,5 @@ static cmVS7FlagTable cmVS10CSharpFlagTable[] = {
{ "ErrorReport", "errorreport:queue", "Queue For Next Login", "queue", 0 },
{ "ErrorReport", "errorreport:send", "Send Automatically", "send", 0 },
{ 0, 0, 0, 0, 0 },
{ "", "", "", "", 0 },
};

View File

@@ -50,5 +50,5 @@ static cmVS7FlagTable cmVS10CudaFlagTable[] = {
{ "MaxRegCount", "maxrregcount=", "", "", cmVS7FlagTable::UserValue },
{ "MaxRegCount", "maxrregcount", "", "", cmVS7FlagTable::UserFollowing },
{ 0, 0, 0, 0, 0 }
{ "", "", "", "", 0 }
};

View File

@@ -31,5 +31,5 @@ static cmVS7FlagTable cmVS10CudaHostFlagTable[] = {
{ "Warning", "W4", "Level 4", "W4", 0 },
{ "Warning", "Wall", "Enable All Warnings", "Wall", 0 },
{ 0, 0, 0, 0, 0 }
{ "", "", "", "", 0 }
};

View File

@@ -72,5 +72,5 @@ static cmVS7FlagTable cmVS10LibFlagTable[] = {
{ "Name", "NAME:", "Name", "", cmVS7FlagTable::UserValue },
// Skip [TrackerLogDirectory] - no command line Switch.
// Skip [AdditionalOptions] - no command line Switch.
{ 0, 0, 0, 0, 0 }
{ "", "", "", "", 0 }
};

View File

@@ -243,5 +243,5 @@ static cmVS7FlagTable cmVS10LinkFlagTable[] = {
{ "KeyContainer", "KEYCONTAINER:", "Key Container", "",
cmVS7FlagTable::UserValue },
// Skip [AdditionalOptions] - no command line Switch.
{ 0, 0, 0, 0, 0 }
{ "", "", "", "", 0 }
};

View File

@@ -72,5 +72,5 @@ static cmVS7FlagTable cmVS10MASMFlagTable[] = {
// Skip [CommandLineTemplate] - no command line Switch.
// Skip [ExecutionDescription] - no command line Switch.
// Skip [AdditionalOptions] - no command line Switch.
{ 0, 0, 0, 0, 0 }
{ "", "", "", "", 0 }
};

View File

@@ -46,5 +46,5 @@ static cmVS7FlagTable cmVS10NASMFlagTable[] = {
// Skip [CommandLineTemplate] - no command line Switch.
// Skip [ExecutionDescription] - no command line Switch.
// Skip [AdditionalOptions] - no command line Switch.
{ 0, 0, 0, 0, 0 }
{ "", "", "", "", 0 }
};

View File

@@ -3,5 +3,5 @@ static cmVS7FlagTable cmVS10RCFlagTable[] = {
{ "NullTerminateStrings", "n", "", "true", 0 },
{ "SuppressStartupBanner", "nologo", "", "true", 0 },
{ 0, 0, 0, 0, 0 }
{ "", "", "", "", 0 }
};

View File

@@ -216,5 +216,5 @@ static cmVS7FlagTable cmVS11CLFlagTable[] = {
// Skip [XMLDocumentationFileName] - no command line Switch.
// Skip [BrowseInformationFile] - no command line Switch.
// Skip [AdditionalOptions] - no command line Switch.
{ 0, 0, 0, 0, 0 }
{ "", "", "", "", 0 }
};

View File

@@ -117,5 +117,5 @@ static cmVS7FlagTable cmVS11CSharpFlagTable[] = {
{ "ErrorReport", "errorreport:queue", "Queue For Next Login", "queue", 0 },
{ "ErrorReport", "errorreport:send", "Send Automatically", "send", 0 },
{ 0, 0, 0, 0, 0 },
{ "", "", "", "", 0 },
};

View File

@@ -72,5 +72,5 @@ static cmVS7FlagTable cmVS11LibFlagTable[] = {
{ "Name", "NAME:", "Name", "", cmVS7FlagTable::UserValue },
// Skip [AdditionalOptions] - no command line Switch.
// Skip [TrackerLogDirectory] - no command line Switch.
{ 0, 0, 0, 0, 0 }
{ "", "", "", "", 0 }
};

View File

@@ -268,5 +268,5 @@ static cmVS7FlagTable cmVS11LinkFlagTable[] = {
{ "KeyContainer", "KEYCONTAINER:", "Key Container", "",
cmVS7FlagTable::UserValue },
// Skip [AdditionalOptions] - no command line Switch.
{ 0, 0, 0, 0, 0 }
{ "", "", "", "", 0 }
};

View File

@@ -72,5 +72,5 @@ static cmVS7FlagTable cmVS11MASMFlagTable[] = {
// Skip [CommandLineTemplate] - no command line Switch.
// Skip [ExecutionDescription] - no command line Switch.
// Skip [AdditionalOptions] - no command line Switch.
{ 0, 0, 0, 0, 0 }
{ "", "", "", "", 0 }
};

View File

@@ -3,5 +3,5 @@ static cmVS7FlagTable cmVS11RCFlagTable[] = {
{ "NullTerminateStrings", "n", "", "true", 0 },
{ "SuppressStartupBanner", "nologo", "", "true", 0 },
{ 0, 0, 0, 0, 0 }
{ "", "", "", "", 0 }
};

View File

@@ -218,5 +218,5 @@ static cmVS7FlagTable cmVS12CLFlagTable[] = {
// Skip [XMLDocumentationFileName] - no command line Switch.
// Skip [BrowseInformationFile] - no command line Switch.
// Skip [AdditionalOptions] - no command line Switch.
{ 0, 0, 0, 0, 0 }
{ "", "", "", "", 0 }
};

View File

@@ -117,5 +117,5 @@ static cmVS7FlagTable cmVS12CSharpFlagTable[] = {
{ "ErrorReport", "errorreport:queue", "Queue For Next Login", "queue", 0 },
{ "ErrorReport", "errorreport:send", "Send Automatically", "send", 0 },
{ 0, 0, 0, 0, 0 },
{ "", "", "", "", 0 },
};

View File

@@ -72,5 +72,5 @@ static cmVS7FlagTable cmVS12LibFlagTable[] = {
{ "Name", "NAME:", "Name", "", cmVS7FlagTable::UserValue },
// Skip [AdditionalOptions] - no command line Switch.
// Skip [TrackerLogDirectory] - no command line Switch.
{ 0, 0, 0, 0, 0 }
{ "", "", "", "", 0 }
};

View File

@@ -268,5 +268,5 @@ static cmVS7FlagTable cmVS12LinkFlagTable[] = {
{ "KeyContainer", "KEYCONTAINER:", "Key Container", "",
cmVS7FlagTable::UserValue },
// Skip [AdditionalOptions] - no command line Switch.
{ 0, 0, 0, 0, 0 }
{ "", "", "", "", 0 }
};

View File

@@ -72,5 +72,5 @@ static cmVS7FlagTable cmVS12MASMFlagTable[] = {
// Skip [CommandLineTemplate] - no command line Switch.
// Skip [ExecutionDescription] - no command line Switch.
// Skip [AdditionalOptions] - no command line Switch.
{ 0, 0, 0, 0, 0 }
{ "", "", "", "", 0 }
};

View File

@@ -3,5 +3,5 @@ static cmVS7FlagTable cmVS12RCFlagTable[] = {
{ "NullTerminateStrings", "n", "", "true", 0 },
{ "SuppressStartupBanner", "nologo", "", "true", 0 },
{ 0, 0, 0, 0, 0 }
{ "", "", "", "", 0 }
};

View File

@@ -236,5 +236,5 @@ static cmVS7FlagTable cmVS140CLFlagTable[] = {
// Skip [XMLDocumentationFileName] - no command line Switch.
// Skip [BrowseInformationFile] - no command line Switch.
// Skip [AdditionalOptions] - no command line Switch.
{ 0, 0, 0, 0, 0 }
{ "", "", "", "", 0 }
};

View File

@@ -117,5 +117,5 @@ static cmVS7FlagTable cmVS140CSharpFlagTable[] = {
{ "ErrorReport", "errorreport:queue", "Queue For Next Login", "queue", 0 },
{ "ErrorReport", "errorreport:send", "Send Automatically", "send", 0 },
{ 0, 0, 0, 0, 0 },
{ "", "", "", "", 0 },
};

View File

@@ -281,5 +281,5 @@ static cmVS7FlagTable cmVS140LinkFlagTable[] = {
{ "KeyContainer", "KEYCONTAINER:", "Key Container", "",
cmVS7FlagTable::UserValue },
// Skip [AdditionalOptions] - no command line Switch.
{ 0, 0, 0, 0, 0 }
{ "", "", "", "", 0 }
};

View File

@@ -256,5 +256,5 @@ static cmVS7FlagTable cmVS141CLFlagTable[] = {
// Skip [XMLDocumentationFileName] - no command line Switch.
// Skip [BrowseInformationFile] - no command line Switch.
// Skip [AdditionalOptions] - no command line Switch.
{ 0, 0, 0, 0, 0 }
{ "", "", "", "", 0 }
};

View File

@@ -122,5 +122,5 @@ static cmVS7FlagTable cmVS141CSharpFlagTable[] = {
{ "ErrorReport", "errorreport:queue", "Queue For Next Login", "queue", 0 },
{ "ErrorReport", "errorreport:send", "Send Automatically", "send", 0 },
{ 0, 0, 0, 0, 0 },
{ "", "", "", "", 0 },
};

View File

@@ -283,5 +283,5 @@ static cmVS7FlagTable cmVS141LinkFlagTable[] = {
{ "KeyContainer", "KEYCONTAINER:", "Key Container", "",
cmVS7FlagTable::UserValue },
// Skip [AdditionalOptions] - no command line Switch.
{ 0, 0, 0, 0, 0 }
{ "", "", "", "", 0 }
};

View File

@@ -73,5 +73,5 @@ static cmVS7FlagTable cmVS14LibFlagTable[] = {
{ "Name", "NAME:", "Name", "", cmVS7FlagTable::UserValue },
// Skip [AdditionalOptions] - no command line Switch.
// Skip [TrackerLogDirectory] - no command line Switch.
{ 0, 0, 0, 0, 0 }
{ "", "", "", "", 0 }
};

View File

@@ -72,5 +72,5 @@ static cmVS7FlagTable cmVS14MASMFlagTable[] = {
// Skip [CommandLineTemplate] - no command line Switch.
// Skip [ExecutionDescription] - no command line Switch.
// Skip [AdditionalOptions] - no command line Switch.
{ 0, 0, 0, 0, 0 }
{ "", "", "", "", 0 }
};

View File

@@ -3,5 +3,5 @@ static cmVS7FlagTable cmVS14RCFlagTable[] = {
{ "NullTerminateStrings", "n", "", "true", 0 },
{ "SuppressStartupBanner", "nologo", "", "true", 0 },
{ 0, 0, 0, 0, 0 }
{ "", "", "", "", 0 }
};