X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;ds=sidebyside;f=BaseTools%2FSource%2FPython%2FWorkspace%2FDecBuildData.py;h=4d6edadc8f9d008bb5a4ca45d92a70aa23c9de29;hb=065a7d406cf8ebc71edb2afc66a70f11d9e83a58;hp=18101a0add6ce820e30534e350678adfec4fd9e9;hpb=0a57a9782bef8ee11d8de937c149eb7ff22647c9;p=mirror_edk2.git diff --git a/BaseTools/Source/Python/Workspace/DecBuildData.py b/BaseTools/Source/Python/Workspace/DecBuildData.py index 18101a0add..4d6edadc8f 100644 --- a/BaseTools/Source/Python/Workspace/DecBuildData.py +++ b/BaseTools/Source/Python/Workspace/DecBuildData.py @@ -15,6 +15,7 @@ from Common.String import * from Common.DataType import * from Common.Misc import * from types import * +from collections import OrderedDict from Workspace.BuildClassObject import PackageBuildClassObject, StructurePcd, PcdClassObject @@ -367,7 +368,7 @@ class DecBuildData(PackageBuildClassObject): def ProcessStructurePcd(self, StructurePcdRawDataSet): - s_pcd_set = dict() + s_pcd_set = OrderedDict() for s_pcd,LineNo in StructurePcdRawDataSet: if s_pcd.TokenSpaceGuidCName not in s_pcd_set: s_pcd_set[s_pcd.TokenSpaceGuidCName] = [] @@ -393,11 +394,7 @@ class DecBuildData(PackageBuildClassObject): struct_pcd.AddDefaultValue(item.TokenCName, item.DefaultValue,self.MetaFile.File,LineNo) struct_pcd.PackageDecs = dep_pkgs - if not struct_pcd.StructuredPcdIncludeFile: - EdkLogger.error("build", PCD_STRUCTURE_PCD_ERROR, "The structure Pcd %s.%s header file is not found in %s line %s \n" % (struct_pcd.TokenSpaceGuidCName, struct_pcd.TokenCName,self.MetaFile.File,LineNo )) - str_pcd_set.append(struct_pcd) - return str_pcd_set ## Retrieve PCD declarations for given type @@ -445,6 +442,7 @@ class DecBuildData(PackageBuildClassObject): list(validlists), list(expressions) ) + PcdObj.DefinitionPosition = (self.MetaFile.File,LineNo) if "." in TokenSpaceGuid: StrPcdSet.append((PcdObj,LineNo)) else: @@ -453,6 +451,14 @@ class DecBuildData(PackageBuildClassObject): StructurePcds = self.ProcessStructurePcd(StrPcdSet) for pcd in StructurePcds: Pcds[pcd.TokenCName, pcd.TokenSpaceGuidCName, self._PCD_TYPE_STRING_[Type]] = pcd + StructPattern = re.compile(r'[_a-zA-Z][0-9A-Za-z_]*$') + for pcd in Pcds.values(): + if pcd.DatumType not in [TAB_UINT8, TAB_UINT16, TAB_UINT32, TAB_UINT64, TAB_VOID, "BOOLEAN"]: + if StructPattern.match(pcd.DatumType) == None: + EdkLogger.error('build', FORMAT_INVALID, "DatumType only support BOOLEAN, UINT8, UINT16, UINT32, UINT64, VOID* or a valid struct name.", pcd.DefinitionPosition[0],pcd.DefinitionPosition[1]) + for struct_pcd in Pcds.values(): + if isinstance(struct_pcd,StructurePcd) and not struct_pcd.StructuredPcdIncludeFile: + EdkLogger.error("build", PCD_STRUCTURE_PCD_ERROR, "The structure Pcd %s.%s header file is not found in %s line %s \n" % (struct_pcd.TokenSpaceGuidCName, struct_pcd.TokenCName,struct_pcd.DefinitionPosition[0],struct_pcd.DefinitionPosition[1] )) return Pcds @property