From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web12.11478.1608138323851420699 for ; Wed, 16 Dec 2020 09:05:23 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: arm.com, ip: 217.140.110.172, mailfrom: pierre.gondois@arm.com) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 768E01042; Wed, 16 Dec 2020 09:05:23 -0800 (PST) Received: from e120189.arm.com (unknown [10.57.25.48]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 08CE03F66E; Wed, 16 Dec 2020 09:05:21 -0800 (PST) From: "PierreGondois" To: devel@edk2.groups.io, bob.c.feng@intel.com, gaoliming@byosoft.com.cn, yuwei.chen@intel.com Cc: sami.mujawar@arm.com Subject: [PATCH v1 2/2] BaseTools/Ecc: Allow init of function static variables Date: Wed, 16 Dec 2020 17:05:06 +0000 Message-Id: <20201216170506.13313-3-Pierre.Gondois@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201216170506.13313-1-Pierre.Gondois@arm.com> References: <20201216170506.13313-1-Pierre.Gondois@arm.com> From: Pierre Gondois The Ecc tool currently reports the initialization of variables at declaraton if the variable is non-constant and declared in a function. Static variables locally defined in functions should also be allowed to be initialized at declaration. Signed-off-by: Pierre Gondois --- The changes can be seen at: https://github.com/PierreARM/edk2/commits/1551_Ecc_BaseTools_v1 BaseTools/Source/Python/Ecc/c.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BaseTools/Source/Python/Ecc/c.py b/BaseTools/Source/Python/Ecc/c.py index db686df0db25..4a82e5e76003 100644 --- a/BaseTools/Source/Python/Ecc/c.py +++ b/BaseTools/Source/Python/Ecc/c.py @@ -1560,7 +1560,7 @@ def CheckFuncLayoutLocalVariable(FullFileName): continue for Result in ResultSet: - if len(Result[1]) > 0 and 'CONST' not in Result[3]: + if len(Result[1]) > 0 and 'CONST' not in Result[3] and 'STATIC' not in Result[3]: PrintErrorMsg(ERROR_C_FUNCTION_LAYOUT_CHECK_NO_INIT_OF_VARIABLE, 'Variable Name: %s' % Result[0], FileTable, Result[2]) def CheckMemberVariableFormat(Name, Value, FileTable, TdId, ModelId): -- 2.17.1