diff options
author | Yonghong Zhu <yonghong.zhu@intel.com> | 2018-02-02 15:46:08 +0800 |
---|---|---|
committer | Yonghong Zhu <yonghong.zhu@intel.com> | 2018-02-06 13:48:42 +0800 |
commit | e0db09cd1cd35a1e2ae627e305d903652555aef2 (patch) | |
tree | 393efa606f69b85327508d26e2d3de766b441c21 | |
parent | d16e777ac564557f805db05a0110874797b65ceb (diff) | |
download | edk2-e0db09cd1cd35a1e2ae627e305d903652555aef2.zip edk2-e0db09cd1cd35a1e2ae627e305d903652555aef2.tar.gz edk2-e0db09cd1cd35a1e2ae627e305d903652555aef2.tar.bz2 |
BaseTools: enhance error check for DatumType format
Add a check for DatumType format, eg: VOID *, original Tool will crash
but no detail error message which cause confusion to user.
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
-rw-r--r-- | BaseTools/Source/Python/Workspace/DecBuildData.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/BaseTools/Source/Python/Workspace/DecBuildData.py b/BaseTools/Source/Python/Workspace/DecBuildData.py index 2fd3820..2266b0b 100644 --- a/BaseTools/Source/Python/Workspace/DecBuildData.py +++ b/BaseTools/Source/Python/Workspace/DecBuildData.py @@ -1,7 +1,7 @@ ## @file
# This file is used to create a database used by build tool
#
-# Copyright (c) 2008 - 2017, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.<BR>
# (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
@@ -423,6 +423,11 @@ class DecBuildData(PackageBuildClassObject): continue
DefaultValue, DatumType, TokenNumber = AnalyzePcdData(Setting)
+ if DatumType not in [TAB_UINT8, TAB_UINT16, TAB_UINT32, TAB_UINT64, TAB_VOID, "BOOLEAN"]:
+ StructPattern = re.compile(r'[_a-zA-Z][0-9A-Za-z_]*$')
+ if StructPattern.match(DatumType) == None:
+ EdkLogger.error('build', FORMAT_INVALID, "DatumType only support BOOLEAN, UINT8, UINT16, UINT32, UINT64, VOID* or a valid struct name.", File=self.MetaFile, Line=LineNo)
+
validateranges, validlists, expressions = self._RawData.GetValidExpression(TokenSpaceGuid, PcdCName)
PcdObj = PcdClassObject(
PcdCName,
|