Răsfoiți Sursa

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.
Stephan Szabo 7 ani în urmă
părinte
comite
8279302110

+ 1 - 1
Source/cmGlobalVisualStudio7Generator.cxx

@@ -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(

+ 1 - 1
Source/cmGlobalVisualStudio8Generator.cxx

@@ -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()
 {

+ 6 - 4
Source/cmIDEFlagTable.h

@@ -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
   {

+ 6 - 6
Source/cmIDEOptions.cxx

@@ -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;

+ 4 - 4
Source/cmLocalVisualStudio7Generator.cxx

@@ -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.

+ 1 - 1
Source/cmVS10CLFlagTable.h

@@ -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 }
 };

+ 1 - 1
Source/cmVS10CSharpFlagTable.h

@@ -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 },
 };

+ 1 - 1
Source/cmVS10CudaFlagTable.h

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

+ 1 - 1
Source/cmVS10CudaHostFlagTable.h

@@ -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 }
 };

+ 1 - 1
Source/cmVS10LibFlagTable.h

@@ -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 }
 };

+ 1 - 1
Source/cmVS10LinkFlagTable.h

@@ -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 }
 };

+ 1 - 1
Source/cmVS10MASMFlagTable.h

@@ -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 }
 };

+ 1 - 1
Source/cmVS10NASMFlagTable.h

@@ -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 }
 };

+ 1 - 1
Source/cmVS10RCFlagTable.h

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

+ 1 - 1
Source/cmVS11CLFlagTable.h

@@ -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 }
 };

+ 1 - 1
Source/cmVS11CSharpFlagTable.h

@@ -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 },
 };

+ 1 - 1
Source/cmVS11LibFlagTable.h

@@ -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 }
 };

+ 1 - 1
Source/cmVS11LinkFlagTable.h

@@ -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 }
 };

+ 1 - 1
Source/cmVS11MASMFlagTable.h

@@ -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 }
 };

+ 1 - 1
Source/cmVS11RCFlagTable.h

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

+ 1 - 1
Source/cmVS12CLFlagTable.h

@@ -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 }
 };

+ 1 - 1
Source/cmVS12CSharpFlagTable.h

@@ -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 },
 };

+ 1 - 1
Source/cmVS12LibFlagTable.h

@@ -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 }
 };

+ 1 - 1
Source/cmVS12LinkFlagTable.h

@@ -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 }
 };

+ 1 - 1
Source/cmVS12MASMFlagTable.h

@@ -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 }
 };

+ 1 - 1
Source/cmVS12RCFlagTable.h

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

+ 1 - 1
Source/cmVS140CLFlagTable.h

@@ -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 }
 };

+ 1 - 1
Source/cmVS140CSharpFlagTable.h

@@ -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 },
 };

+ 1 - 1
Source/cmVS140LinkFlagTable.h

@@ -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 }
 };

+ 1 - 1
Source/cmVS141CLFlagTable.h

@@ -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 }
 };

+ 1 - 1
Source/cmVS141CSharpFlagTable.h

@@ -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 },
 };

+ 1 - 1
Source/cmVS141LinkFlagTable.h

@@ -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 }
 };

+ 1 - 1
Source/cmVS14LibFlagTable.h

@@ -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 }
 };

+ 1 - 1
Source/cmVS14MASMFlagTable.h

@@ -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 }
 };

+ 1 - 1
Source/cmVS14RCFlagTable.h

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