mirror of https://github.com/acidanthera/audk.git
BaseTool: Error handling for PCD datumtype.
Report error if the Pcd DatumType is wrong. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <liming.gao@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
This commit is contained in:
parent
ae38c9765a
commit
065a7d406c
|
@ -69,6 +69,7 @@ class PcdClassObject(object):
|
|||
if IsDsc:
|
||||
self.DscDefaultValue = Value
|
||||
self.PcdValueFromComm = ""
|
||||
self.DefinitionPosition = ("","")
|
||||
|
||||
## Convert the class to a string
|
||||
#
|
||||
|
@ -178,6 +179,7 @@ class StructurePcd(PcdClassObject):
|
|||
self.expressions = PcdObject.expressions if PcdObject.expressions else self.expressions
|
||||
self.DscRawValue = PcdObject.DscRawValue if PcdObject.DscRawValue else self.DscRawValue
|
||||
self.PcdValueFromComm = PcdObject.PcdValueFromComm if PcdObject.PcdValueFromComm else self.PcdValueFromComm
|
||||
self.DefinitionPosition = PcdObject.DefinitionPosition if PcdObject.DefinitionPosition else self.DefinitionPosition
|
||||
if type(PcdObject) is StructurePcd:
|
||||
self.StructuredPcdIncludeFile = PcdObject.StructuredPcdIncludeFile if PcdObject.StructuredPcdIncludeFile else self.StructuredPcdIncludeFile
|
||||
self.PackageDecs = PcdObject.PackageDecs if PcdObject.PackageDecs else self.PackageDecs
|
||||
|
|
|
@ -394,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
|
||||
|
@ -446,6 +442,7 @@ class DecBuildData(PackageBuildClassObject):
|
|||
list(validlists),
|
||||
list(expressions)
|
||||
)
|
||||
PcdObj.DefinitionPosition = (self.MetaFile.File,LineNo)
|
||||
if "." in TokenSpaceGuid:
|
||||
StrPcdSet.append((PcdObj,LineNo))
|
||||
else:
|
||||
|
@ -454,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
|
||||
|
|
Loading…
Reference in New Issue