From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.20; helo=mga02.intel.com; envelope-from=yonghong.zhu@intel.com; receiver=edk2-devel@lists.01.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 9F9002115C33D for ; Tue, 23 Oct 2018 05:35:27 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Oct 2018 05:35:27 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,416,1534834800"; d="scan'208";a="97790281" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by fmsmga002.fm.intel.com with ESMTP; 23 Oct 2018 05:35:27 -0700 Received: from fmsmsx101.amr.corp.intel.com (10.18.124.199) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 23 Oct 2018 05:35:26 -0700 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by fmsmsx101.amr.corp.intel.com (10.18.124.199) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 23 Oct 2018 05:35:26 -0700 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.84]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.131]) with mapi id 14.03.0319.002; Tue, 23 Oct 2018 20:35:23 +0800 From: "Zhu, Yonghong" To: "Zhu, Yonghong" , "edk2-devel@lists.01.org" CC: "Chen, Hesheng" , "Zhu, Yonghong" Thread-Topic: [edk2] [PATCH] BaseTools/ECC: Fix an identification issue of typedef function. Thread-Index: AQHUZSmeC+w4RcRqLEa+faqMTgHlWaUsz2Vg Date: Tue, 23 Oct 2018 12:35:22 +0000 Message-ID: References: <1539678233-17372-1-git-send-email-yonghong.zhu@intel.com> In-Reply-To: <1539678233-17372-1-git-send-email-yonghong.zhu@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH] BaseTools/ECC: Fix an identification issue of typedef function. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Oct 2018 12:35:27 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Yonghong Zhu Best Regards, Zhu Yonghong -----Original Message----- From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Yong= hong Zhu Sent: Tuesday, October 16, 2018 4:24 PM To: edk2-devel@lists.01.org Cc: Chen, Hesheng Subject: [edk2] [PATCH] BaseTools/ECC: Fix an identification issue of typed= ef function. From: Hess Chen Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hess Chen --- BaseTools/Source/Python/Ecc/Check.py | 12 +++++++++++- BaseTools/Source/Python/Ecc/c.py | 8 ++++++-- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/BaseTools/Source/Python/Ecc/Check.py b/BaseTools/Source/Python= /Ecc/Check.py index 3bf86b42cd..eb086362bd 100644 --- a/BaseTools/Source/Python/Ecc/Check.py +++ b/BaseTools/Source/Python/Ecc/Check.py @@ -586,13 +586,23 @@ class Check(object): if EccGlobalData.gConfig.IncludeFileCheckData =3D=3D '1' or EccGlo= balData.gConfig.IncludeFileCheckAll =3D=3D '1' or EccGlobalData.gConfig.Che= ckAll =3D=3D '1': EdkLogger.quiet("Checking header file data ...") =20 + # Get all typedef functions + gAllTypedefFun =3D [] + for IdentifierTable in EccGlobalData.gIdentifierTableList: + SqlCommand =3D """select Name from %s + where Model =3D %s """ % (IdentifierTable,= MODEL_IDENTIFIER_TYPEDEF) + RecordSet =3D EccGlobalData.gDb.TblFile.Exec(SqlCommand) + for Record in RecordSet: + if Record[0].startswith('('): + gAllTypedefFun.append(Record[0]) + # for Dirpath, Dirnames, Filenames in self.WalkTree(): # for F in Filenames: # if os.path.splitext(F)[1] in ('.h'): # FullName =3D os.path.join(Dirpath, F) # MsgList =3D c.CheckHeaderFileData(FullName) for FullName in EccGlobalData.gHFileList: - MsgList =3D c.CheckHeaderFileData(FullName) + MsgList =3D c.CheckHeaderFileData(FullName,=20 + gAllTypedefFun) =20 # Doxygen document checking def DoxygenCheck(self): diff --git a/BaseTools/Source/Python/Ecc/c.py b/BaseTools/Source/Python/Ecc= /c.py index 953f1630b6..b8d6adde16 100644 --- a/BaseTools/Source/Python/Ecc/c.py +++ b/BaseTools/Source/Python/Ecc/c.py @@ -2144,7 +2144,7 @@ def CheckBooleanValueComparison(FullFileName): PrintErrorMsg(ERROR_PREDICATE_EXPRESSION_CHECK_BOOLEAN= _VALUE, 'Predicate Expression: %s' % Exp, FileTable, Str[2]) =20 =20 -def CheckHeaderFileData(FullFileName): +def CheckHeaderFileData(FullFileName, AllTypedefFun=3D[]): ErrorMsgList =3D [] =20 FileID =3D GetTableID(FullFileName, ErrorMsgList) @@ -2160,7 +2160,11 = @@ def CheckHeaderFileData(FullFileName): ResultSet =3D Db.TblFile.Exec(SqlStatement) for Result in ResultSet: if not Result[1].startswith('extern'): - PrintErrorMsg(ERROR_INCLUDE_FILE_CHECK_DATA, 'Variable definit= ion appears in header file', FileTable, Result[0]) + for Item in AllTypedefFun: + if '(%s)' % Result[1] in Item: + break + else: + PrintErrorMsg(ERROR_INCLUDE_FILE_CHECK_DATA, 'Variable=20 + definition appears in header file', FileTable, Result[0]) =20 SqlStatement =3D """ select ID from Function -- 2.14.2.windows.2 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel