[edk2-devel] [PATCH v2 1/1] BaseTools: Update PatchCheck.py to check for __FUNCTION__

Michael D Kinney michael.d.kinney at intel.com
Thu Apr 13 16:38:04 UTC 2023


Reviewed-by: Michael D Kinney <michael.d.kinney at intel.com>


> -----Original Message-----
> From: devel at edk2.groups.io <devel at edk2.groups.io> On Behalf Of Rebecca Cran
> Sent: Thursday, April 13, 2023 8:16 AM
> To: devel at edk2.groups.io; Kinney, Michael D <michael.d.kinney at intel.com>; Gao, Liming <gaoliming at byosoft.com.cn>; Feng, Bob C
> <bob.c.feng at intel.com>; Chen, Christine <yuwei.chen at intel.com>
> Cc: Rebecca Cran <rebecca at bsdio.com>
> Subject: [edk2-devel] [PATCH v2 1/1] BaseTools: Update PatchCheck.py to check for __FUNCTION__
> 
> New code should use the C99 macro __func__ instead of the pre-Standard
> macro __FUNCTION__. Update PatchCheck.py to reject patches with the
> latter.
> 
> Signed-off-by: Rebecca Cran <rebecca at bsdio.com>
> ---
>  BaseTools/Scripts/PatchCheck.py | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/BaseTools/Scripts/PatchCheck.py b/BaseTools/Scripts/PatchCheck.py
> index 5d17d99a12ef..900226f18fe5 100755
> --- a/BaseTools/Scripts/PatchCheck.py
> +++ b/BaseTools/Scripts/PatchCheck.py
> @@ -491,6 +491,12 @@ class GitDiffCheck:
>                                    'but DEBUG_' + mo.group(1) +
>                                    ' is now recommended', line)
> 
> +        rp_file = os.path.realpath(self.filename)
> +        rp_script = os.path.realpath(__file__)
> +        if line.find('__FUNCTION__') != -1 and rp_file != rp_script:
> +            self.added_line_error('__FUNCTION__ was used, but __func__ '
> +                                  'is now recommended', line)
> +
>      split_diff_re = re.compile(r'''
>                                     (?P<cmd>
>                                         ^ diff \s+ --git \s+ a/.+ \s+ b/.+ $
> --
> 2.34.1
> 
> 
> 
> 
> 



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




More information about the edk2-devel-archive mailing list