tianocore / edk2

EDK II
https://github.com/tianocore/tianocore.github.io/wiki/EDK-II
Other
4.52k stars 2.44k forks source link

BaseTools/Ecc: Allow `static` as a modifier #5896

Closed makubacki closed 1 month ago

makubacki commented 1 month ago

Description

Currently, STATIC is allowed as a function modifier but static results in the below ECC errors:

*Error code: 5001
*Return type of a function should exist and in the first line
*file: D:\src\edk2\Build\.pytool\Plugin\EccCheck\MdePkg\Library\UefiDebugLibDebugPortProtocol\DebugLibConstructor.c
*Line number: 37
*[UefiDebugLibDebugPortProtocolExitBootServicesCallback] Return
 Type should appear at the start of line

EFI coding style error
*Error code: 5002
*Any optional functional modifiers should exist and next to the
 return type
*file: D:\src\edk2\Build\.pytool\Plugin\EccCheck\MdePkg\Library\UefiDebugLibDebugPortProtocol\DebugLibConstructor.c
*Line number: 37

This is because GetDataTypeFromModifier() will return both static and the return type (e.g. VOID) whereas for a modifier in the list (e.g. STATIC) it will return only the return type allowing logic in Ecc/c.py to process the modifier and return type with current logic.

This is intended to allow static and STATIC for a period of time until all code is updated to use static.

How This Was Tested

Integration Instructions

N/A

lgao4 commented 1 month ago

Agree this change.