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.web11.3174.1613626712608376581 for ; Wed, 17 Feb 2021 21:38:33 -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, 18 Feb 2021 13:38:24 +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: , , , , Cc: References: <20210216092907.27870-1-Pierre.Gondois@arm.com> In-Reply-To: <20210216092907.27870-1-Pierre.Gondois@arm.com> Subject: =?UTF-8?B?5Zue5aSNOiBbZWRrMi1kZXZlbF0gW1BBVENIIHYyIDEvMV0gQmFzZVRvb2xzOiBBbGlnbiBpbmNsdWRlIGd1YXJkcyBwb2xpY3k=?= Date: Thu, 18 Feb 2021 13:38:26 +0800 Message-ID: <001201d705b8$479bc070$d6d34150$@byosoft.com.cn> MIME-Version: 1.0 X-Mailer: Microsoft Outlook 16.0 Thread-Index: AQLkUM/CzSI1vmp6hrP/VUrii9kwrqhCzswA Content-Type: text/plain; charset="gb2312" Content-Transfer-Encoding: quoted-printable Content-Language: zh-cn I am OK to add this checker in ECC.=20 Reviewed-by: Liming Gao > -----=D3=CA=BC=FE=D4=AD=BC=FE----- > =B7=A2=BC=FE=C8=CB: bounce+27952+71693+4905953+8761045@groups.io > =B4=FA=B1=ED PierreGondoi= s > =B7=A2=CB=CD=CA=B1=BC=E4: 2021=C4=EA2=D4=C216=C8=D5 17:29 > =CA=D5=BC=FE=C8=CB: devel@edk2.groups.io; bob.c.feng@intel.com; > gaoliming@byosoft.com.cn; rebecca@nuviainc.com; > sami.mujawar@arm.com > =B3=AD=CB=CD: leif@nuviainc.com > =D6=F7=CC=E2: [edk2-devel] [PATCH v2 1/1] BaseTools: Align include guard= s policy >=20 > From: Pierre Gondois >=20 > The EDK II C Coding Standards Specification states that: > "Names starting with one or two underscores, such as > _MACRO_GUARD_FILE_NAME_H_, must not be used. They are > reserved for compiler implementation." [1] >=20 > The Ecc tool currently checks that the include guard end with > a trailing underscore. Thus, the check and the error message > should both be modified. >=20 > The new check forces having one sole trailing underscore > character, as the example in the specification shows: > "FILE_NAME_H_" [1] > This would allow to have more consistency. >=20 > [1] Section 5.3.5 "All include file contents must be protected > by a #include guard": > https://edk2-docs.gitbook.io/ > edk-ii-c-coding-standards-specification/ > 5_source_files/53_include_files >=20 > Signed-off-by: Pierre Gondois > Reviewed-by: Sami Mujawar > --- > The changes can be seen at: > https://github.com/PierreARM/edk2/tree/1619_Ecc_BaseTools_include_guar > ds_v2 >=20 > Notes: > v2: > - Place new copyright on top of old ones [Rebecca] >=20 > BaseTools/Source/Python/Ecc/Check.py | 3 ++- > BaseTools/Source/Python/Ecc/EccToolError.py | 3 ++- > 2 files changed, 4 insertions(+), 2 deletions(-) >=20 > diff --git a/BaseTools/Source/Python/Ecc/Check.py > b/BaseTools/Source/Python/Ecc/Check.py > index 6087abfa4d8d..7a012617fd35 100644 > --- a/BaseTools/Source/Python/Ecc/Check.py > +++ b/BaseTools/Source/Python/Ecc/Check.py > @@ -1,6 +1,7 @@ > ## @file > # This file is used to define checkpoints used by ECC tool > # > +# Copyright (c) 2021, Arm Limited. All rights reserved.
> # Copyright (c) 2008 - 2020, Intel Corporation. All rights reserved. > # SPDX-License-Identifier: BSD-2-Clause-Patent > # > @@ -1438,7 +1439,7 @@ class Check(object): > RecordSet =3D EccGlobalData.gDb.TblFile.Exec(SqlCommand) > for Record in RecordSet: > Name =3D Record[1].replace('#ifndef', '').strip() > - if Name[-1] !=3D '_': > + 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): >=20 > 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]) >=20 > diff --git a/BaseTools/Source/Python/Ecc/EccToolError.py > b/BaseTools/Source/Python/Ecc/EccToolError.py > index 0ff3b42674d4..d97bf7948ce8 100644 > --- a/BaseTools/Source/Python/Ecc/EccToolError.py > +++ b/BaseTools/Source/Python/Ecc/EccToolError.py > @@ -1,6 +1,7 @@ > ## @file > # Standardized Error Handling infrastructures. > # > +# Copyright (c) 2021, Arm Limited. All rights reserved.
> # Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved. > # SPDX-License-Identifier: BSD-2-Clause-Patent > # > @@ -161,7 +162,7 @@ gEccErrorMessage =3D { > ERROR_NAMING_CONVENTION_CHECK_ALL : "", > ERROR_NAMING_CONVENTION_CHECK_DEFINE_STATEMENT : "Only > capital letters are allowed to be used for #define declarations", > ERROR_NAMING_CONVENTION_CHECK_TYPEDEF_STATEMENT : "Only > capital letters are allowed to be used for typedef declarations", > - ERROR_NAMING_CONVENTION_CHECK_IFNDEF_STATEMENT : "The > #ifndef at the start of an include file should use both prefix and postf= ix > underscore characters, '_'", > + ERROR_NAMING_CONVENTION_CHECK_IFNDEF_STATEMENT : "The > #ifndef at the start of an include file should have one postfix underscore, and > no prefix underscore character '_'", > ERROR_NAMING_CONVENTION_CHECK_PATH_NAME : """Path name > does not follow the rules: 1. First character should be upper case 2. Mu= st > contain lower case characters 3. No white space characters""", > ERROR_NAMING_CONVENTION_CHECK_VARIABLE_NAME : > """Variable name does not follow the rules: 1. First character should be upper > case 2. Must contain lower case characters 3. No white space characters = 4. > Global variable name must start with a 'g'""", > ERROR_NAMING_CONVENTION_CHECK_FUNCTION_NAME : > """Function name does not follow the rules: 1. First character should be upper > case 2. Must contain lower case characters 3. No white space characters""", > -- > 2.17.1 >=20 >=20 >=20 >=20 >=20