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@bsdio.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
This commit is contained in:
Rebecca Cran 2023-04-06 17:36:32 -06:00 committed by mergify[bot]
parent 55b67b6950
commit c9fb11f92f
1 changed files with 6 additions and 0 deletions

View File

@ -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/.+ $