]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BaseTools: report error HiiString in HII format PCD must not be empty
authorYonghong Zhu <yonghong.zhu@intel.com>
Fri, 23 Jun 2017 06:34:32 +0000 (14:34 +0800)
committerYonghong Zhu <yonghong.zhu@intel.com>
Sat, 24 Jun 2017 15:04:29 +0000 (23:04 +0800)
Add a check that HiiString field in the HII format PCD entry must not
be an empty string.

Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
BaseTools/Source/Python/Workspace/MetaFileParser.py

index 6e236e68b07f82b2d9d9d54a24b8e4edb6a2cadc..e98352ade5b5db64648a61822d406c7b603be8a1 100644 (file)
@@ -1139,6 +1139,13 @@ class DscParser(MetaFileParser):
             EdkLogger.error('Parser', FORMAT_INVALID, "The datum type '%s' of PCD is wrong" % ValueList[1],\r
                             ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex + 1)\r
 \r
+        # Validate the VariableName of DynamicHii and DynamicExHii for PCD Entry must not be an empty string\r
+        if self._ItemType in [MODEL_PCD_DYNAMIC_HII, MODEL_PCD_DYNAMIC_EX_HII]:\r
+            DscPcdValueList = GetSplitValueList(TokenList[1], TAB_VALUE_SPLIT, 1)\r
+            if len(DscPcdValueList[0].replace('L','').replace('"','').strip()) == 0:\r
+                EdkLogger.error('Parser', FORMAT_INVALID, "The VariableName field in the HII format PCD entry must not be an empty string",\r
+                            ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex + 1)\r
+\r
         # if value are 'True', 'true', 'TRUE' or 'False', 'false', 'FALSE', replace with integer 1 or 0.\r
         DscPcdValueList = GetSplitValueList(TokenList[1], TAB_VALUE_SPLIT, 1)\r
         if DscPcdValueList[0] in ['True', 'true', 'TRUE']:\r