From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mx.groups.io with SMTP id smtpd.web10.5085.1579570557080755934 for ; Mon, 20 Jan 2020 17:35:57 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 134.134.136.126, mailfrom: bob.c.feng@intel.com) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Jan 2020 17:35:56 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,344,1574150400"; d="scan'208";a="307055594" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by orsmga001.jf.intel.com with ESMTP; 20 Jan 2020 17:35:56 -0800 Received: from shsmsx602.ccr.corp.intel.com (10.109.6.142) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.439.0; Mon, 20 Jan 2020 17:35:55 -0800 Received: from shsmsx601.ccr.corp.intel.com (10.109.6.141) by SHSMSX602.ccr.corp.intel.com (10.109.6.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Tue, 21 Jan 2020 09:35:54 +0800 Received: from shsmsx601.ccr.corp.intel.com ([10.109.6.141]) by SHSMSX601.ccr.corp.intel.com ([10.109.6.141]) with mapi id 15.01.1713.004; Tue, 21 Jan 2020 09:35:54 +0800 From: "Bob Feng" To: "Fan, ZhijuX" , "devel@edk2.groups.io" CC: "Gao, Liming" Subject: Re: [PATCH] BaseTools:ECC fails to detect function header comments issue Thread-Topic: [PATCH] BaseTools:ECC fails to detect function header comments issue Thread-Index: AdXPbUDwIKhChJaDS5ux2Bgv/7xAxQAjNyyA Date: Tue, 21 Jan 2020 01:35:53 +0000 Message-ID: <6585dd1ef8a24adfa3ab5d097bd0c0ef@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.36] 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 I have 2 comments. 1. CheckParamName may return None. But according to other part of this func= tion, it should return True or False. 2. The meaning of ParamList.pop(0) is not much clear.=20 Thanks, Bob -----Original Message----- From: Fan, ZhijuX=20 Sent: Monday, January 20, 2020 4:40 PM To: devel@edk2.groups.io Cc: Gao, Liming ; Feng, Bob C Subject: [PATCH] BaseTools:ECC fails to detect function header comments iss= ue BZ:https://bugzilla.tianocore.org/show_bug.cgi?id=3D1523 When the keyword after @param doesn't match the actual function parameter n= ame, ECC doesn't detect such issue The patch is going to fix this issue Cc: Liming Gao Cc: Bob Feng Signed-off-by: Zhiju.Fan --- BaseTools/Source/Python/Ecc/c.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/BaseTools/Source/Python/Ecc/c.py b/BaseTools/Source/Python/Ecc= /c.py index a30122a45f..e42463952d 100644 --- a/BaseTools/Source/Python/Ecc/c.py +++ b/BaseTools/Source/Python/Ecc/c.py @@ -2554,6 +2554,20 @@ def CheckGeneralDoxygenCommentLayout(Str, StartLine,= ErrorMsgList, CommentId=3D -1 ErrorMsgList.append('Line %d : @retval appear before @param ' % St= artLine) PrintErrorMsg(ERROR_DOXYGEN_CHECK_FUNCTION_HEADER, 'in Comment, @r= etval appear before @param ', TableName, CommentId) =20 +def CheckParamName(ParamName, Tag): + ParamList =3D Tag.split() + if len(ParamList) > 1: + ParamList.pop(0) + for Item in ParamList: + if Item.find('[') > 0 and Item.find(']') > 0: + continue + if ParamName !=3D Item.strip(): + return True + else: + return False + else: + return True + def CheckFunctionHeaderConsistentWithDoxygenComment(FuncModifier, FuncHead= er, FuncStartLine, CommentStr, CommentStartLine, ErrorMsgList, CommentId=3D= -1, TableName=3D''): =20 ParamList =3D GetParamList(FuncHeader) @@ -2608,7 +2622,7 @@ def Check= FunctionHeaderConsistentWithDoxygenComment(FuncModifier, FuncHeader, Fu PrintErrorMsg(ERROR_DOXYGEN_CHECK_FUNCTION= _HEADER, 'in Comment, <%s> does NOT have %s ' % ((TagPartList[0] + ' ' + Ta= gPartList[1]).replace('\n', '').replace('\r', ''), '[' + InOutStr + ']'), T= ableName, CommentId) =20 =20 - if Tag.find(ParamName) =3D=3D -1 and ParamName !=3D 'VOID' and= ParamName !=3D 'void': + if (Tag.find(ParamName) =3D=3D -1 or CheckParamName(ParamName,= Tag)) and ParamName !=3D 'VOID' and ParamName !=3D 'void': ErrorMsgList.append('Line %d : in Comment, <%s> does NOT c= onsistent with parameter name %s ' % (CommentStartLine, (TagPartList[0] + '= ' + TagPartList[1]).replace('\n', '').replace('\r', ''), ParamName)) PrintErrorMsg(ERROR_DOXYGEN_CHECK_FUNCTION_HEADER, 'in Com= ment, <%s> does NOT consistent with parameter name %s ' % ((TagPartList[0] = + ' ' + TagPartList[1]).replace('\n', '').replace('\r', ''), ParamName), Ta= bleName, CommentId) Index +=3D 1 -- 2.14.1.windows.1