]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BaseTools/Ecc: Allow init of function static variables
authorPierre Gondois <Pierre.Gondois@arm.com>
Thu, 10 Dec 2020 13:47:50 +0000 (13:47 +0000)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Tue, 22 Dec 2020 01:26:10 +0000 (01:26 +0000)
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@arm.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
BaseTools/Source/Python/Ecc/c.py

index db686df0db25145bba4634b1eef87440e1759bf1..4a82e5e76003a0d18f01e01f02efd5c4d2db5708 100644 (file)
@@ -1560,7 +1560,7 @@ def CheckFuncLayoutLocalVariable(FullFileName):
             continue\r
 \r
         for Result in ResultSet:\r
-            if len(Result[1]) > 0 and 'CONST' not in Result[3]:\r
+            if len(Result[1]) > 0 and 'CONST' not in Result[3] and 'STATIC' not in Result[3]:\r
                 PrintErrorMsg(ERROR_C_FUNCTION_LAYOUT_CHECK_NO_INIT_OF_VARIABLE, 'Variable Name: %s' % Result[0], FileTable, Result[2])\r
 \r
 def CheckMemberVariableFormat(Name, Value, FileTable, TdId, ModelId):\r