summaryrefslogtreecommitdiffstats
path: root/BaseTools/Source/Python/Ecc/c.py
diff options
context:
space:
mode:
authorFan, ZhijuX <zhijux.fan@intel.com>2019-05-06 10:35:07 +0800
committerFeng, Bob C <bob.c.feng@intel.com>2019-05-08 09:41:42 +0800
commit0cb3f77153b7fde612ed49dddd986cf8421be7ba (patch)
treea0318f804e852d7175e13d686634a6f056502a1a /BaseTools/Source/Python/Ecc/c.py
parent8b4b2fb9a1839f719a8a4045fefafa66ddc52e63 (diff)
downloadedk2-0cb3f77153b7fde612ed49dddd986cf8421be7ba.tar.gz
edk2-0cb3f77153b7fde612ed49dddd986cf8421be7ba.tar.bz2
edk2-0cb3f77153b7fde612ed49dddd986cf8421be7ba.zip
BaseTools:ECC report errors on account of analyze special characters
BZ:https://bugzilla.tianocore.org/show_bug.cgi?id=1751 In case that a C function body contains the string of L'', L'\"', L"\"", L''', L""", L"\"\"", L"\"^", L" \"", L"\" \"", ('L",\\\""') ECC tool running under python3 interpreter will report error. The antlr4 module misidentified this character This patch is going to fix that issue. Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <liming.gao@intel.com> Signed-off-by: Zhiju.Fan <zhijux.fan@intel.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com>
Diffstat (limited to 'BaseTools/Source/Python/Ecc/c.py')
-rw-r--r--BaseTools/Source/Python/Ecc/c.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/BaseTools/Source/Python/Ecc/c.py b/BaseTools/Source/Python/Ecc/c.py
index fdb53e4e3e..2a73da7cb8 100644
--- a/BaseTools/Source/Python/Ecc/c.py
+++ b/BaseTools/Source/Python/Ecc/c.py
@@ -495,6 +495,8 @@ def CollectSourceCodeDataIntoDB(RootDir):
tuple = os.walk(RootDir)
IgnoredPattern = GetIgnoredDirListPattern()
ParseErrorFileList = []
+ TokenReleaceList = EccGlobalData.gConfig.TokenReleaceList
+ TokenReleaceList.extend(['L",\\\""'])
for dirpath, dirnames, filenames in tuple:
if IgnoredPattern.match(dirpath.upper()):
@@ -519,6 +521,7 @@ def CollectSourceCodeDataIntoDB(RootDir):
EdkLogger.info("Parsing " + FullName)
model = f.endswith('c') and DataClass.MODEL_FILE_C or DataClass.MODEL_FILE_H
collector = CodeFragmentCollector.CodeFragmentCollector(FullName)
+ collector.TokenReleaceList = TokenReleaceList
try:
collector.ParseFile()
except UnicodeError: