Fix optionally-valued booleans in VS 10 flag table

This commit fixes the cmparseMSBuildXML.py script to generate correct
flag table entries for booleans with optional value.  These flags use
two entries: the first should ignore the value and enable the option,
and the second should use the value if given.  Previously the first
entry did not recognize flags with values.

In particular this fixes flags like /MP4, but the change corrects
matching of some other flags too.  See issue #9771.
This commit is contained in:
Brad King 2009-10-23 14:59:26 -04:00
parent 5484550af6
commit 8ae66bf456
3 changed files with 21 additions and 11 deletions

View File

@ -138,7 +138,7 @@ static cmVS7FlagTable cmVS10CLFlagTable[] =
{"ErrorReporting", "errorReport:none", {"ErrorReporting", "errorReport:none",
"Do Not Send Report", "None", 0}, "Do Not Send Report", "None", 0},
{"ErrorReporting", "errorReport:prompt", {"ErrorReporting", "errorReport:prompt",
"Prompt Immediatelly", "Prompt", 0}, "Prompt Immediately", "Prompt", 0},
{"ErrorReporting", "errorReport:queue", {"ErrorReporting", "errorReport:queue",
"Queue For Next Login", "Queue", 0}, "Queue For Next Login", "Queue", 0},
{"ErrorReporting", "errorReport:send", {"ErrorReporting", "errorReport:send",
@ -182,7 +182,7 @@ static cmVS7FlagTable cmVS10CLFlagTable[] =
{"FunctionLevelLinking", "Gy", "", "true", 0}, {"FunctionLevelLinking", "Gy", "", "true", 0},
{"FloatingPointExceptions", "fp:except-", "", "false", 0}, {"FloatingPointExceptions", "fp:except-", "", "false", 0},
{"FloatingPointExceptions", "fp:except", "", "true", 0}, {"FloatingPointExceptions", "fp:except", "", "true", 0},
{"CodeGeneration", "hotpatch", "", "true", 0}, {"CreateHotpatchableImage", "hotpatch", "", "true", 0},
{"DisableLanguageExtensions", "Za", "", "true", 0}, {"DisableLanguageExtensions", "Za", "", "true", 0},
{"TreatWChar_tAsBuiltInType", "Zc:wchar_t-", "", "false", 0}, {"TreatWChar_tAsBuiltInType", "Zc:wchar_t-", "", "false", 0},
{"TreatWChar_tAsBuiltInType", "Zc:wchar_t", "", "true", 0}, {"TreatWChar_tAsBuiltInType", "Zc:wchar_t", "", "true", 0},
@ -201,14 +201,16 @@ static cmVS7FlagTable cmVS10CLFlagTable[] =
{"UseUnicodeForAssemblerListing", "FAu", "", "true", 0}, {"UseUnicodeForAssemblerListing", "FAu", "", "true", 0},
//Bool Properties With Argument //Bool Properties With Argument
{"MultiProcessorCompilation", "MP", "", "true", cmVS7FlagTable::Continue}, {"MultiProcessorCompilation", "MP", "", "true",
cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue},
{"ProcessorNumber", "MP", "Multi-processor Compilation", "", {"ProcessorNumber", "MP", "Multi-processor Compilation", "",
cmVS7FlagTable::UserValueRequired}, cmVS7FlagTable::UserValueRequired},
{"GenerateXMLDocumentationFiles", "doc", "", "true", {"GenerateXMLDocumentationFiles", "doc", "", "true",
cmVS7FlagTable::Continue}, cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue},
{"XMLDocumentationFileName", "doc", "Generate XML Documentation Files", "", {"XMLDocumentationFileName", "doc", "Generate XML Documentation Files", "",
cmVS7FlagTable::UserValueRequired}, cmVS7FlagTable::UserValueRequired},
{"BrowseInformation", "FR", "", "true", cmVS7FlagTable::Continue}, {"BrowseInformation", "FR", "", "true",
cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue},
{"BrowseInformationFile", "FR", "Enable Browse Information", "", {"BrowseInformationFile", "FR", "Enable Browse Information", "",
cmVS7FlagTable::UserValueRequired}, cmVS7FlagTable::UserValueRequired},
@ -240,6 +242,9 @@ static cmVS7FlagTable cmVS10CLFlagTable[] =
//String Properties //String Properties
// Skip [TrackerLogDirectory] - no command line Switch. // Skip [TrackerLogDirectory] - no command line Switch.
{"PreprocessOutputPath", "Fi",
"Preprocess Output Path",
"", cmVS7FlagTable::UserValue},
{"PrecompiledHeaderFile", "Yc", {"PrecompiledHeaderFile", "Yc",
"Precompiled Header Name", "Precompiled Header Name",
"", cmVS7FlagTable::UserValueRequired}, "", cmVS7FlagTable::UserValueRequired},

View File

@ -191,13 +191,16 @@ static cmVS7FlagTable cmVS10LinkFlagTable[] =
{"LinkDLL", "DLL", "", "true", 0}, {"LinkDLL", "DLL", "", "true", 0},
//Bool Properties With Argument //Bool Properties With Argument
{"EnableUAC", "MANIFESTUAC:NO", "", "false", cmVS7FlagTable::Continue}, {"EnableUAC", "MANIFESTUAC:NO", "", "false",
cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue},
{"EnableUAC", "MANIFESTUAC:NO", "Enable User Account Control (UAC)", "", {"EnableUAC", "MANIFESTUAC:NO", "Enable User Account Control (UAC)", "",
cmVS7FlagTable::UserValueRequired}, cmVS7FlagTable::UserValueRequired},
{"EnableUAC", "MANIFESTUAC:", "", "true", cmVS7FlagTable::Continue}, {"EnableUAC", "MANIFESTUAC:", "", "true",
cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue},
{"UACUIAccess", "MANIFESTUAC:", "Enable User Account Control (UAC)", "", {"UACUIAccess", "MANIFESTUAC:", "Enable User Account Control (UAC)", "",
cmVS7FlagTable::UserValueRequired}, cmVS7FlagTable::UserValueRequired},
{"GenerateMapFile", "MAP", "", "true", cmVS7FlagTable::Continue}, {"GenerateMapFile", "MAP", "", "true",
cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue},
{"MapFileName", "MAP", "Generate Map File", "", {"MapFileName", "MAP", "Generate Map File", "",
cmVS7FlagTable::UserValueRequired}, cmVS7FlagTable::UserValueRequired},

View File

@ -3,7 +3,9 @@
# more information see here: # more information see here:
# http://blogs.msdn.com/vcblog/archive/2008/12/16/msbuild-task.aspx # http://blogs.msdn.com/vcblog/archive/2008/12/16/msbuild-task.aspx
# cl.xml # "${PROGRAMFILES}/MSBuild/Microsoft.Cpp/v4.0/1033/cl.xml"
# "${PROGRAMFILES}/MSBuild/Microsoft.Cpp/v4.0/1033/lib.xml"
# "${PROGRAMFILES}/MSBuild/Microsoft.Cpp/v4.0/1033/link.xml"
# #
# BoolProperty <Name>true|false</Name> # BoolProperty <Name>true|false</Name>
# simple example: # simple example:
@ -233,10 +235,10 @@ class MSBuildToCMake:
for i in self.boolProperties: for i in self.boolProperties:
if i.argumentProperty != "": if i.argumentProperty != "":
if i.attributes["ReverseSwitch"] != "": if i.attributes["ReverseSwitch"] != "":
toReturn += " {\""+i.attributes["Name"]+"\", \""+i.attributes["ReverseSwitch"]+"\", \"\", \"false\", cmVS7FlagTable::Continue},\n" toReturn += " {\""+i.attributes["Name"]+"\", \""+i.attributes["ReverseSwitch"]+"\", \"\", \"false\",\n cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue},\n"
toReturn += " {\""+i.attributes["Name"]+"\", \""+i.attributes["ReverseSwitch"]+"\", \""+i.DisplayName+"\", \"\",\n cmVS7FlagTable::UserValueRequired},\n" toReturn += " {\""+i.attributes["Name"]+"\", \""+i.attributes["ReverseSwitch"]+"\", \""+i.DisplayName+"\", \"\",\n cmVS7FlagTable::UserValueRequired},\n"
if i.attributes["Switch"] != "": if i.attributes["Switch"] != "":
toReturn += " {\""+i.attributes["Name"]+"\", \""+i.attributes["Switch"]+"\", \"\", \"true\", cmVS7FlagTable::Continue},\n" toReturn += " {\""+i.attributes["Name"]+"\", \""+i.attributes["Switch"]+"\", \"\", \"true\",\n cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue},\n"
toReturn += " {\""+i.argumentProperty+"\", \""+i.attributes["Switch"]+"\", \""+i.DisplayName+"\", \"\",\n cmVS7FlagTable::UserValueRequired},\n" toReturn += " {\""+i.argumentProperty+"\", \""+i.attributes["Switch"]+"\", \""+i.DisplayName+"\", \"\",\n cmVS7FlagTable::UserValueRequired},\n"
toReturn += "\n //String List Properties\n" toReturn += "\n //String List Properties\n"