From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail.byosoft.com.cn (mail.byosoft.com.cn [58.240.74.242]) by mx.groups.io with SMTP id smtpd.web08.183.1615425967755177385 for ; Wed, 10 Mar 2021 17:26:08 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=none, err=permanent DNS error (domain: byosoft.com.cn, ip: 58.240.74.242, mailfrom: gaoliming@byosoft.com.cn) Received: from DESKTOPS6D0PVI ([58.246.60.130]) (envelope-sender ) by 192.168.6.13 with ESMTP for ; Thu, 11 Mar 2021 09:25:57 +0800 X-WM-Sender: gaoliming@byosoft.com.cn X-Originating-IP: 58.246.60.130 X-WM-AuthFlag: YES X-WM-AuthUser: gaoliming@byosoft.com.cn From: "gaoliming" To: , , , References: <20210309161728.13820-1-Pierre.Gondois@arm.com> In-Reply-To: <20210309161728.13820-1-Pierre.Gondois@arm.com> Subject: =?UTF-8?B?5Zue5aSNOiBbZWRrMi1kZXZlbF0gW1BBVENIIHYxIDEvMV0gQmFzZVRvb2xzL0VjYzogTWFrZSBFY2Mgb25seSBjaGVjayBmaXJzdCBpbmNsdWRlIGd1YXJk?= Date: Thu, 11 Mar 2021 09:26:00 +0800 Message-ID: <00d001d71615$7e9ad6c0$7bd08440$@byosoft.com.cn> MIME-Version: 1.0 X-Mailer: Microsoft Outlook 16.0 Thread-Index: AQIk3zODQ5RDbalIen/krCzL6pmem6nibIlQ Content-Type: text/plain; charset="gb2312" Content-Transfer-Encoding: quoted-printable Content-Language: zh-cn Is this checker for .h file only? > -----=D3=CA=BC=FE=D4=AD=BC=FE----- > =B7=A2=BC=FE=C8=CB: devel@edk2.groups.io =B4=FA= =B1=ED > PierreGondois > =B7=A2=CB=CD=CA=B1=BC=E4: 2021=C4=EA3=D4=C210=C8=D5 0:17 > =CA=D5=BC=FE=C8=CB: devel@edk2.groups.io; bob.c.feng@intel.com; > gaoliming@byosoft.com.cn; yuwei.chen@intel.com > =D6=F7=CC=E2: [edk2-devel] [PATCH v1 1/1] BaseTools/Ecc: Make Ecc only c= heck first > include guard >=20 > From: Pierre Gondois >=20 > The Ecc tool checks the format of the include guard. This check is > currently done on all the names following the '#ifndef' statement. > It should only be done on the first include guard. >=20 > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3252 > Signed-off-by: Pierre Gondois > --- > The changes can be seen at: > https://github.com/PierreARM/edk2/tree/1640_Ecc_tool_corrections >=20 > BaseTools/Source/Python/Ecc/Check.py | 9 ++++++--- > 1 file changed, 6 insertions(+), 3 deletions(-) >=20 > diff --git a/BaseTools/Source/Python/Ecc/Check.py > b/BaseTools/Source/Python/Ecc/Check.py > index 7a012617fd35..d82b42de0119 100644 > --- a/BaseTools/Source/Python/Ecc/Check.py > +++ b/BaseTools/Source/Python/Ecc/Check.py > @@ -3,6 +3,7 @@ > # > # Copyright (c) 2021, Arm Limited. All rights reserved.
> # Copyright (c) 2008 - 2020, Intel Corporation. All rights reserved. > +# Copyright (c) 2021, Arm Limited. All rights reserved.
> # SPDX-License-Identifier: BSD-2-Clause-Patent > # > from __future__ import absolute_import > @@ -1437,11 +1438,13 @@ class Check(object): >=20 > SqlCommand =3D """select ID, Value from %s where Model > =3D %s""" % (FileTable, MODEL_IDENTIFIER_MACRO_IFNDEF) > RecordSet =3D EccGlobalData.gDb.TblFile.Exec(SqlCommand) > - for Record in RecordSet: > - Name =3D Record[1].replace('#ifndef', '').strip() > + if RecordSet: > + # Only check the first ifndef statement of the file > + FirstDefine =3D sorted(RecordSet, key=3Dlambda Record: > Record[0])[0] > + Name =3D FirstDefine[1].replace('#ifndef', '').strip() > if Name[0] =3D=3D '_' or Name[-1] !=3D '_' or Name[-2] = = =3D=3D '_': > if not > EccGlobalData.gException.IsException(ERROR_NAMING_CONVENTION_CHE > CK_IFNDEF_STATEMENT, Name): > - > EccGlobalData.gDb.TblReport.Insert(ERROR_NAMING_CONVENTION_CHECK > _IFNDEF_STATEMENT, OtherMsg=3D"The #ifndef name [%s] does not follow the > rules" % (Name), BelongsToTable=3DFileTable, BelongsToItem=3DRecord[0]) > + > EccGlobalData.gDb.TblReport.Insert(ERROR_NAMING_CONVENTION_CHECK > _IFNDEF_STATEMENT, OtherMsg=3D"The #ifndef name [%s] does not follow the > rules" % (Name), BelongsToTable=3DFileTable, BelongsToItem=3DFirstDefine= [0]) >=20 > # Rule for path name, variable name and function name > # 1. First character should be upper case > -- > 2.17.1 >=20 >=20 >=20 >=20 >=20