summaryrefslogtreecommitdiff
path: root/BaseTools
diff options
context:
space:
mode:
authorHess Chen <hesheng.chen@intel.com>2014-12-09 06:41:58 +0000
committerhchen30 <hchen30@Edk2>2014-12-09 06:41:58 +0000
commit8d62ae35ca6a4d0331f9ebd7609265378e69afbf (patch)
treeb18d514ad965cd7e8613e851afebb0fac55accf3 /BaseTools
parent3720ee6d32219fd67d391f53f2cb812dc197a86b (diff)
downloadedk2-platforms-8d62ae35ca6a4d0331f9ebd7609265378e69afbf.tar.xz
BaseTools/ECC: Fix some issues of ECC tool
Add support for the usage which is defined in the above line for a Protocol/Ppi/Guid Add support for “!ERROR” Ignore issue of parsing a macro Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hess Chen <hesheng.chen@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16487 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'BaseTools')
-rw-r--r--BaseTools/Source/Python/Common/DataType.py1
-rw-r--r--BaseTools/Source/Python/CommonDataClass/DataClass.py2
-rw-r--r--BaseTools/Source/Python/Ecc/Check.py2
-rw-r--r--BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py25
4 files changed, 21 insertions, 9 deletions
diff --git a/BaseTools/Source/Python/Common/DataType.py b/BaseTools/Source/Python/Common/DataType.py
index 57e5063ff2..6d66523847 100644
--- a/BaseTools/Source/Python/Common/DataType.py
+++ b/BaseTools/Source/Python/Common/DataType.py
@@ -442,6 +442,7 @@ TAB_ELSE = '!else'
TAB_IF_DEF = '!ifdef'
TAB_IF_N_DEF = '!ifndef'
TAB_IF_EXIST = '!if exist'
+TAB_ERROR = '!ERROR'
#
# Unknown section
diff --git a/BaseTools/Source/Python/CommonDataClass/DataClass.py b/BaseTools/Source/Python/CommonDataClass/DataClass.py
index 3f6c3c65a5..3be369a0f4 100644
--- a/BaseTools/Source/Python/CommonDataClass/DataClass.py
+++ b/BaseTools/Source/Python/CommonDataClass/DataClass.py
@@ -86,6 +86,7 @@ MODEL_META_DATA_CONDITIONAL_STATEMENT_IF = 5004
MODEL_META_DATA_CONDITIONAL_STATEMENT_ELSE = 5005
MODEL_META_DATA_CONDITIONAL_STATEMENT_IFDEF = 5006
MODEL_META_DATA_CONDITIONAL_STATEMENT_IFNDEF = 5007
+MODEL_META_DATA_CONDITIONAL_STATEMENT_ERROR = 5400
MODEL_META_DATA_BUILD_OPTION = 5008
MODEL_META_DATA_COMPONENT = 5009
MODEL_META_DATA_USER_EXTENSION = 5010
@@ -164,6 +165,7 @@ MODEL_LIST = [('MODEL_UNKNOWN', MODEL_UNKNOWN),
("MODEL_META_DATA_CONDITIONAL_STATEMENT_ELSE", MODEL_META_DATA_CONDITIONAL_STATEMENT_ELSE),
("MODEL_META_DATA_CONDITIONAL_STATEMENT_IFDEF", MODEL_META_DATA_CONDITIONAL_STATEMENT_IFDEF),
("MODEL_META_DATA_CONDITIONAL_STATEMENT_IFNDEF", MODEL_META_DATA_CONDITIONAL_STATEMENT_IFNDEF),
+ ("MODEL_META_DATA_CONDITIONAL_STATEMENT_ERROR", MODEL_META_DATA_CONDITIONAL_STATEMENT_ERROR),
("MODEL_META_DATA_COMPONENT_SOURCE_OVERRIDE_PATH", MODEL_META_DATA_COMPONENT_SOURCE_OVERRIDE_PATH),
("MODEL_META_DATA_BUILD_OPTION", MODEL_META_DATA_BUILD_OPTION),
("MODEL_META_DATA_COMPONENT", MODEL_META_DATA_COMPONENT),
diff --git a/BaseTools/Source/Python/Ecc/Check.py b/BaseTools/Source/Python/Ecc/Check.py
index cfa96c156e..5bee6dba7c 100644
--- a/BaseTools/Source/Python/Ecc/Check.py
+++ b/BaseTools/Source/Python/Ecc/Check.py
@@ -63,7 +63,7 @@ class Check(object):
def GeneralCheckNonAcsii(self):
if EccGlobalData.gConfig.GeneralCheckNonAcsii == '1' or EccGlobalData.gConfig.GeneralCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
EdkLogger.quiet("Checking Non-ACSII char in file ...")
- SqlCommand = """select ID, FullPath, ExtName from File"""
+ SqlCommand = """select ID, FullPath, ExtName from File where ExtName in ('.dec', '.inf', '.dsc', 'c', 'h')"""
RecordSet = EccGlobalData.gDb.TblFile.Exec(SqlCommand)
for Record in RecordSet:
if Record[2].upper() not in EccGlobalData.gConfig.BinaryExtList:
diff --git a/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py b/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py
index 1c3e968785..9f31d4d4de 100644
--- a/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py
+++ b/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py
@@ -461,13 +461,14 @@ class InfParser(MetaFileParser):
MODEL_PCD_DYNAMIC_EX,
MODEL_PCD_DYNAMIC]:
Line = Content[Index].strip()
- if Line.startswith(TAB_COMMENT_SPLIT):
+ if Line.startswith(TAB_SPECIAL_COMMENT):
+ Usage += ' ' + Line[Line.find(TAB_SPECIAL_COMMENT):]
+ continue
+ elif Line.startswith(TAB_COMMENT_SPLIT):
continue
elif Line.find(TAB_COMMENT_SPLIT) > 0:
- Usage = Line[Line.find(TAB_COMMENT_SPLIT):]
+ Usage += ' ' + Line[Line.find(TAB_COMMENT_SPLIT):]
Line = Line[:Line.find(TAB_COMMENT_SPLIT)]
- else:
- Usage = ''
else:
# skip empty, commented, block commented lines
Line = CleanString(Content[Index], AllowCppStyleComment=True)
@@ -545,6 +546,7 @@ class InfParser(MetaFileParser):
# LineBegin=-1, ColumnBegin=-1, LineEnd=-1, ColumnEnd=-1, Enabled=-1
#
self._ValueList[0] = self._ValueList[0].replace('/', '\\')
+ Usage = Usage.strip()
for Arch, Platform in self._Scope:
self._Store(self._SectionType,
self._ValueList[0],
@@ -561,6 +563,7 @@ class InfParser(MetaFileParser):
0,
Usage
)
+ Usage = ''
if IsFindBlockComment:
EdkLogger.error("Parser", FORMAT_INVALID, "Open block comments (starting with /*) are expected to end with */",
File=self.MetaFile)
@@ -731,6 +734,7 @@ class DscParser(MetaFileParser):
TAB_ELSE_IF.upper() : MODEL_META_DATA_CONDITIONAL_STATEMENT_ELSEIF,
TAB_ELSE.upper() : MODEL_META_DATA_CONDITIONAL_STATEMENT_ELSE,
TAB_END_IF.upper() : MODEL_META_DATA_CONDITIONAL_STATEMENT_ENDIF,
+ TAB_ERROR.upper() : MODEL_META_DATA_CONDITIONAL_STATEMENT_ERROR,
}
# Valid names in define section
@@ -1117,6 +1121,7 @@ class DscParser(MetaFileParser):
MODEL_META_DATA_BUILD_OPTION : self.__ProcessBuildOption,
MODEL_UNKNOWN : self._Skip,
MODEL_META_DATA_USER_EXTENSION : self._Skip,
+ MODEL_META_DATA_CONDITIONAL_STATEMENT_ERROR : self._Skip,
}
self._RawTable = self._Table
@@ -1152,9 +1157,10 @@ class DscParser(MetaFileParser):
# Only catch expression evaluation error here. We need to report
# the precise number of line on which the error occurred
#
- EdkLogger.error('Parser', FORMAT_INVALID, "Invalid expression: %s" % str(Excpt),
- File=self._FileWithError, ExtraData=' '.join(self._ValueList),
- Line=self._LineIndex+1)
+ pass
+# EdkLogger.error('Parser', FORMAT_INVALID, "Invalid expression: %s" % str(Excpt),
+# File=self._FileWithError, ExtraData=' '.join(self._ValueList),
+# Line=self._LineIndex+1)
except MacroException, Excpt:
EdkLogger.error('Parser', FORMAT_INVALID, str(Excpt),
File=self._FileWithError, ExtraData=' '.join(self._ValueList),
@@ -1809,7 +1815,10 @@ class Fdf(FdfObject):
# Load Fdf file if filename is not None
#
if Filename != None:
- self.LoadFdfFile(Filename)
+ try:
+ self.LoadFdfFile(Filename)
+ except Exception:
+ pass
#
# Insert a FDF file record into database