[edk2-devel] [PATCH v1 2/2] BaseTools/Ecc: Allow init of function static variables

PierreGondois pierre.gondois at arm.com
Wed Dec 16 17:05:06 UTC 2020


From: Pierre Gondois <Pierre.Gondois at arm.com>

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 <Pierre.Gondois at arm.com>
---
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



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#68982): https://edk2.groups.io/g/devel/message/68982
Mute This Topic: https://groups.io/mt/79005708/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-





More information about the edk2-devel-archive mailing list