From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.115, mailfrom: bob.c.feng@intel.com) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by groups.io with SMTP; Sun, 08 Sep 2019 19:41:08 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 Sep 2019 19:41:07 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,483,1559545200"; d="scan'208";a="335456943" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by orsmga004.jf.intel.com with ESMTP; 08 Sep 2019 19:41:07 -0700 Received: from fmsmsx120.amr.corp.intel.com (10.18.124.208) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.439.0; Sun, 8 Sep 2019 19:41:07 -0700 Received: from shsmsx102.ccr.corp.intel.com (10.239.4.154) by fmsmsx120.amr.corp.intel.com (10.18.124.208) with Microsoft SMTP Server (TLS) id 14.3.439.0; Sun, 8 Sep 2019 19:41:06 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.32]) by shsmsx102.ccr.corp.intel.com ([169.254.2.113]) with mapi id 14.03.0439.000; Mon, 9 Sep 2019 10:41:04 +0800 From: "Bob Feng" To: "Fan, ZhijuX" , "devel@edk2.groups.io" CC: "Gao, Liming" Subject: Re: [PATCH] BaseTools:ECC need to handle lower case 'static' Thread-Topic: [PATCH] BaseTools:ECC need to handle lower case 'static' Thread-Index: AdVjBrNa1Y1V8hFzSS2GNXtModCyeQDsUfDw Date: Mon, 9 Sep 2019 02:41:04 +0000 Message-ID: <08650203BA1BD64D8AD9B6D5D74A85D1615327CC@SHSMSX104.ccr.corp.intel.com> References: In-Reply-To: Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Return-Path: bob.c.feng@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Bob Feng =20 -----Original Message----- From: Fan, ZhijuX=20 Sent: Wednesday, September 4, 2019 5:54 PM To: devel@edk2.groups.io Cc: Gao, Liming ; Feng, Bob C Subject: [PATCH] BaseTools:ECC need to handle lower case 'static' BZ:https://bugzilla.tianocore.org/show_bug.cgi?id=3D1778 We are going to add keyword (lower case) 'static' for functions and global = variables which are not referenced outside their current C file. However, the ECC tool only recognizes upper case 'STATIC' at this moment. This will lead to issue reports for new codes that follow the above coding = style. This patch is going to handle lower case 'static' Cc: Liming Gao Cc: Bob Feng Signed-off-by: Zhiju.Fan --- BaseTools/Source/Python/Ecc/Check.py | 2 +- BaseTools/Source/Python/Ecc/Configuration.py | 2 +- BaseTools/Source/Pyth= on/Ecc/EccToolError.py | 2 +- BaseTools/Source/Python/Ecc/c.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/BaseTools/Source/Python/Ecc/Check.py b/BaseTools/Source/Python= /Ecc/Check.py index 86bb8562ba..2180818609 100644 --- a/BaseTools/Source/Python/Ecc/Check.py +++ b/BaseTools/Source/Python/Ecc/Check.py @@ -441,7 +441,7 @@ class Check(object): self.DeclCheckUnionType() =20 =20 - # Check whether no use of int, unsigned, char, void, static, long in a= ny .c, .h or .asl files. + # Check whether no use of int, unsigned, char, void, long in any .c, .= h or .asl files. def DeclCheckNoUseCType(self): if EccGlobalData.gConfig.DeclarationDataTypeCheckNoUseCType =3D=3D= '1' or EccGlobalData.gConfig.DeclarationDataTypeCheckAll =3D=3D '1' or Ecc= GlobalData.gConfig.CheckAll =3D=3D '1': EdkLogger.quiet("Checking Declaration No use C type ...") diff= --git a/BaseTools/Source/Python/Ecc/Configuration.py b/BaseTools/Source/Py= thon/Ecc/Configuration.py index 57ae932ed2..9d9feaca5e 100644 --- a/BaseTools/Source/Python/Ecc/Configuration.py +++ b/BaseTools/Source/Python/Ecc/Configuration.py @@ -256,7 +256,7 @@ class Configuration(object): ## Declarations and Data Types Checking self.DeclarationDataTypeCheckAll =3D 0 =20 - # Check whether no use of int, unsigned, char, void, static, long = in any .c, .h or .asl files. + # Check whether no use of int, unsigned, char, void, long in any .= c, .h or .asl files. self.DeclarationDataTypeCheckNoUseCType =3D 1 # Check whether the modifiers IN, OUT, OPTIONAL, and UNALIGNED are= used only to qualify arguments to a function and should not appear in a da= ta type declaration self.DeclarationDataTypeCheckInOutModifier =3D 1 diff --git a/Base= Tools/Source/Python/Ecc/EccToolError.py b/BaseTools/Source/Python/Ecc/EccTo= olError.py index 4b1bef6a3e..0ff3b42674 100644 --- a/BaseTools/Source/Python/Ecc/EccToolError.py +++ b/BaseTools/Source/Python/Ecc/EccToolError.py @@ -149,7 +149,7 @@ gEccErrorMessage =3D { ERROR_INCLUDE_FILE_CHECK_NAME : "No permission for the include file wi= th same names", =20 ERROR_DECLARATION_DATA_TYPE_CHECK_ALL : "", - ERROR_DECLARATION_DATA_TYPE_CHECK_NO_USE_C_TYPE : "There should be no = use of int, unsigned, char, void, static, long in any .c, .h or .asl files"= , + ERROR_DECLARATION_DATA_TYPE_CHECK_NO_USE_C_TYPE : "There should be=20 + no use of int, unsigned, char, void, long in any .c, .h or .asl=20 + files", ERROR_DECLARATION_DATA_TYPE_CHECK_IN_OUT_MODIFIER : """The modifiers I= N, OUT, OPTIONAL, and UNALIGNED should be used only to qualify arguments to= a function and should not appear in a data type declaration""", ERROR_DECLARATION_DATA_TYPE_CHECK_EFI_API_MODIFIER : "The EFIAPI modif= ier should be used at the entry of drivers, events, and member functions of= protocols", ERROR_DECLARATION_DATA_TYPE_CHECK_ENUMERATED_TYPE : "Enumerated Type s= hould have a 'typedef' and the name must be in capital letters", diff --git= a/BaseTools/Source/Python/Ecc/c.py b/BaseTools/Source/Python/Ecc/c.py index 2a73da7cb8..a99b40a701 100644 --- a/BaseTools/Source/Python/Ecc/c.py +++ b/BaseTools/Source/Python/Ecc/c.py @@ -1859,7 +1859,7 @@ def CheckDeclNoUseCType(FullFileName): where Model =3D %d """ % (FileTable, DataClass.MODEL_IDENTIFIER_VARIABLE) ResultSet =3D Db.TblFile.Exec(SqlStatement) - CTypeTuple =3D ('int', 'unsigned', 'char', 'void', 'static', 'long') + CTypeTuple =3D ('int', 'unsigned', 'char', 'void', 'long') for Result in ResultSet: for Type in CTypeTuple: if PatternInModifier(Result[0], Type): -- 2.14.1.windows.1