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>
## @file\r
# This file is used to create a database used by build tool\r
#\r
## @file\r
# This file is used to create a database used by build tool\r
#\r
-# Copyright (c) 2008 - 2017, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.<BR>\r
# (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>\r
# This program and the accompanying materials\r
# are licensed and made available under the terms and conditions of the BSD License\r
# (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>\r
# This program and the accompanying materials\r
# are licensed and made available under the terms and conditions of the BSD License\r
continue\r
\r
DefaultValue, DatumType, TokenNumber = AnalyzePcdData(Setting)\r
continue\r
\r
DefaultValue, DatumType, TokenNumber = AnalyzePcdData(Setting)\r
+ if DatumType not in [TAB_UINT8, TAB_UINT16, TAB_UINT32, TAB_UINT64, TAB_VOID, "BOOLEAN"]:\r
+ StructPattern = re.compile(r'[_a-zA-Z][0-9A-Za-z_]*$')\r
+ if StructPattern.match(DatumType) == None:\r
+ EdkLogger.error('build', FORMAT_INVALID, "DatumType only support BOOLEAN, UINT8, UINT16, UINT32, UINT64, VOID* or a valid struct name.", File=self.MetaFile, Line=LineNo)\r
+\r
validateranges, validlists, expressions = self._RawData.GetValidExpression(TokenSpaceGuid, PcdCName)\r
PcdObj = PcdClassObject(\r
PcdCName,\r
validateranges, validlists, expressions = self._RawData.GetValidExpression(TokenSpaceGuid, PcdCName)\r
PcdObj = PcdClassObject(\r
PcdCName,\r