From af7fca3649779f0e55220a7acda9bd11bc660fc3 Mon Sep 17 00:00:00 2001 From: Jeff Fan Date: Mon, 16 Nov 2015 05:29:49 +0000 Subject: Update BaseTools from main trunk r18767. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jeff Fan git-svn-id: https://svn.code.sf.net/p/edk2/code/branches/UDK2015@18784 6f19259b-4bc3-4df7-8a09-765794883524 --- BaseTools/Source/Python/Ecc/Check.py | 18 +++++++++--------- BaseTools/Source/Python/Ecc/Ecc.py | 8 +++++++- BaseTools/Source/Python/Ecc/MetaDataParser.py | 5 +++-- BaseTools/Source/Python/Ecc/c.py | 16 ++++++++++------ 4 files changed, 29 insertions(+), 18 deletions(-) (limited to 'BaseTools/Source/Python/Ecc') diff --git a/BaseTools/Source/Python/Ecc/Check.py b/BaseTools/Source/Python/Ecc/Check.py index 7932fb3394..5e5c8e72e4 100644 --- a/BaseTools/Source/Python/Ecc/Check.py +++ b/BaseTools/Source/Python/Ecc/Check.py @@ -19,6 +19,7 @@ from MetaDataParser import ParseHeaderCommentSection import EccGlobalData import c from Common.LongFilePathSupport import OpenLongFilePath as open +from Common.MultipleWorkspace import MultipleWorkspace as mws ## Check # @@ -380,9 +381,7 @@ class Check(object): for Key in RecordDict: if len(RecordDict[Key]) > 1: for Item in RecordDict[Key]: - Path = Item[1].replace(EccGlobalData.gWorkspace, '') - if Path.startswith('\\') or Path.startswith('/'): - Path = Path[1:] + Path = mws.relpath(Item[1], EccGlobalData.gWorkspace) if not EccGlobalData.gException.IsException(ERROR_INCLUDE_FILE_CHECK_NAME, Path): EccGlobalData.gDb.TblReport.Insert(ERROR_INCLUDE_FILE_CHECK_NAME, OtherMsg="The file name for [%s] is duplicate" % Path, BelongsToTable='File', BelongsToItem=Item[0]) @@ -653,7 +652,7 @@ class Check(object): if LibraryClass[1].upper() == 'NULL' or LibraryClass[1].startswith('!ifdef') or LibraryClass[1].startswith('!ifndef') or LibraryClass[1].endswith('!endif'): continue else: - LibraryIns = os.path.normpath(os.path.join(EccGlobalData.gWorkspace, LibraryClass[2])) + LibraryIns = os.path.normpath(mws.join(EccGlobalData.gWorkspace, LibraryClass[2])) SqlCommand = """select Value3 from Inf where BelongsToFile = (select ID from File where lower(FullPath) = lower('%s')) and Value2 = '%s'""" % (LibraryIns, 'LIBRARY_CLASS') @@ -729,7 +728,7 @@ class Check(object): for Record in RecordSet: FdfID = Record[0] FilePath = Record[1] - FilePath = os.path.normpath(os.path.join(EccGlobalData.gWorkspace, FilePath)) + FilePath = os.path.normpath(mws.join(EccGlobalData.gWorkspace, FilePath)) SqlCommand = """select ID from Inf where Model = %s and BelongsToFile = (select ID from File where FullPath like '%s') """ % (MODEL_EFI_SOURCE_FILE, FilePath) NewRecordSet = EccGlobalData.gDb.TblFile.Exec(SqlCommand) @@ -913,9 +912,7 @@ class Check(object): RecordSet = Table.Exec(SqlCommand) Path = "" for Record in RecordSet: - Path = Record[0].replace(EccGlobalData.gWorkspace, '') - if Path.startswith('\\') or Path.startswith('/'): - Path = Path[1:] + Path = mws.relpath(Record[0], EccGlobalData.gWorkspace) return Path # Check whether two module INFs under one workspace has the same FILE_GUID value @@ -1223,7 +1220,10 @@ class Check(object): SqlCommand = """select ID, Name from %s where Model = %s""" % (FileTable, MODEL_IDENTIFIER_VARIABLE) RecordSet = EccGlobalData.gDb.TblFile.Exec(SqlCommand) for Record in RecordSet: - if not Pattern.match(Record[1]): + Var = Record[1] + if Var.startswith('CONST'): + Var = Var[5:].lstrip() + if not Pattern.match(Var): if not EccGlobalData.gException.IsException(ERROR_NAMING_CONVENTION_CHECK_VARIABLE_NAME, Record[1]): EccGlobalData.gDb.TblReport.Insert(ERROR_NAMING_CONVENTION_CHECK_VARIABLE_NAME, OtherMsg="The variable name [%s] does not follow the rules" % (Record[1]), BelongsToTable=FileTable, BelongsToItem=Record[0]) diff --git a/BaseTools/Source/Python/Ecc/Ecc.py b/BaseTools/Source/Python/Ecc/Ecc.py index ec8f6c22cf..c2ad4faff4 100644 --- a/BaseTools/Source/Python/Ecc/Ecc.py +++ b/BaseTools/Source/Python/Ecc/Ecc.py @@ -38,6 +38,7 @@ import c import re, string from Exception import * from Common.LongFilePathSupport import OpenLongFilePath as open +from Common.MultipleWorkspace import MultipleWorkspace as mws ## Ecc # @@ -70,8 +71,13 @@ class Ecc(object): # WorkspaceDir = os.path.normcase(os.path.normpath(os.environ["WORKSPACE"])) os.environ["WORKSPACE"] = WorkspaceDir + + # set multiple workspace + PackagesPath = os.getenv("PACKAGES_PATH") + mws.setWs(WorkspaceDir, PackagesPath) + if "ECP_SOURCE" not in os.environ: - os.environ["ECP_SOURCE"] = os.path.join(WorkspaceDir, GlobalData.gEdkCompatibilityPkg) + os.environ["ECP_SOURCE"] = mws.join(WorkspaceDir, GlobalData.gEdkCompatibilityPkg) if "EFI_SOURCE" not in os.environ: os.environ["EFI_SOURCE"] = os.environ["ECP_SOURCE"] if "EDK_SOURCE" not in os.environ: diff --git a/BaseTools/Source/Python/Ecc/MetaDataParser.py b/BaseTools/Source/Python/Ecc/MetaDataParser.py index d80a5cff5d..82ede3eb33 100644 --- a/BaseTools/Source/Python/Ecc/MetaDataParser.py +++ b/BaseTools/Source/Python/Ecc/MetaDataParser.py @@ -14,6 +14,7 @@ import Common.LongFilePathOs as os from CommonDataClass.DataClass import * from EccToolError import * +from Common.MultipleWorkspace import MultipleWorkspace as mws import EccGlobalData import re ## Get the inlcude path list for a source file @@ -33,8 +34,8 @@ def GetIncludeListOfFile(WorkSpace, Filepath, Db): % (MODEL_META_DATA_PACKAGE, MODEL_EFI_SOURCE_FILE, '\\', Filepath) RecordSet = Db.TblFile.Exec(SqlCommand) for Record in RecordSet: - DecFullPath = os.path.normpath(os.path.join(WorkSpace, Record[0])) - InfFullPath = os.path.normpath(os.path.join(WorkSpace, Record[1])) + DecFullPath = os.path.normpath(mws.join(WorkSpace, Record[0])) + InfFullPath = os.path.normpath(mws.join(WorkSpace, Record[1])) (DecPath, DecName) = os.path.split(DecFullPath) (InfPath, InfName) = os.path.split(InfFullPath) SqlCommand = """select Value1 from Dec where BelongsToFile = diff --git a/BaseTools/Source/Python/Ecc/c.py b/BaseTools/Source/Python/Ecc/c.py index dcb37e5632..256b9e021c 100644 --- a/BaseTools/Source/Python/Ecc/c.py +++ b/BaseTools/Source/Python/Ecc/c.py @@ -1271,7 +1271,10 @@ def CheckFuncLayoutReturnType(FullFileName): FuncName = Result[5] if EccGlobalData.gException.IsException(ERROR_C_FUNCTION_LAYOUT_CHECK_RETURN_TYPE, FuncName): continue - Index = Result[0].find(TypeStart) + Result0 = Result[0] + if Result0.upper().startswith('STATIC'): + Result0 = Result0[6:].strip() + Index = Result0.find(TypeStart) if Index != 0 or Result[3] != 0: PrintErrorMsg(ERROR_C_FUNCTION_LAYOUT_CHECK_RETURN_TYPE, '[%s] Return Type should appear at the start of line' % FuncName, FileTable, Result[1]) @@ -1313,9 +1316,10 @@ def CheckFuncLayoutModifier(FullFileName): for Result in ResultSet: ReturnType = GetDataTypeFromModifier(Result[0]) TypeStart = ReturnType.split()[0] -# if len(ReturnType) == 0: -# continue - Index = Result[0].find(TypeStart) + Result0 = Result[0] + if Result0.upper().startswith('STATIC'): + Result0 = Result0[6:].strip() + Index = Result0.find(TypeStart) if Index != 0: PrintErrorMsg(ERROR_C_FUNCTION_LAYOUT_CHECK_OPTIONAL_FUNCTIONAL_MODIFIER, '', FileTable, Result[1]) @@ -1327,8 +1331,6 @@ def CheckFuncLayoutModifier(FullFileName): for Result in ResultSet: ReturnType = GetDataTypeFromModifier(Result[0]) TypeStart = ReturnType.split()[0] -# if len(ReturnType) == 0: -# continue Result0 = Result[0] if Result0.upper().startswith('STATIC'): Result0 = Result0[6:].strip() @@ -1631,6 +1633,8 @@ def CheckMemberVariableFormat(Name, Value, FileTable, TdId, ModelId): Field = Field.strip() if Field == '': continue + if Field.startswith("#"): + continue # Enum could directly assign value to variable Field = Field.split('=')[0].strip() TokenList = Field.split() -- cgit v1.2.3